Skip to content

Commit 41719b4

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

File tree

439 files changed

+86219
-22550
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

+86219
-22550
lines changed

.eslintrc.json

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

2929
"@typescript-eslint/naming-convention": [
3030
"error",
31-
{ "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
32-
{ "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 } },
33-
{ "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 } },
34-
{ "selector": "function", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
35-
{ "selector": "parameter", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", "match": false } },
36-
{ "selector": "method", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
37-
{ "selector": "memberLike", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
38-
{ "selector": "enumMember", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
31+
{
32+
"selector": "typeLike",
33+
"format": ["PascalCase"],
34+
"filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false }
35+
},
36+
{
37+
"selector": "interface",
38+
"format": ["PascalCase"],
39+
"custom": { "regex": "^I[A-Z]", "match": false },
40+
"filter": { "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", "match": false }
41+
},
42+
{
43+
"selector": "variable",
44+
"format": ["camelCase", "PascalCase", "UPPER_CASE"],
45+
"leadingUnderscore": "allow",
46+
"filter": { "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", "match": false }
47+
},
48+
{
49+
"selector": "function",
50+
"format": ["camelCase", "PascalCase"],
51+
"leadingUnderscore": "allow",
52+
"filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false }
53+
},
54+
{
55+
"selector": "parameter",
56+
"format": ["camelCase"],
57+
"leadingUnderscore": "allow",
58+
"filter": { "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", "match": false }
59+
},
60+
{
61+
"selector": "method",
62+
"format": ["camelCase", "PascalCase"],
63+
"leadingUnderscore": "allow",
64+
"filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false }
65+
},
66+
{
67+
"selector": "memberLike",
68+
"format": ["camelCase"],
69+
"leadingUnderscore": "allow",
70+
"filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false }
71+
},
72+
{
73+
"selector": "enumMember",
74+
"format": ["camelCase", "PascalCase"],
75+
"leadingUnderscore": "allow",
76+
"filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false }
77+
},
3978
{ "selector": "property", "format": null }
4079
],
4180

@@ -93,7 +132,15 @@
93132
"no-new-func": "error",
94133
"no-new-wrappers": "error",
95134
"no-return-await": "error",
96-
"no-restricted-globals": ["error", { "name": "setTimeout" }, { "name": "clearTimeout" }, { "name": "setInterval" }, { "name": "clearInterval" }, { "name": "setImmediate" }, { "name": "clearImmediate" }],
135+
"no-restricted-globals": [
136+
"error",
137+
{ "name": "setTimeout" },
138+
{ "name": "clearTimeout" },
139+
{ "name": "setInterval" },
140+
{ "name": "clearInterval" },
141+
{ "name": "setImmediate" },
142+
{ "name": "clearImmediate" }
143+
],
97144
"no-sparse-arrays": "error",
98145
"no-template-curly-in-string": "error",
99146
"no-throw-literal": "error",
@@ -127,7 +174,14 @@
127174
"files": ["*.mjs", "*.mts"],
128175
"rules": {
129176
// These globals don't exist outside of CJS files.
130-
"no-restricted-globals": ["error", { "name": "__filename" }, { "name": "__dirname" }, { "name": "require" }, { "name": "module" }, { "name": "exports" }]
177+
"no-restricted-globals": [
178+
"error",
179+
{ "name": "__filename" },
180+
{ "name": "__dirname" },
181+
{ "name": "require" },
182+
{ "name": "module" },
183+
{ "name": "exports" }
184+
]
131185
}
132186
}
133187
]

.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: 108 additions & 20 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 { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
10-
import { cleanTestDirs, localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
9+
import {
10+
Debouncer,
11+
Deferred,
12+
exec,
13+
getDiffTool,
14+
getDirSize,
15+
memoize,
16+
needsUpdate,
17+
readJson,
18+
} from "./scripts/build/utils.mjs";
19+
import {
20+
cleanTestDirs,
21+
localBaseline,
22+
localRwcBaseline,
23+
refBaseline,
24+
refRwcBaseline,
25+
runConsoleTests,
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

@@ -341,13 +371,19 @@ function entrypointBuildTask(options) {
341371
const watch = task({
342372
name: `watch-${options.name}`,
343373
hiddenFromTaskList: true, // This is best effort.
344-
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(cmdLineOptions.bundle ? [] : [shim]),
374+
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(
375+
cmdLineOptions.bundle ? [] : [shim],
376+
),
345377
run: () => {
346378
// These watch functions return promises that resolve once watch mode has started,
347379
// allowing them to operate as regular tasks, while creating unresolved promises
348380
// in the background that keep the process running after all tasks have exited.
349381
if (!printedWatchWarning) {
350-
console.error(chalk.yellowBright("Warning: watch mode is incomplete and may not work as expected. Use at your own risk."));
382+
console.error(
383+
chalk.yellowBright(
384+
"Warning: watch mode is incomplete and may not work as expected. Use at your own risk.",
385+
),
386+
);
351387
printedWatchWarning = true;
352388
}
353389

@@ -391,7 +427,12 @@ export const dtsServices = task({
391427
description: "Bundles typescript.d.ts",
392428
dependencies: [buildServices],
393429
run: async () => {
394-
if (needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", ["./built/local/typescript.d.ts", "./built/local/typescript.internal.d.ts"])) {
430+
if (
431+
needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", [
432+
"./built/local/typescript.d.ts",
433+
"./built/local/typescript.internal.d.ts",
434+
])
435+
) {
395436
await runDtsBundler("./built/local/typescript/typescript.d.ts", "./built/local/typescript.d.ts");
396437
}
397438
},
@@ -445,8 +486,16 @@ export const dtsLssl = task({
445486
description: "Bundles tsserverlibrary.d.ts",
446487
dependencies: [buildLssl],
447488
run: async () => {
448-
if (needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", ["./built/local/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.internal.d.ts"])) {
449-
await runDtsBundler("./built/local/tsserverlibrary/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.d.ts");
489+
if (
490+
needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", [
491+
"./built/local/tsserverlibrary.d.ts",
492+
"./built/local/tsserverlibrary.internal.d.ts",
493+
])
494+
) {
495+
await runDtsBundler(
496+
"./built/local/tsserverlibrary/tsserverlibrary.d.ts",
497+
"./built/local/tsserverlibrary.d.ts",
498+
);
450499
}
451500
},
452501
});
@@ -579,7 +628,13 @@ export const watchOtherOutputs = task({
579628
name: "watch-other-outputs",
580629
description: "Builds miscelaneous scripts and documents distributed with the LKG",
581630
hiddenFromTaskList: true,
582-
dependencies: [watchCancellationToken, watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
631+
dependencies: [
632+
watchCancellationToken,
633+
watchTypingsInstaller,
634+
watchWatchGuard,
635+
generateTypesMap,
636+
copyBuiltLocalDiagnosticMessages,
637+
],
583638
});
584639

585640
export const local = task({
@@ -657,7 +712,10 @@ export const runTestsAndWatch = task({
657712
if (!token.signaled) {
658713
running = true;
659714
try {
660-
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, { token, watching: true });
715+
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, {
716+
token,
717+
watching: true,
718+
});
661719
}
662720
catch {
663721
// ignore
@@ -816,7 +874,10 @@ export const updateSublime = task({
816874
dependencies: [tsserver],
817875
run: async () => {
818876
for (const file of ["built/local/tsserver.js", "built/local/tsserver.js.map"]) {
819-
await fs.promises.copyFile(file, path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)));
877+
await fs.promises.copyFile(
878+
file,
879+
path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)),
880+
);
820881
}
821882
},
822883
});
@@ -852,7 +913,10 @@ export const produceLKG = task({
852913
.concat(localizationTargets)
853914
.filter(f => !fs.existsSync(f));
854915
if (missingFiles.length > 0) {
855-
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"));
916+
throw new Error(
917+
"Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n"
918+
+ missingFiles.join("\n"),
919+
);
856920
}
857921
const sizeBefore = getDirSize("lib");
858922
await exec(process.execPath, ["scripts/produceLKG.mjs"]);
@@ -873,7 +937,13 @@ export const generateSpec = task({
873937
name: "generate-spec",
874938
description: "Generates a Markdown version of the Language Specification",
875939
hiddenFromTaskList: true,
876-
run: () => exec("cscript", ["//nologo", "scripts/word2md.mjs", path.resolve("doc/TypeScript Language Specification - ARCHIVED.docx"), path.resolve("doc/spec-ARCHIVED.md")]),
940+
run: () =>
941+
exec("cscript", [
942+
"//nologo",
943+
"scripts/word2md.mjs",
944+
path.resolve("doc/TypeScript Language Specification - ARCHIVED.docx"),
945+
path.resolve("doc/spec-ARCHIVED.md"),
946+
]),
877947
});
878948

879949
export const cleanBuilt = task({
@@ -891,19 +961,37 @@ export const clean = task({
891961
export const configureNightly = task({
892962
name: "configure-nightly",
893963
description: "Runs scripts/configurePrerelease.mjs to prepare a build for nightly publishing",
894-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "dev", "package.json", "src/compiler/corePublic.ts"]),
964+
run: () =>
965+
exec(process.execPath, [
966+
"scripts/configurePrerelease.mjs",
967+
"dev",
968+
"package.json",
969+
"src/compiler/corePublic.ts",
970+
]),
895971
});
896972

897973
export const configureInsiders = task({
898974
name: "configure-insiders",
899975
description: "Runs scripts/configurePrerelease.mjs to prepare a build for insiders publishing",
900-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "insiders", "package.json", "src/compiler/corePublic.ts"]),
976+
run: () =>
977+
exec(process.execPath, [
978+
"scripts/configurePrerelease.mjs",
979+
"insiders",
980+
"package.json",
981+
"src/compiler/corePublic.ts",
982+
]),
901983
});
902984

903985
export const configureExperimental = task({
904986
name: "configure-experimental",
905987
description: "Runs scripts/configurePrerelease.mjs to prepare a build for experimental publishing",
906-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "experimental", "package.json", "src/compiler/corePublic.ts"]),
988+
run: () =>
989+
exec(process.execPath, [
990+
"scripts/configurePrerelease.mjs",
991+
"experimental",
992+
"package.json",
993+
"src/compiler/corePublic.ts",
994+
]),
907995
});
908996

909997
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());

scripts/build/options.mjs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@ import os from "os";
44
const ci = ["1", "true"].includes(process.env.CI ?? "");
55

66
const parsed = minimist(process.argv.slice(2), {
7-
boolean: ["dirty", "light", "colors", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci", "bundle", "typecheck"],
7+
boolean: [
8+
"dirty",
9+
"light",
10+
"colors",
11+
"lkg",
12+
"soft",
13+
"fix",
14+
"failed",
15+
"keepFailed",
16+
"force",
17+
"built",
18+
"ci",
19+
"bundle",
20+
"typecheck",
21+
],
822
string: ["browser", "tests", "break", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"],
923
alias: {
1024
/* eslint-disable quote-props */

0 commit comments

Comments
 (0)