Skip to content

Commit c1c700b

Browse files
committed
[generated] Run dprint
[git-generate] test -f ./node_modules/.bin/dprint || npm ci npx dprint fmt
1 parent d8e52d5 commit c1c700b

File tree

439 files changed

+86213
-22547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

439 files changed

+86213
-22547
lines changed

.eslintrc.json

Lines changed: 64 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,53 @@
2222

2323
"@typescript-eslint/naming-convention": [
2424
"error",
25-
{ "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
26-
{ "selector": "interface", "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": false }, "filter": { "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", "match": false } },
27-
{ "selector": "variable", "format": ["camelCase", "PascalCase", "UPPER_CASE"], "leadingUnderscore": "allow", "filter": { "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
28-
{ "selector": "function", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
29-
{ "selector": "parameter", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", "match": false } },
30-
{ "selector": "method", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
31-
{ "selector": "memberLike", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
32-
{ "selector": "enumMember", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
25+
{
26+
"selector": "typeLike",
27+
"format": ["PascalCase"],
28+
"filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false }
29+
},
30+
{
31+
"selector": "interface",
32+
"format": ["PascalCase"],
33+
"custom": { "regex": "^I[A-Z]", "match": false },
34+
"filter": { "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", "match": false }
35+
},
36+
{
37+
"selector": "variable",
38+
"format": ["camelCase", "PascalCase", "UPPER_CASE"],
39+
"leadingUnderscore": "allow",
40+
"filter": { "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", "match": false }
41+
},
42+
{
43+
"selector": "function",
44+
"format": ["camelCase", "PascalCase"],
45+
"leadingUnderscore": "allow",
46+
"filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false }
47+
},
48+
{
49+
"selector": "parameter",
50+
"format": ["camelCase"],
51+
"leadingUnderscore": "allow",
52+
"filter": { "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", "match": false }
53+
},
54+
{
55+
"selector": "method",
56+
"format": ["camelCase", "PascalCase"],
57+
"leadingUnderscore": "allow",
58+
"filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false }
59+
},
60+
{
61+
"selector": "memberLike",
62+
"format": ["camelCase"],
63+
"leadingUnderscore": "allow",
64+
"filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false }
65+
},
66+
{
67+
"selector": "enumMember",
68+
"format": ["camelCase", "PascalCase"],
69+
"leadingUnderscore": "allow",
70+
"filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false }
71+
},
3372
{ "selector": "property", "format": null }
3473
],
3574

@@ -87,7 +126,15 @@
87126
"no-new-func": "error",
88127
"no-new-wrappers": "error",
89128
"no-return-await": "error",
90-
"no-restricted-globals": ["error", { "name": "setTimeout" }, { "name": "clearTimeout" }, { "name": "setInterval" }, { "name": "clearInterval" }, { "name": "setImmediate" }, { "name": "clearImmediate" }],
129+
"no-restricted-globals": [
130+
"error",
131+
{ "name": "setTimeout" },
132+
{ "name": "clearTimeout" },
133+
{ "name": "setInterval" },
134+
{ "name": "clearInterval" },
135+
{ "name": "setImmediate" },
136+
{ "name": "clearImmediate" }
137+
],
91138
"no-sparse-arrays": "error",
92139
"no-template-curly-in-string": "error",
93140
"no-throw-literal": "error",
@@ -121,7 +168,14 @@
121168
"files": ["*.mjs", "*.mts"],
122169
"rules": {
123170
// These globals don't exist outside of CJS files.
124-
"no-restricted-globals": ["error", { "name": "__filename" }, { "name": "__dirname" }, { "name": "require" }, { "name": "module" }, { "name": "exports" }]
171+
"no-restricted-globals": [
172+
"error",
173+
{ "name": "__filename" },
174+
{ "name": "__dirname" },
175+
{ "name": "require" },
176+
{ "name": "module" },
177+
{ "name": "exports" }
178+
]
125179
}
126180
}
127181
]

.vscode/settings.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"[typescript][javascript][json][jsonc]": {
1111
// "editor.formatOnSave": true,
1212
"editor.defaultFormatter": "dprint.dprint"
13-
}
13+
},
1414

1515
// To ignore commits listed in .git-blame-ignore-revs in GitLens:
1616
// "gitlens.advanced.blame.customArguments": [

Herebyfile.mjs

Lines changed: 111 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,24 @@ import { task } from "hereby";
66
import _glob from "glob";
77
import util from "util";
88
import chalk from "chalk";
9-
import { exec, readJson, getDiffTool, getDirSize, memoize, needsUpdate, Debouncer, Deferred } from "./scripts/build/utils.mjs";
10-
import { runConsoleTests, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline, cleanTestDirs } from "./scripts/build/tests.mjs";
9+
import {
10+
exec,
11+
readJson,
12+
getDiffTool,
13+
getDirSize,
14+
memoize,
15+
needsUpdate,
16+
Debouncer,
17+
Deferred,
18+
} from "./scripts/build/utils.mjs";
19+
import {
20+
runConsoleTests,
21+
refBaseline,
22+
localBaseline,
23+
refRwcBaseline,
24+
localRwcBaseline,
25+
cleanTestDirs,
26+
} from "./scripts/build/tests.mjs";
1127
import { buildProject as realBuildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
1228
import { localizationDirectories } from "./scripts/build/localization.mjs";
1329
import cmdLineOptions from "./scripts/build/options.mjs";
@@ -40,7 +56,10 @@ const buildProjectWithEmit = async (...args) => {
4056

4157
if (currentlyBuilding === 0) {
4258
oldTsconfigBase = fs.readFileSync(tsconfigBasePath, "utf-8");
43-
fs.writeFileSync(tsconfigBasePath, oldTsconfigBase.replace(`"emitDeclarationOnly": true,`, `"emitDeclarationOnly": false, // DO NOT COMMIT`));
59+
fs.writeFileSync(
60+
tsconfigBasePath,
61+
oldTsconfigBase.replace(`"emitDeclarationOnly": true,`, `"emitDeclarationOnly": false, // DO NOT COMMIT`),
62+
);
4463
}
4564

4665
currentlyBuilding++;
@@ -138,7 +157,12 @@ const localize = task({
138157
dependencies: [generateDiagnostics],
139158
run: async () => {
140159
if (needsUpdate(diagnosticMessagesGeneratedJson, generatedLCGFile)) {
141-
await exec(process.execPath, ["scripts/generateLocalizedDiagnosticMessages.mjs", "src/loc/lcl", "built/local", diagnosticMessagesGeneratedJson], { ignoreExitCode: true });
160+
await exec(process.execPath, [
161+
"scripts/generateLocalizedDiagnosticMessages.mjs",
162+
"src/loc/lcl",
163+
"built/local",
164+
diagnosticMessagesGeneratedJson,
165+
], { ignoreExitCode: true });
142166
}
143167
},
144168
});
@@ -224,7 +248,9 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
224248
//
225249
// See: https://github.com/evanw/esbuild/issues/1958
226250
return {
227-
errors: [{ text: 'Attempted to bundle from node_modules; ensure "external" is set correctly.' }],
251+
errors: [{
252+
text: 'Attempted to bundle from node_modules; ensure "external" is set correctly.',
253+
}],
228254
};
229255
});
230256
},
@@ -266,7 +292,8 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
266292

267293
return {
268294
build: async () => esbuild.build(await getOptions()),
269-
watch: async () => esbuild.build({ ...await getOptions(), watch: taskOptions.watchMode ?? true, logLevel: "info" }),
295+
watch: async () =>
296+
esbuild.build({ ...await getOptions(), watch: taskOptions.watchMode ?? true, logLevel: "info" }),
270297
};
271298
}
272299

@@ -317,7 +344,10 @@ function entrypointBuildTask(options) {
317344
const outDir = path.dirname(options.output);
318345
await fs.promises.mkdir(outDir, { recursive: true });
319346
const moduleSpecifier = path.relative(outDir, options.builtEntrypoint);
320-
await fs.promises.writeFile(options.output, `module.exports = require("./${moduleSpecifier.replace(/[\\/]/g, "/")}")`);
347+
await fs.promises.writeFile(
348+
options.output,
349+
`module.exports = require("./${moduleSpecifier.replace(/[\\/]/g, "/")}")`,
350+
);
321351
},
322352
});
323353

