Skip to content

Commit 7f8032e

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

File tree

427 files changed

+84919
-22194
lines changed

Some content is hidden

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

427 files changed

+84919
-22194
lines changed

.eslintrc.json

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

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

@@ -99,7 +138,15 @@
99138
"no-new-func": "error",
100139
"no-new-wrappers": "error",
101140
"no-return-await": "error",
102-
"no-restricted-globals": ["error", { "name": "setTimeout" }, { "name": "clearTimeout" }, { "name": "setInterval" }, { "name": "clearInterval" }, { "name": "setImmediate" }, { "name": "clearImmediate" }],
141+
"no-restricted-globals": [
142+
"error",
143+
{ "name": "setTimeout" },
144+
{ "name": "clearTimeout" },
145+
{ "name": "setInterval" },
146+
{ "name": "clearInterval" },
147+
{ "name": "setImmediate" },
148+
{ "name": "clearImmediate" }
149+
],
103150
"no-sparse-arrays": "error",
104151
"no-template-curly-in-string": "error",
105152
"no-throw-literal": "error",
@@ -133,7 +180,14 @@
133180
"files": ["*.mjs", "*.mts"],
134181
"rules": {
135182
// These globals don't exist outside of CJS files.
136-
"no-restricted-globals": ["error", { "name": "__filename" }, { "name": "__dirname" }, { "name": "require" }, { "name": "module" }, { "name": "exports" }]
183+
"no-restricted-globals": [
184+
"error",
185+
{ "name": "__filename" },
186+
{ "name": "__dirname" },
187+
{ "name": "require" },
188+
{ "name": "module" },
189+
{ "name": "exports" }
190+
]
137191
}
138192
}
139193
]

.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: 103 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,23 @@ 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 { 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+
localBaseline,
21+
localRwcBaseline,
22+
refBaseline,
23+
refRwcBaseline,
24+
runConsoleTests,
25+
} from "./scripts/build/tests.mjs";
1126
import { buildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
1227
import { localizationDirectories } from "./scripts/build/localization.mjs";
1328
import cmdLineOptions from "./scripts/build/options.mjs";
@@ -109,7 +124,12 @@ const localize = task({
109124
dependencies: [generateDiagnostics],
110125
run: async () => {
111126
if (needsUpdate(diagnosticMessagesGeneratedJson, generatedLCGFile)) {
112-
await exec(process.execPath, ["scripts/generateLocalizedDiagnosticMessages.mjs", "src/loc/lcl", "built/local", diagnosticMessagesGeneratedJson], { ignoreExitCode: true });
127+
await exec(process.execPath, [
128+
"scripts/generateLocalizedDiagnosticMessages.mjs",
129+
"src/loc/lcl",
130+
"built/local",
131+
diagnosticMessagesGeneratedJson,
132+
], { ignoreExitCode: true });
113133
}
114134
},
115135
});
@@ -195,7 +215,9 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
195215
//
196216
// See: https://github.com/evanw/esbuild/issues/1958
197217
return {
198-
errors: [{ text: 'Attempted to bundle from node_modules; ensure "external" is set correctly.' }],
218+
errors: [{
219+
text: 'Attempted to bundle from node_modules; ensure "external" is set correctly.',
220+
}],
199221
};
200222
});
201223
},
@@ -237,7 +259,8 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
237259

238260
return {
239261
build: async () => esbuild.build(await getOptions()),
240-
watch: async () => esbuild.build({ ...await getOptions(), watch: taskOptions.watchMode ?? true, logLevel: "info" }),
262+
watch: async () =>
263+
esbuild.build({ ...await getOptions(), watch: taskOptions.watchMode ?? true, logLevel: "info" }),
241264
};
242265
}
243266

