Skip to content

Commit 120fc41

Browse files
committed
Merge branch 'main' into cacheModuleResolution
2 parents bf27ad6 + f88117d commit 120fc41

File tree

77 files changed

+3062
-1547
lines changed

Some content is hidden

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

77 files changed

+3062
-1547
lines changed

.eslintplugin.js

+12
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

+12-12
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"es6": true
1212
},
1313
"plugins": [
14-
"@typescript-eslint", "jsdoc", "no-null", "import"
14+
"@typescript-eslint", "jsdoc", "no-null", "import", "eslint-plugin-local"
1515
],
1616
"overrides": [
1717
// By default, the ESLint CLI only looks at .js files. But, it will also look at
@@ -81,20 +81,20 @@
8181
"@typescript-eslint/unified-signatures": "error",
8282

8383
// scripts/eslint/rules
84-
"object-literal-surrounding-space": "error",
85-
"no-type-assertion-whitespace": "error",
86-
"type-operator-spacing": "error",
87-
"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", {
8888
"allowNamedFunctions": true ,
8989
"allowDeclarations": true
9090
}],
91-
"no-double-space": "error",
92-
"boolean-trivia": "error",
93-
"no-in-operator": "error",
94-
"simple-indent": "error",
95-
"debug-assert": "error",
96-
"no-keywords": "error",
97-
"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",
9898

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

.github/workflows/ci.yml

+26-7
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

.npmignore

+2
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

-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +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-
},
104
// To use the last-known-good (LKG) compiler version:
115
// "typescript.tsdk": "lib"
126

Gulpfile.js

+4-8
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}`;
@@ -356,7 +356,6 @@ const eslint = (folder) => async () => {
356356
"--cache",
357357
"--cache-location", `${folder}/.eslintcache`,
358358
"--format", formatter,
359-
"--rulesdir", "scripts/eslint/built/rules",
360359
];
361360

362361
if (cmdLineOptions.fix) {
@@ -369,10 +368,7 @@ const eslint = (folder) => async () => {
369368
return exec(process.execPath, args);
370369
};
371370

372-
const lintRoot = eslint(".");
373-
lintRoot.displayName = "lint";
374-
375-
const lint = series([buildEslintRules, lintRoot]);
371+
const lint = eslint(".");
376372
lint.displayName = "lint";
377373
task("lint", lint);
378374
task("lint").description = "Runs eslint on the compiler and scripts sources.";
@@ -431,7 +427,7 @@ task("watch-local").flags = {
431427
const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
432428
preTest.displayName = "preTest";
433429

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

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

0 commit comments

Comments
 (0)