Skip to content

Commit 670a8de

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

File tree

424 files changed

+84105
-21911
lines changed

Some content is hidden

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

424 files changed

+84105
-21911
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: 91 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,23 @@ import _glob from "glob";
77
import util from "util";
88
import chalk from "chalk";
99
import fsExtra from "fs-extra";
10-
import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
11-
import { localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
10+
import {
11+
Debouncer,
12+
Deferred,
13+
exec,
14+
getDiffTool,
15+
getDirSize,
16+
memoize,
17+
needsUpdate,
18+
readJson,
19+
} from "./scripts/build/utils.mjs";
20+
import {
21+
localBaseline,
22+
localRwcBaseline,
23+
refBaseline,
24+
refRwcBaseline,
25+
runConsoleTests,
26+
} from "./scripts/build/tests.mjs";
1227
import { buildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
1328
import { localizationDirectories } from "./scripts/build/localization.mjs";
1429
import cmdLineOptions from "./scripts/build/options.mjs";
@@ -110,7 +125,12 @@ const localize = task({
110125
dependencies: [generateDiagnostics],
111126
run: async () => {
112127
if (needsUpdate(diagnosticMessagesGeneratedJson, generatedLCGFile)) {
113-
await exec(process.execPath, ["scripts/generateLocalizedDiagnosticMessages.mjs", "src/loc/lcl", "built/local", diagnosticMessagesGeneratedJson], { ignoreExitCode: true });
128+
await exec(process.execPath, [
129+
"scripts/generateLocalizedDiagnosticMessages.mjs",
130+
"src/loc/lcl",
131+
"built/local",
132+
diagnosticMessagesGeneratedJson,
133+
], { ignoreExitCode: true });
114134
}
115135
},
116136
});
@@ -289,7 +309,10 @@ function entrypointBuildTask(options) {
289309
const outDir = path.dirname(options.output);
290310
await fs.promises.mkdir(outDir, { recursive: true });
291311
const moduleSpecifier = path.relative(outDir, options.builtEntrypoint);
292-
await fs.promises.writeFile(options.output, `module.exports = require("./${moduleSpecifier.replace(/[\\/]/g, "/")}")`);
312+
await fs.promises.writeFile(
313+
options.output,
314+
`module.exports = require("./${moduleSpecifier.replace(/[\\/]/g, "/")}")`,
315+
);
293316
},
294317
});
295318