@@ -330,13 +360,19 @@ function entrypointBuildTask(options) {
330360
const watch = task({
331361
name: `watch-${options.name}`,
332362
hiddenFromTaskList: true, // This is best effort.
333-
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(cmdLineOptions.bundle ? [] : [shim]),
363+
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(
364+
cmdLineOptions.bundle ? [] : [shim],
365+
),
334366
run: () => {
335367
// These watch functions return promises that resolve once watch mode has started,
336368
// allowing them to operate as regular tasks, while creating unresolved promises
337369
// in the background that keep the process running after all tasks have exited.
338370
if (!printedWatchWarning) {
339-
console.error(chalk.yellowBright("Warning: watch mode is incomplete and may not work as expected. Use at your own risk."));
371+
console.error(
372+
chalk.yellowBright(
373+
"Warning: watch mode is incomplete and may not work as expected. Use at your own risk.",
374+
),
375+
);
340376
printedWatchWarning = true;
341377
}
342378

@@ -380,7 +416,12 @@ export const dtsServices = task({
380416
description: "Bundles typescript.d.ts",
381417
dependencies: [buildServices],
382418
run: async () => {
383-
if (needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", ["./built/local/typescript.d.ts", "./built/local/typescript.internal.d.ts"])) {
419+
if (
420+
needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", [
421+
"./built/local/typescript.d.ts",
422+
"./built/local/typescript.internal.d.ts",
423+
])
424+
) {
384425
await runDtsBundler("./built/local/typescript/typescript.d.ts", "./built/local/typescript.d.ts");
385426
}
386427
},
@@ -439,8 +480,16 @@ export const dtsLssl = task({
439480
description: "Bundles tsserverlibrary.d.ts",
440481
dependencies: [buildLssl],
441482
run: async () => {
442-
if (needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", ["./built/local/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.internal.d.ts"])) {
443-
await runDtsBundler("./built/local/tsserverlibrary/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.d.ts");
483+
if (
484+
needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", [
485+
"./built/local/tsserverlibrary.d.ts",
486+
"./built/local/tsserverlibrary.internal.d.ts",
487+
])
488+
) {
489+
await runDtsBundler(
490+
"./built/local/tsserverlibrary/tsserverlibrary.d.ts",
491+
"./built/local/tsserverlibrary.d.ts",
492+
);
444493
}
445494
},
446495
});
@@ -573,7 +622,13 @@ export const watchOtherOutputs = task({
573622
name: "watch-other-outputs",
574623
description: "Builds miscelaneous scripts and documents distributed with the LKG",
575624
hiddenFromTaskList: true,
576-
dependencies: [watchCancellationToken, watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
625+
dependencies: [
626+
watchCancellationToken,
627+
watchTypingsInstaller,
628+
watchWatchGuard,
629+
generateTypesMap,
630+
copyBuiltLocalDiagnosticMessages,
631+
],
577632
});
578633

579634
const buildLocal = task({
@@ -584,7 +639,9 @@ const buildLocal = task({
584639
export const local = task({
585640
name: "local",
586641
description: "Builds the full compiler and services",
587-
dependencies: [localize, tsc, tsserver, services, lssl, otherOutputs, dts].concat(cmdLineOptions.typecheck ? [buildLocal] : []),
642+
dependencies: [localize, tsc, tsserver, services, lssl, otherOutputs, dts].concat(
643+
cmdLineOptions.typecheck ? [buildLocal] : [],
644+
),
588645
});
589646
export default local;
590647

@@ -656,7 +713,10 @@ export const runTestsAndWatch = task({
656713
if (!token.signaled) {
657714
running = true;
658715
try {
659-
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, { token, watching: true });
716+
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, {
717+
token,
718+
watching: true,
719+
});
660720
}
661721
catch {
662722
// ignore
@@ -815,7 +875,10 @@ export const updateSublime = task({
815875
dependencies: [tsserver],
816876
run: async () => {
817877
for (const file of ["built/local/tsserver.js", "built/local/tsserver.js.map"]) {
818-
await fs.promises.copyFile(file, path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)));
878+
await fs.promises.copyFile(
879+
file,
880+
path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)),
881+
);
819882
}
820883
},
821884
});
@@ -851,7 +914,10 @@ export const produceLKG = task({
851914
.concat(localizationTargets)
852915
.filter(f => !fs.existsSync(f));
853916
if (missingFiles.length > 0) {
854-
throw new Error("Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n" + missingFiles.join("\n"));
917+
throw new Error(
918+
"Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n"
919+
+ missingFiles.join("\n"),
920+
);
855921
}
856922
const sizeBefore = getDirSize("lib");
857923
await exec(process.execPath, ["scripts/produceLKG.mjs"]);
@@ -872,7 +938,13 @@ export const generateSpec = task({
872938
name: "generate-spec",
873939
description: "Generates a Markdown version of the Language Specification",
874940
hiddenFromTaskList: true,
875-
run: () => exec("cscript", ["//nologo", "scripts/word2md.mjs", path.resolve("doc/TypeScript Language Specification - ARCHIVED.docx"), path.resolve("doc/spec-ARCHIVED.md")]),
941+
run: () =>
942+
exec("cscript", [
943+
"//nologo",
944+
"scripts/word2md.mjs",
945+
path.resolve("doc/TypeScript Language Specification - ARCHIVED.docx"),
946+
path.resolve("doc/spec-ARCHIVED.md"),
947+
]),
876948
});
877949

878950
export const cleanBuilt = task({
@@ -890,19 +962,37 @@ export const clean = task({
890962
export const configureNightly = task({
891963
name: "configure-nightly",
892964
description: "Runs scripts/configurePrerelease.mjs to prepare a build for nightly publishing",
893-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "dev", "package.json", "src/compiler/corePublic.ts"]),
965+
run: () =>
966+
exec(process.execPath, [
967+
"scripts/configurePrerelease.mjs",
968+
"dev",
969+
"package.json",
970+
"src/compiler/corePublic.ts",
971+
]),
894972
});
895973

896974
export const configureInsiders = task({
897975
name: "configure-insiders",
898976
description: "Runs scripts/configurePrerelease.mjs to prepare a build for insiders publishing",
899-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "insiders", "package.json", "src/compiler/corePublic.ts"]),
977+
run: () =>
978+
exec(process.execPath, [
979+
"scripts/configurePrerelease.mjs",
980+
"insiders",
981+
"package.json",
982+
"src/compiler/corePublic.ts",
983+
]),
900984
});
901985

902986
export const configureExperimental = task({
903987
name: "configure-experimental",
904988
description: "Runs scripts/configurePrerelease.mjs to prepare a build for experimental publishing",
905-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "experimental", "package.json", "src/compiler/corePublic.ts"]),
989+
run: () =>
990+
exec(process.execPath, [
991+
"scripts/configurePrerelease.mjs",
992+
"experimental",
993+
"package.json",
994+
"src/compiler/corePublic.ts",
995+
]),
906996
});
907997

908998
export const help = task({

scripts/build/localization.mjs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
export const localizationDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"].map(f => f.toLowerCase());
1+
export const localizationDirectories = [
2+
"cs",
3+
"de",
4+
"es",
5+
"fr",
6+
"it",
7+
"ja",
8+
"ko",
9+
"pl",
10+
"pt-br",
11+
"ru",
12+
"tr",
13+
"zh-cn",
14+
"zh-tw",
15+
].map(f => f.toLowerCase());

0 commit comments

Comments
 (0)