@@ -288,7 +311,10 @@ function entrypointBuildTask(options) {
288311
const outDir = path.dirname(options.output);
289312
await fs.promises.mkdir(outDir, { recursive: true });
290313
const moduleSpecifier = path.relative(outDir, options.builtEntrypoint);
291-
await fs.promises.writeFile(options.output, `module.exports = require("./${moduleSpecifier.replace(/[\\/]/g, "/")}")`);
314+
await fs.promises.writeFile(
315+
options.output,
316+
`module.exports = require("./${moduleSpecifier.replace(/[\\/]/g, "/")}")`,
317+
);
292318
},
293319
});
294320

@@ -312,13 +338,19 @@ function entrypointBuildTask(options) {
312338
const watch = task({
313339
name: `watch-${options.name}`,
314340
hiddenFromTaskList: true, // This is best effort.
315-
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(cmdLineOptions.bundle ? [] : [shim]),
341+
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(
342+
cmdLineOptions.bundle ? [] : [shim],
343+
),
316344
run: () => {
317345
// These watch functions return promises that resolve once watch mode has started,
318346
// allowing them to operate as regular tasks, while creating unresolved promises
319347
// in the background that keep the process running after all tasks have exited.
320348
if (!printedWatchWarning) {
321-
console.error(chalk.yellowBright("Warning: watch mode is incomplete and may not work as expected. Use at your own risk."));
349+
console.error(
350+
chalk.yellowBright(
351+
"Warning: watch mode is incomplete and may not work as expected. Use at your own risk.",
352+
),
353+
);
322354
printedWatchWarning = true;
323355
}
324356

@@ -362,7 +394,12 @@ export const dtsServices = task({
362394
description: "Bundles typescript.d.ts",
363395
dependencies: [buildServices],
364396
run: async () => {
365-
if (needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", ["./built/local/typescript.d.ts", "./built/local/typescript.internal.d.ts"])) {
397+
if (
398+
needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", [
399+
"./built/local/typescript.d.ts",
400+
"./built/local/typescript.internal.d.ts",
401+
])
402+
) {
366403
await runDtsBundler("./built/local/typescript/typescript.d.ts", "./built/local/typescript.d.ts");
367404
}
368405
},
@@ -411,8 +448,16 @@ export const dtsLssl = task({
411448
description: "Bundles tsserverlibrary.d.ts",
412449
dependencies: [buildLssl],
413450
run: async () => {
414-
if (needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", ["./built/local/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.internal.d.ts"])) {
415-
await runDtsBundler("./built/local/tsserverlibrary/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.d.ts");
451+
if (
452+
needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", [
453+
"./built/local/tsserverlibrary.d.ts",
454+
"./built/local/tsserverlibrary.internal.d.ts",
455+
])
456+
) {
457+
await runDtsBundler(
458+
"./built/local/tsserverlibrary/tsserverlibrary.d.ts",
459+
"./built/local/tsserverlibrary.d.ts",
460+
);
416461
}
417462
},
418463
});
@@ -545,7 +590,13 @@ export const watchOtherOutputs = task({
545590
name: "watch-other-outputs",
546591
description: "Builds miscelaneous scripts and documents distributed with the LKG",
547592
hiddenFromTaskList: true,
548-
dependencies: [watchCancellationToken, watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
593+
dependencies: [
594+
watchCancellationToken,
595+
watchTypingsInstaller,
596+
watchWatchGuard,
597+
generateTypesMap,
598+
copyBuiltLocalDiagnosticMessages,
599+
],
549600
});
550601

551602
export const local = task({
@@ -623,7 +674,10 @@ export const runTestsAndWatch = task({
623674
if (!token.signaled) {
624675
running = true;
625676
try {
626-
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, { token, watching: true });
677+
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, {
678+
token,
679+
watching: true,
680+
});
627681
}
628682
catch {
629683
// ignore
@@ -782,7 +836,10 @@ export const updateSublime = task({
782836
dependencies: [tsserver],
783837
run: async () => {
784838
for (const file of ["built/local/tsserver.js", "built/local/tsserver.js.map"]) {
785-
await fs.promises.copyFile(file, path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)));
839+
await fs.promises.copyFile(
840+
file,
841+
path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)),
842+
);
786843
}
787844
},
788845
});
@@ -818,7 +875,10 @@ export const produceLKG = task({
818875
.concat(localizationTargets)
819876
.filter(f => !fs.existsSync(f));
820877
if (missingFiles.length > 0) {
821-
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"));
878+
throw new Error(
879+
"Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n"
880+
+ missingFiles.join("\n"),
881+
);
822882
}
823883
const sizeBefore = getDirSize("lib");
824884
await exec(process.execPath, ["scripts/produceLKG.mjs"]);
@@ -839,7 +899,13 @@ export const generateSpec = task({
839899
name: "generate-spec",
840900
description: "Generates a Markdown version of the Language Specification",
841901
hiddenFromTaskList: true,
842-
run: () => exec("cscript", ["//nologo", "scripts/word2md.mjs", path.resolve("doc/TypeScript Language Specification - ARCHIVED.docx"), path.resolve("doc/spec-ARCHIVED.md")]),
902+
run: () =>
903+
exec("cscript", [
904+
"//nologo",
905+
"scripts/word2md.mjs",
906+
path.resolve("doc/TypeScript Language Specification - ARCHIVED.docx"),
907+
path.resolve("doc/spec-ARCHIVED.md"),
908+
]),
843909
});
844910

845911
export const cleanBuilt = task({
@@ -857,19 +923,37 @@ export const clean = task({
857923
export const configureNightly = task({
858924
name: "configure-nightly",
859925
description: "Runs scripts/configurePrerelease.mjs to prepare a build for nightly publishing",
860-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "dev", "package.json", "src/compiler/corePublic.ts"]),
926+
run: () =>
927+
exec(process.execPath, [
928+
"scripts/configurePrerelease.mjs",
929+
"dev",
930+
"package.json",
931+
"src/compiler/corePublic.ts",
932+
]),
861933
});
862934

863935
export const configureInsiders = task({
864936
name: "configure-insiders",
865937
description: "Runs scripts/configurePrerelease.mjs to prepare a build for insiders publishing",
866-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "insiders", "package.json", "src/compiler/corePublic.ts"]),
938+
run: () =>
939+
exec(process.execPath, [
940+
"scripts/configurePrerelease.mjs",
941+
"insiders",
942+
"package.json",
943+
"src/compiler/corePublic.ts",
944+
]),
867945
});
868946

869947
export const configureExperimental = task({
870948
name: "configure-experimental",
871949
description: "Runs scripts/configurePrerelease.mjs to prepare a build for experimental publishing",
872-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "experimental", "package.json", "src/compiler/corePublic.ts"]),
950+
run: () =>
951+
exec(process.execPath, [
952+
"scripts/configurePrerelease.mjs",
953+
"experimental",
954+
"package.json",
955+
"src/compiler/corePublic.ts",
956+
]),
873957
});
874958

875959
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 */

scripts/build/projects.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,16 @@ class ProjectQueue {
2929
}
3030
}
3131

32-
const execTsc = (/** @type {string[]} */ ...args) => exec(process.execPath, [resolve(findUpRoot(), cmdLineOptions.lkg ? "./lib/tsc.js" : "./built/local/tsc.js"), "-b", ...args], { hidePrompt: true });
33-
34-
const projectBuilder = new ProjectQueue(projects => execTsc(...(cmdLineOptions.bundle ? [] : ["--emitDeclarationOnly", "false"]), ...projects));
32+
const execTsc = (/** @type {string[]} */ ...args) =>
33+
exec(process.execPath, [
34+
resolve(findUpRoot(), cmdLineOptions.lkg ? "./lib/tsc.js" : "./built/local/tsc.js"),
35+
"-b",
36+
...args,
37+
], { hidePrompt: true });
38+
39+
const projectBuilder = new ProjectQueue(projects =>
40+
execTsc(...(cmdLineOptions.bundle ? [] : ["--emitDeclarationOnly", "false"]), ...projects)
41+
);
3542

3643
/**
3744
* @param {string} project

0 commit comments

Comments
 (0)