@@ -313,13 +336,19 @@ function entrypointBuildTask(options) {
313336
const watch = task({
314337
name: `watch-${options.name}`,
315338
hiddenFromTaskList: true, // This is best effort.
316-
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(cmdLineOptions.bundle ? [] : [shim]),
339+
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(
340+
cmdLineOptions.bundle ? [] : [shim],
341+
),
317342
run: () => {
318343
// These watch functions return promises that resolve once watch mode has started,
319344
// allowing them to operate as regular tasks, while creating unresolved promises
320345
// in the background that keep the process running after all tasks have exited.
321346
if (!printedWatchWarning) {
322-
console.error(chalk.yellowBright("Warning: watch mode is incomplete and may not work as expected. Use at your own risk."));
347+
console.error(
348+
chalk.yellowBright(
349+
"Warning: watch mode is incomplete and may not work as expected. Use at your own risk.",
350+
),
351+
);
323352
printedWatchWarning = true;
324353
}
325354

@@ -363,7 +392,12 @@ export const dtsServices = task({
363392
description: "Bundles typescript.d.ts",
364393
dependencies: [buildServices],
365394
run: async () => {
366-
if (needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", ["./built/local/typescript.d.ts", "./built/local/typescript.internal.d.ts"])) {
395+
if (
396+
needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", [
397+
"./built/local/typescript.d.ts",
398+
"./built/local/typescript.internal.d.ts",
399+
])
400+
) {
367401
await runDtsBundler("./built/local/typescript/typescript.d.ts", "./built/local/typescript.d.ts");
368402
}
369403
},
@@ -412,8 +446,16 @@ export const dtsLssl = task({
412446
description: "Bundles tsserverlibrary.d.ts",
413447
dependencies: [buildLssl],
414448
run: async () => {
415-
if (needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", ["./built/local/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.internal.d.ts"])) {
416-
await runDtsBundler("./built/local/tsserverlibrary/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.d.ts");
449+
if (
450+
needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", [
451+
"./built/local/tsserverlibrary.d.ts",
452+
"./built/local/tsserverlibrary.internal.d.ts",
453+
])
454+
) {
455+
await runDtsBundler(
456+
"./built/local/tsserverlibrary/tsserverlibrary.d.ts",
457+
"./built/local/tsserverlibrary.d.ts",
458+
);
417459
}
418460
},
419461
});
@@ -536,7 +578,13 @@ export const watchOtherOutputs = task({
536578
name: "watch-other-outputs",
537579
description: "Builds miscelaneous scripts and documents distributed with the LKG",
538580
hiddenFromTaskList: true,
539-
dependencies: [watchCancellationToken, watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
581+
dependencies: [
582+
watchCancellationToken,
583+
watchTypingsInstaller,
584+
watchWatchGuard,
585+
generateTypesMap,
586+
copyBuiltLocalDiagnosticMessages,
587+
],
540588
});
541589

542590
export const local = task({
@@ -614,7 +662,10 @@ export const runTestsAndWatch = task({
614662
if (!token.signaled) {
615663
running = true;
616664
try {
617-
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, { token, watching: true });
665+
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, {
666+
token,
667+
watching: true,
668+
});
618669
}
619670
catch {
620671
// ignore
@@ -773,7 +824,10 @@ export const updateSublime = task({
773824
dependencies: [tsserver],
774825
run: async () => {
775826
for (const file of ["built/local/tsserver.js", "built/local/tsserver.js.map"]) {
776-
await fs.promises.copyFile(file, path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)));
827+
await fs.promises.copyFile(
828+
file,
829+
path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)),
830+
);
777831
}
778832
},
779833
});
@@ -809,7 +863,10 @@ export const produceLKG = task({
809863
.concat(localizationTargets)
810864
.filter(f => !fs.existsSync(f));
811865
if (missingFiles.length > 0) {
812-
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"));
866+
throw new Error(
867+
"Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n"
868+
+ missingFiles.join("\n"),
869+
);
813870
}
814871
const sizeBefore = getDirSize("lib");
815872
await exec(process.execPath, ["scripts/produceLKG.mjs"]);
@@ -841,19 +898,37 @@ export const clean = task({
841898
export const configureNightly = task({
842899
name: "configure-nightly",
843900
description: "Runs scripts/configurePrerelease.mjs to prepare a build for nightly publishing",
844-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "dev", "package.json", "src/compiler/corePublic.ts"]),
901+
run: () =>
902+
exec(process.execPath, [
903+
"scripts/configurePrerelease.mjs",
904+
"dev",
905+
"package.json",
906+
"src/compiler/corePublic.ts",
907+
]),
845908
});
846909

847910
export const configureInsiders = task({
848911
name: "configure-insiders",
849912
description: "Runs scripts/configurePrerelease.mjs to prepare a build for insiders publishing",
850-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "insiders", "package.json", "src/compiler/corePublic.ts"]),
913+
run: () =>
914+
exec(process.execPath, [
915+
"scripts/configurePrerelease.mjs",
916+
"insiders",
917+
"package.json",
918+
"src/compiler/corePublic.ts",
919+
]),
851920
});
852921

853922
export const configureExperimental = task({
854923
name: "configure-experimental",
855924
description: "Runs scripts/configurePrerelease.mjs to prepare a build for experimental publishing",
856-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "experimental", "package.json", "src/compiler/corePublic.ts"]),
925+
run: () =>
926+
exec(process.execPath, [
927+
"scripts/configurePrerelease.mjs",
928+
"experimental",
929+
"package.json",
930+
"src/compiler/corePublic.ts",
931+
]),
857932
});
858933

859934
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)