Skip to content

Commit e3c91a4

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

File tree

437 files changed

+88178
-22970
lines changed

Some content is hidden

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

437 files changed

+88178
-22970
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: 87 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ import _glob from "glob";
77
import util from "util";
88
import chalk from "chalk";
99
import { exec, readJson, getDiffTool, getDirSize, memoize, needsUpdate } from "./scripts/build/utils.mjs";
10-
import { runConsoleTests, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline } from "./scripts/build/tests.mjs";
10+
import {
11+
runConsoleTests,
12+
refBaseline,
13+
localBaseline,
14+
refRwcBaseline,
15+
localRwcBaseline,
16+
} from "./scripts/build/tests.mjs";
1117
import { buildProject as realBuildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
1218
import { localizationDirectories } from "./scripts/build/localization.mjs";
1319
import cmdLineOptions from "./scripts/build/options.mjs";
@@ -37,7 +43,10 @@ const buildProjectWithEmit = async (...args) => {
3743

3844
if (currentlyBuilding === 0) {
3945
oldTsconfigBase = fs.readFileSync(tsconfigBasePath, "utf-8");
40-
fs.writeFileSync(tsconfigBasePath, oldTsconfigBase.replace(`"emitDeclarationOnly": true,`, `"emitDeclarationOnly": false, // DO NOT COMMIT`));
46+
fs.writeFileSync(
47+
tsconfigBasePath,
48+
oldTsconfigBase.replace(`"emitDeclarationOnly": true,`, `"emitDeclarationOnly": false, // DO NOT COMMIT`),
49+
);
4150
}
4251

4352
currentlyBuilding++;
@@ -135,7 +144,12 @@ const localize = task({
135144
dependencies: [generateDiagnostics],
136145
run: async () => {
137146
if (needsUpdate(diagnosticMessagesGeneratedJson, generatedLCGFile)) {
138-
return exec(process.execPath, ["scripts/generateLocalizedDiagnosticMessages.mjs", "src/loc/lcl", "built/local", diagnosticMessagesGeneratedJson], { ignoreExitCode: true });
147+
return exec(process.execPath, [
148+
"scripts/generateLocalizedDiagnosticMessages.mjs",
149+
"src/loc/lcl",
150+
"built/local",
151+
diagnosticMessagesGeneratedJson,
152+
], { ignoreExitCode: true });
139153
}
140154
},
141155
});
@@ -220,7 +234,9 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
220234
//
221235
// See: https://github.com/evanw/esbuild/issues/1958
222236
return {
223-
errors: [{ text: 'Attempted to bundle from node_modules; ensure "external" is set correctly.' }],
237+
errors: [{
238+
text: 'Attempted to bundle from node_modules; ensure "external" is set correctly.',
239+
}],
224240
};
225241
});
226242
},
@@ -326,13 +342,19 @@ function entrypointBuildTask(options) {
326342
const watch = task({
327343
name: `watch-${options.name}`,
328344
hiddenFromTaskList: true, // This is best effort.
329-
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(cmdLineOptions.bundle ? [] : [shim]),
345+
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(
346+
cmdLineOptions.bundle ? [] : [shim],
347+
),
330348
run: () => {
331349
// These watch functions return promises that resolve once watch mode has started,
332350
// allowing them to operate as regular tasks, while creating unresolved promises
333351
// in the background that keep the process running after all tasks have exited.
334352
if (!printedWatchWarning) {
335-
console.error(chalk.yellowBright("Warning: watch mode is incomplete and may not work as expected. Use at your own risk."));
353+
console.error(
354+
chalk.yellowBright(
355+
"Warning: watch mode is incomplete and may not work as expected. Use at your own risk.",
356+
),
357+
);
336358
printedWatchWarning = true;
337359
}
338360

@@ -376,7 +398,12 @@ export const dtsServices = task({
376398
description: "Bundles typescript.d.ts",
377399
dependencies: [buildServices],
378400
run: async () => {
379-
if (needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", ["./built/local/typescript.d.ts", "./built/local/typescript.internal.d.ts"])) {
401+
if (
402+
needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", [
403+
"./built/local/typescript.d.ts",
404+
"./built/local/typescript.internal.d.ts",
405+
])
406+
) {
380407
runDtsBundler("./built/local/typescript/typescript.d.ts", "./built/local/typescript.d.ts");
381408
}
382409
},
@@ -430,8 +457,16 @@ export const dtsLssl = task({
430457
description: "Bundles tsserverlibrary.d.ts",
431458
dependencies: [buildLssl],
432459
run: async () => {
433-
if (needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", ["./built/local/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.internal.d.ts"])) {
434-
await runDtsBundler("./built/local/tsserverlibrary/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.d.ts");
460+
if (
461+
needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", [
462+
"./built/local/tsserverlibrary.d.ts",
463+
"./built/local/tsserverlibrary.internal.d.ts",
464+
])
465+
) {
466+
await runDtsBundler(
467+
"./built/local/tsserverlibrary/tsserverlibrary.d.ts",
468+
"./built/local/tsserverlibrary.d.ts",
469+
);
435470
}
436471
},
437472
});
@@ -559,7 +594,13 @@ export const watchOtherOutputs = task({
559594
name: "watch-other-outputs",
560595
description: "Builds miscelaneous scripts and documents distributed with the LKG",
561596
hiddenFromTaskList: true,
562-
dependencies: [watchCancellationToken, watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
597+
dependencies: [
598+
watchCancellationToken,
599+
watchTypingsInstaller,
600+
watchWatchGuard,
601+
generateTypesMap,
602+
copyBuiltLocalDiagnosticMessages,
603+
],
563604
});
564605

565606
export const local = task({
@@ -683,7 +724,10 @@ export const updateSublime = task({
683724
dependencies: [tsserver],
684725
run: async () => {
685726
for (const file of ["built/local/tsserver.js", "built/local/tsserver.js.map"]) {
686-
await fs.promises.copyFile(file, path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)));
727+
await fs.promises.copyFile(
728+
file,
729+
path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)),
730+
);
687731
}
688732
},
689733
});
@@ -719,7 +763,10 @@ export const produceLKG = task({
719763
.concat(localizationTargets)
720764
.filter(f => !fs.existsSync(f));
721765
if (missingFiles.length > 0) {
722-
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"));
766+
throw new Error(
767+
"Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n"
768+
+ missingFiles.join("\n"),
769+
);
723770
}
724771
const sizeBefore = getDirSize("lib");
725772
await exec(process.execPath, ["scripts/produceLKG.mjs"]);
@@ -740,7 +787,13 @@ export const generateSpec = task({
740787
name: "generate-spec",
741788
description: "Generates a Markdown version of the Language Specification",
742789
hiddenFromTaskList: true,
743-
run: () => exec("cscript", ["//nologo", "scripts/word2md.mjs", path.resolve("doc/TypeScript Language Specification - ARCHIVED.docx"), path.resolve("doc/spec-ARCHIVED.md")]),
790+
run: () =>
791+
exec("cscript", [
792+
"//nologo",
793+
"scripts/word2md.mjs",
794+
path.resolve("doc/TypeScript Language Specification - ARCHIVED.docx"),
795+
path.resolve("doc/spec-ARCHIVED.md"),
796+
]),
744797
});
745798

746799
export const cleanBuilt = task({
@@ -758,19 +811,37 @@ export const clean = task({
758811
export const configureNightly = task({
759812
name: "configure-nightly",
760813
description: "Runs scripts/configurePrerelease.mjs to prepare a build for nightly publishing",
761-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "dev", "package.json", "src/compiler/corePublic.ts"]),
814+
run: () =>
815+
exec(process.execPath, [
816+
"scripts/configurePrerelease.mjs",
817+
"dev",
818+
"package.json",
819+
"src/compiler/corePublic.ts",
820+
]),
762821
});
763822

764823
export const configureInsiders = task({
765824
name: "configure-insiders",
766825
description: "Runs scripts/configurePrerelease.mjs to prepare a build for insiders publishing",
767-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "insiders", "package.json", "src/compiler/corePublic.ts"]),
826+
run: () =>
827+
exec(process.execPath, [
828+
"scripts/configurePrerelease.mjs",
829+
"insiders",
830+
"package.json",
831+
"src/compiler/corePublic.ts",
832+
]),
768833
});
769834

770835
export const configureExperimental = task({
771836
name: "configure-experimental",
772837
description: "Runs scripts/configurePrerelease.mjs to prepare a build for experimental publishing",
773-
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "experimental", "package.json", "src/compiler/corePublic.ts"]),
838+
run: () =>
839+
exec(process.execPath, [
840+
"scripts/configurePrerelease.mjs",
841+
"experimental",
842+
"package.json",
843+
"src/compiler/corePublic.ts",
844+
]),
774845
});
775846

776847
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: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,20 @@ 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"],
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+
],
821
string: ["browser", "tests", "break", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"],
922
alias: {
1023
/* eslint-disable quote-props */

scripts/build/projects.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ 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 });
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 });
3338

3439
const projectBuilder = new ProjectQueue(projects => execTsc(...projects));
3540

scripts/build/tests.mjs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,18 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel) {
5858
}
5959

6060
if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed || shards || shardId) {
61-
writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed, shards, shardId);
61+
writeTestConfigFile(
62+
tests,
63+
runners,
64+
light,
65+
taskConfigsFolder,
66+
workerCount,
67+
stackTraceLimit,
68+
testTimeout,
69+
keepFailed,
70+
shards,
71+
shardId,
72+
);
6273
}
6374

6475
const colors = cmdLineOptions.colors;
@@ -157,7 +168,18 @@ export async function cleanTestDirs() {
157168
* @param {number | undefined} [shards]
158169
* @param {number | undefined} [shardId]
159170
*/
160-
export function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) {
171+
export function writeTestConfigFile(
172+
tests,
173+
runners,
174+
light,
175+
taskConfigsFolder,
176+
workerCount,
177+
stackTraceLimit,
178+
timeout,
179+
keepFailed,
180+
shards,
181+
shardId,
182+
) {
161183
const testConfigContents = JSON.stringify({
162184
test: tests ? [tests] : undefined,
163185
runners: runners ? runners.split(",") : undefined,

0 commit comments

Comments
 (0)