Skip to content

Commit 3113f62

Browse files
committed
Merge branch 'main' into buildInfoSize
2 parents 7640bc2 + f88117d commit 3113f62

File tree

226 files changed

+6405
-2971
lines changed

Some content is hidden

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

226 files changed

+6405
-2971
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
**/node_modules/**
12
/built/local/**
23
/tests/**
34
/lib/**
45
/src/lib/*.generated.d.ts
6+
/scripts/*.js
7+
/scripts/eslint/built/**
8+
/internal/**
9+
/coverage/**

.eslintplugin.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const fs = require("fs");
2+
const path = require("path");
3+
4+
const rulesDir = path.join(__dirname, "scripts", "eslint", "rules");
5+
const ext = ".js";
6+
const ruleFiles = fs.readdirSync(rulesDir).filter((p) => p.endsWith(ext));
7+
8+
module.exports = {
9+
rules: Object.fromEntries(ruleFiles.map((p) => {
10+
return [p.slice(0, -ext.length), require(path.join(rulesDir, p))];
11+
})),
12+
}

.eslintrc.json

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@
1111
"es6": true
1212
},
1313
"plugins": [
14-
"@typescript-eslint", "jsdoc", "no-null", "import"
14+
"@typescript-eslint", "jsdoc", "no-null", "import", "eslint-plugin-local"
15+
],
16+
"overrides": [
17+
// By default, the ESLint CLI only looks at .js files. But, it will also look at
18+
// any files which are referenced in an override config. Most users of typescript-eslint
19+
// get this behavior by default by extending a recommended typescript-eslint config, which
20+
// just so happens to override some core ESLint rules. We don't extend from any config, so
21+
// explicitly reference TS files here so the CLI picks them up.
22+
//
23+
// ESLint in VS Code will lint any opened file (so long as it's not eslintignore'd), so
24+
// that will work regardless of the below.
25+
{ "files": ["*.ts"] }
1526
],
1627
"rules": {
1728
"@typescript-eslint/adjacent-overload-signatures": "error",
@@ -70,20 +81,20 @@
7081
"@typescript-eslint/unified-signatures": "error",
7182

7283
// scripts/eslint/rules
73-
"object-literal-surrounding-space": "error",
74-
"no-type-assertion-whitespace": "error",
75-
"type-operator-spacing": "error",
76-
"only-arrow-functions": ["error", {
84+
"local/object-literal-surrounding-space": "error",
85+
"local/no-type-assertion-whitespace": "error",
86+
"local/type-operator-spacing": "error",
87+
"local/only-arrow-functions": ["error", {
7788
"allowNamedFunctions": true ,
7889
"allowDeclarations": true
7990
}],
80-
"no-double-space": "error",
81-
"boolean-trivia": "error",
82-
"no-in-operator": "error",
83-
"simple-indent": "error",
84-
"debug-assert": "error",
85-
"no-keywords": "error",
86-
"one-namespace-per-file": "error",
91+
"local/no-double-space": "error",
92+
"local/boolean-trivia": "error",
93+
"local/no-in-operator": "error",
94+
"local/simple-indent": "error",
95+
"local/debug-assert": "error",
96+
"local/no-keywords": "error",
97+
"local/one-namespace-per-file": "error",
8798

8899
// eslint-plugin-import
89100
"import/no-extraneous-dependencies": ["error", { "optionalDependencies": false }],

.github/workflows/ci.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- release-*
1212

1313
jobs:
14-
build:
14+
test:
1515
runs-on: ubuntu-latest
1616

1717
strategy:
@@ -24,27 +24,46 @@ jobs:
2424

2525
steps:
2626
- uses: actions/checkout@v3
27-
with:
28-
fetch-depth: 5
2927
- name: Use node version ${{ matrix.node-version }}
3028
uses: actions/setup-node@v3
3129
with:
3230
node-version: ${{ matrix.node-version }}
3331
check-latest: true
3432
- run: npm ci
3533

36-
# Re: https://github.com/actions/setup-node/pull/125
37-
- name: Register Problem Matcher for TSC
38-
run: echo "##[add-matcher].github/tsc.json"
39-
4034
- name: Tests
4135
run: npm test -- --no-lint
4236

37+
lint:
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- uses: actions/checkout@v3
42+
- uses: actions/setup-node@v3
43+
with:
44+
node-version: "*"
45+
check-latest: true
46+
- run: npm ci
47+
4348
- name: Linter
4449
run: npm run lint:ci
4550

51+
browser-integration:
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- uses: actions/checkout@v3
56+
- uses: actions/setup-node@v3
57+
with:
58+
node-version: "*"
59+
check-latest: true
60+
- run: npm ci
61+
4662
- name: Adding playwright
4763
run: npm install --no-save --no-package-lock playwright
4864

65+
- name: Build local
66+
run: gulp local
67+
4968
- name: Validate the browser can import TypeScript
5069
run: gulp test-browser-integration

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ scripts/produceLKG.js
5454
scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.js
5555
scripts/generateLocalizedDiagnosticMessages.js
5656
scripts/request-pr-review.js
57+
scripts/errorCheck.js
5758
scripts/*.js.map
5859
scripts/typings/
5960
coverage/

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ Dockerfile
3737
.eslintrc.json
3838
.yarnrc
3939
tmp
40+
.eslintplugin.js
41+
.eslintcache

.vscode/settings.template.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
// Rename this file 'settings.json' or merge its
22
// contents into your existing settings.
33
{
4-
"eslint.validate": [
5-
"typescript"
6-
],
7-
"eslint.options": {
8-
"rulePaths": ["./scripts/eslint/built/rules/"],
9-
"extensions": [".ts"]
10-
},
114
// To use the last-known-good (LKG) compiler version:
125
// "typescript.tsdk": "lib"
136

Gulpfile.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const del = require("del");
88
const rename = require("gulp-rename");
99
const concat = require("gulp-concat");
1010
const merge2 = require("merge2");
11-
const mkdirp = require("mkdirp");
1211
const { src, dest, task, parallel, series, watch } = require("gulp");
1312
const { append, transform } = require("gulp-insert");
1413
const { prependFile } = require("./scripts/build/prepend");
@@ -27,9 +26,10 @@ task("scripts").description = "Builds files in the 'scripts' folder.";
2726
const cleanScripts = () => cleanProject("scripts");
2827
cleanTasks.push(cleanScripts);
2928

29+
/** @type {{ libs: string[]; paths: Record<string, string | undefined>; }} */
3030
const libraries = readJson("./src/lib/libs.json");
3131
const libs = libraries.libs.map(lib => {
32-
const relativeSources = ["header.d.ts"].concat(libraries.sources && libraries.sources[lib] || [lib + ".d.ts"]);
32+
const relativeSources = ["header.d.ts", lib + ".d.ts"];
3333
const relativeTarget = libraries.paths && libraries.paths[lib] || ("lib." + lib + ".d.ts");
3434
const sources = relativeSources.map(s => path.posix.join("src/lib", s));
3535
const target = `built/local/${relativeTarget}`;
@@ -350,15 +350,12 @@ task("run-eslint-rules-tests").description = "Runs the eslint rule tests";
350350

351351
/** @type { (folder: string) => { (): Promise<any>; displayName?: string } } */
352352
const eslint = (folder) => async () => {
353-
354353
const formatter = cmdLineOptions.ci ? "stylish" : "autolinkable-stylish";
355354
const args = [
356355
"node_modules/eslint/bin/eslint",
357356
"--cache",
358357
"--cache-location", `${folder}/.eslintcache`,
359358
"--format", formatter,
360-
"--rulesdir", "scripts/eslint/built/rules",
361-
"--ext", ".ts",
362359
];
363360

364361
if (cmdLineOptions.fix) {
@@ -371,22 +368,9 @@ const eslint = (folder) => async () => {
371368
return exec(process.execPath, args);
372369
};
373370

374-
const lintScripts = eslint("scripts");
375-
lintScripts.displayName = "lint-scripts";
376-
task("lint-scripts", series([buildEslintRules, lintScripts]));
377-
task("lint-scripts").description = "Runs eslint on the scripts sources.";
378-
379-
const lintCompiler = eslint("src");
380-
lintCompiler.displayName = "lint-compiler";
381-
task("lint-compiler", series([buildEslintRules, lintCompiler]));
382-
task("lint-compiler").description = "Runs eslint on the compiler sources.";
383-
task("lint-compiler").flags = {
384-
" --ci": "Runs eslint additional rules",
385-
};
386-
387-
const lint = series([buildEslintRules, lintScripts, lintCompiler]);
371+
const lint = eslint(".");
388372
lint.displayName = "lint";
389-
task("lint", series([buildEslintRules, lint]));
373+
task("lint", lint);
390374
task("lint").description = "Runs eslint on the compiler and scripts sources.";
391375
task("lint").flags = {
392376
" --ci": "Runs eslint additional rules",
@@ -443,7 +427,7 @@ task("watch-local").flags = {
443427
const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
444428
preTest.displayName = "preTest";
445429

446-
const postTest = (done) => cmdLineOptions.lint ? lint(done) : done();
430+
const postTest = (done) => cmdLineOptions.lint ? lint() : done();
447431

448432
const runTests = () => runConsoleTests("built/local/run.js", "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ false);
449433
task("runtests", series(preBuild, preTest, runTests, postTest));

0 commit comments

Comments
 (0)