Skip to content

Commit 4c9986f

Browse files
committed
Merge master
2 parents e6b45ad + 9faca24 commit 4c9986f

File tree

800 files changed

+56213
-29188
lines changed

Some content is hidden

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

800 files changed

+56213
-29188
lines changed

Diff for: .eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/built/local/**
2+
/tests/**
3+
/lib/**
4+
/src/lib/*.generated.d.ts

Diff for: .eslintrc.json

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"warnOnUnsupportedTypeScriptVersion": false,
5+
"ecmaVersion": 6,
6+
"sourceType": "module"
7+
},
8+
"env": {
9+
"browser": false,
10+
"node": true,
11+
"es6": true
12+
},
13+
"plugins": [
14+
"@typescript-eslint", "jsdoc", "no-null", "import"
15+
],
16+
"rules": {
17+
"@typescript-eslint/adjacent-overload-signatures": "error",
18+
"@typescript-eslint/array-type": "error",
19+
20+
"camelcase": "off",
21+
"@typescript-eslint/camelcase": ["error", { "properties": "never", "allow": ["^[A-Za-z][a-zA-Za-z]+_[A-Za-z]+$"] }],
22+
23+
"@typescript-eslint/class-name-casing": "error",
24+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
25+
"@typescript-eslint/interface-name-prefix": "error",
26+
"@typescript-eslint/no-inferrable-types": "error",
27+
"@typescript-eslint/no-misused-new": "error",
28+
"@typescript-eslint/no-this-alias": "error",
29+
"@typescript-eslint/prefer-for-of": "error",
30+
"@typescript-eslint/prefer-function-type": "error",
31+
"@typescript-eslint/prefer-namespace-keyword": "error",
32+
33+
"quotes": "off",
34+
"@typescript-eslint/quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
35+
36+
"semi": "off",
37+
"@typescript-eslint/semi": "error",
38+
39+
"@typescript-eslint/triple-slash-reference": "error",
40+
"@typescript-eslint/type-annotation-spacing": "error",
41+
"@typescript-eslint/unified-signatures": "error",
42+
43+
// scripts/eslint/rules
44+
"object-literal-surrounding-space": "error",
45+
"no-type-assertion-whitespace": "error",
46+
"type-operator-spacing": "error",
47+
"only-arrow-functions": ["error", {
48+
"allowNamedFunctions": true ,
49+
"allowDeclarations": true
50+
}],
51+
"no-double-space": "error",
52+
"boolean-trivia": "error",
53+
"no-in-operator": "error",
54+
"simple-indent": "error",
55+
"debug-assert": "error",
56+
"no-keywords": "error",
57+
58+
// eslint-plugin-import
59+
"import/no-extraneous-dependencies": ["error", { "optionalDependencies": false }],
60+
61+
// eslint-plugin-no-null
62+
"no-null/no-null": "error",
63+
64+
// eslint-plugin-jsdoc
65+
"jsdoc/check-alignment": "error",
66+
67+
// eslint
68+
"brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
69+
"constructor-super": "error",
70+
"curly": ["error", "multi-line"],
71+
"dot-notation": "error",
72+
"eqeqeq": "error",
73+
"linebreak-style": ["error", "windows"],
74+
"new-parens": "error",
75+
"no-caller": "error",
76+
"no-duplicate-case": "error",
77+
"no-duplicate-imports": "error",
78+
"no-empty": "error",
79+
"no-eval": "error",
80+
"no-extra-bind": "error",
81+
"no-fallthrough": "error",
82+
"no-new-func": "error",
83+
"no-new-wrappers": "error",
84+
"no-return-await": "error",
85+
"no-restricted-globals": ["error",
86+
{ "name": "setTimeout" },
87+
{ "name": "clearTimeout" },
88+
{ "name": "setInterval" },
89+
{ "name": "clearInterval" },
90+
{ "name": "setImmediate" },
91+
{ "name": "clearImmediate" }
92+
],
93+
"no-sparse-arrays": "error",
94+
"no-template-curly-in-string": "error",
95+
"no-throw-literal": "error",
96+
"no-trailing-spaces": "error",
97+
"no-undef-init": "error",
98+
"no-unsafe-finally": "error",
99+
"no-unused-expressions": ["error", { "allowTernary": true }],
100+
"no-unused-labels": "error",
101+
"no-var": "error",
102+
"object-shorthand": "error",
103+
"prefer-const": "error",
104+
"prefer-object-spread": "error",
105+
"quote-props": ["error", "consistent-as-needed"],
106+
"space-in-parens": "error",
107+
"unicode-bom": ["error", "never"],
108+
"use-isnan": "error"
109+
}
110+
}

Diff for: .gitignore

+14-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ tests/cases/**/*.js
3737
!tests/cases/docker/*.js/
3838
tests/cases/**/*.js.map
3939
*.config
40+
scripts/eslint/built/
4041
scripts/debug.bat
4142
scripts/run.bat
4243
scripts/word2md.js
@@ -60,6 +61,8 @@ internal/
6061
**/.vs
6162
**/.vscode
6263
!**/.vscode/tasks.json
64+
!**/.vscode/settings.json
65+
!**/.vscode/extensions.json
6366
!tests/cases/projects/projectOption/**/node_modules
6467
!tests/cases/projects/NodeModulesSearch/**/*
6568
!tests/baselines/reference/project/nodeModules*/**/*
@@ -78,4 +81,14 @@ tests/cases/user/*/**/*.d.ts
7881
tests/baselines/reference/dt
7982
.failed-tests
8083
TEST-results.xml
81-
package-lock.json
84+
package-lock.json
85+
tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
86+
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
87+
tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
88+
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
89+
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
90+
tests/cases/user/create-react-app/create-react-app
91+
tests/cases/user/webpack/webpack
92+
tests/cases/user/puppeteer/puppeteer
93+
tests/cases/user/axios-src/axios-src
94+
tests/cases/user/prettier/prettier

Diff for: .gitmodules

-40
Original file line numberDiff line numberDiff line change
@@ -1,40 +0,0 @@
1-
[submodule "tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter"]
2-
path = tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
3-
url = https://github.com/Microsoft/TypeScript-React-Starter
4-
ignore = all
5-
[submodule "tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter"]
6-
path = tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
7-
url = https://github.com/Microsoft/TypeScript-Node-Starter.git
8-
ignore = all
9-
[submodule "tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter"]
10-
path = tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
11-
url = https://github.com/Microsoft/TypeScript-React-Native-Starter.git
12-
ignore = all
13-
[submodule "tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter"]
14-
path = tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
15-
url = https://github.com/Microsoft/TypeScript-Vue-Starter.git
16-
ignore = all
17-
[submodule "tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter"]
18-
path = tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
19-
url = https://github.com/Microsoft/TypeScript-WeChat-Starter.git
20-
ignore = all
21-
[submodule "tests/cases/user/create-react-app/create-react-app"]
22-
path = tests/cases/user/create-react-app/create-react-app
23-
url = https://github.com/facebook/create-react-app.git
24-
ignore = all
25-
[submodule "tests/cases/user/webpack/webpack"]
26-
path = tests/cases/user/webpack/webpack
27-
url = https://github.com/webpack/webpack.git
28-
ignore = all
29-
[submodule "tests/cases/user/puppeteer/puppeteer"]
30-
path = tests/cases/user/puppeteer/puppeteer
31-
url = https://github.com/GoogleChrome/puppeteer.git
32-
ignore = all
33-
[submodule "tests/cases/user/axios-src/axios-src"]
34-
path = tests/cases/user/axios-src/axios-src
35-
url = https://github.com/axios/axios.git
36-
ignore = all
37-
[submodule "tests/cases/user/prettier/prettier"]
38-
path = tests/cases/user/prettier/prettier
39-
url = https://github.com/prettier/prettier.git
40-
ignore = all

Diff for: .npmignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ netci.groovy
99
scripts
1010
src
1111
tests
12-
tslint.json
1312
Jakefile.js
13+
.eslintrc
14+
.eslintignore
1415
.editorconfig
1516
.failed-tests
1617
.git

Diff for: .travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ branches:
1818

1919
install:
2020
- npm uninstall typescript --no-save
21-
- npm uninstall tslint --no-save
2221
- npm install
2322

2423
cache:

Diff for: .vscode/extensions.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint"
4+
],
5+
6+
"unwantedRecommendations": [
7+
"ms-vscode.vscode-typescript-tslint-plugin"
8+
]
9+
}

Diff for: .vscode/settings.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"eslint.validate": [
3+
{
4+
"language": "typescript",
5+
"autoFix": true
6+
}
7+
],
8+
"eslint.options": {
9+
"rulePaths": ["./scripts/eslint/built/rules/"],
10+
"ext": [".ts"]
11+
}
12+
}

Diff for: CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Design changes will not be accepted at this time. If you have a design change pr
7171

7272
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
7373

74-
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.pdf](https://opensource.microsoft.com/pdf/microsoft-contribution-license-agreement.pdf)), sign, scan, and email it back to <[email protected]>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request.
74+
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.pdf](https://opensource.microsoft.com/pdf/microsoft-contribution-license-agreement.pdf)), sign, scan, and email it back to <[email protected]>. Be sure to include your GitHub user name along with the agreement. Once we have received the signed CLA, we'll review the request.
7575

7676
## Housekeeping
7777

@@ -148,7 +148,7 @@ You will probably only want to debug one test at a time:
148148
gulp runtests-browser --tests=2dArrays
149149
```
150150

151-
You can specify which browser to use for debugging. Currently Chrome and IE are supported:
151+
You can specify which browser to use for debugging. Currently, Chrome and IE are supported:
152152

153153
```Shell
154154
gulp runtests-browser --tests=2dArrays --browser=chrome

Diff for: Gulpfile.js

+59-25
Original file line numberDiff line numberDiff line change
@@ -318,36 +318,70 @@ task("clean-tests").description = "Cleans the outputs for the test infrastructur
318318

319319
const watchTests = () => watchProject("src/testRunner", cmdLineOptions);
320320

321-
const buildRules = () => buildProject("scripts/tslint");
322-
task("build-rules", buildRules);
323-
task("build-rules").description = "Compiles tslint rules to js";
321+
const buildEslintRules = () => buildProject("scripts/eslint");
322+
task("build-eslint-rules", buildEslintRules);
323+
task("build-eslint-rules").description = "Compiles eslint rules to js";
324324

325-
const cleanRules = () => cleanProject("scripts/tslint");
326-
cleanTasks.push(cleanRules);
327-
task("clean-rules", cleanRules);
328-
task("clean-rules").description = "Cleans the outputs for the lint rules";
325+
const cleanEslintRules = () => cleanProject("scripts/eslint");
326+
cleanTasks.push(cleanEslintRules);
327+
task("clean-eslint-rules", cleanEslintRules);
328+
task("clean-eslint-rules").description = "Cleans the outputs for the eslint rules";
329+
330+
const runEslintRulesTests = () => runConsoleTests("scripts/eslint/built/tests", "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ false);
331+
task("run-eslint-rules-tests", series(buildEslintRules, runEslintRulesTests));
332+
task("run-eslint-rules-tests").description = "Runs the eslint rule tests";
329333

330334
const lintFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("lint")); };
331335
const lintFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("lint")); };
332-
const lint = series([
333-
lintFoldStart,
334-
...["scripts/tslint/tsconfig.json", "src/tsconfig-base.json"].map(project => {
335-
const lintOne = () => {
336-
const args = ["node_modules/tslint/bin/tslint", "--project", project, "--formatters-dir", "./built/local/tslint/formatters", "--format", "autolinkableStylish"];
337-
if (cmdLineOptions.fix) args.push("--fix");
338-
log(`Linting: node ${args.join(" ")}`);
339-
return exec(process.execPath, args);
340-
};
341-
lintOne.dispayName = `lint(${project})`;
342-
return lintOne;
343-
}),
344-
lintFoldEnd
345-
]);
336+
337+
/** @type { (folder: string) => { (): Promise<any>; displayName?: string } } */
338+
const eslint = (folder) => async () => {
339+
const ESLINTRC_CI = ".eslintrc.ci.json";
340+
const isCIEnv = cmdLineOptions.ci || process.env.CI === "true";
341+
342+
const args = [
343+
"node_modules/eslint/bin/eslint",
344+
"--format", "autolinkable-stylish",
345+
"--rulesdir", "scripts/eslint/built/rules",
346+
"--ext", ".ts",
347+
];
348+
349+
if (
350+
isCIEnv &&
351+
fs.existsSync(path.resolve(folder, ESLINTRC_CI))
352+
) {
353+
args.push("--config", path.resolve(folder, ESLINTRC_CI));
354+
}
355+
356+
if (cmdLineOptions.fix) {
357+
args.push("--fix");
358+
}
359+
360+
args.push(folder);
361+
362+
log(`Linting: ${args.join(" ")}`);
363+
return exec(process.execPath, args);
364+
}
365+
366+
const lintScripts = eslint("scripts");
367+
lintScripts.displayName = "lint-scripts";
368+
task("lint-scripts", series([buildEslintRules, lintFoldStart, lintScripts, lintFoldEnd]));
369+
task("lint-scripts").description = "Runs eslint on the scripts sources.";
370+
371+
const lintCompiler = eslint("src");
372+
lintCompiler.displayName = "lint-compiler";
373+
task("lint-compiler", series([buildEslintRules, lintFoldStart, lintCompiler, lintFoldEnd]));
374+
task("lint-compiler").description = "Runs eslint on the compiler sources.";
375+
task("lint-compiler").flags = {
376+
" --ci": "Runs eslint additional rules",
377+
};
378+
379+
const lint = series([buildEslintRules, lintFoldStart, lintScripts, lintCompiler, lintFoldEnd]);
346380
lint.displayName = "lint";
347-
task("lint", series(buildRules, lint));
348-
task("lint").description = "Runs tslint on the compiler sources.";
381+
task("lint", series([buildEslintRules, lintFoldStart, lint, lintFoldEnd]));
382+
task("lint").description = "Runs eslint on the compiler and scripts sources.";
349383
task("lint").flags = {
350-
" --f[iles]=<regex>": "pattern to match files to lint",
384+
" --ci": "Runs eslint additional rules",
351385
};
352386

353387
const buildCancellationToken = () => buildProject("src/cancellationToken");
@@ -393,7 +427,7 @@ const generateCodeCoverage = () => exec("istanbul", ["cover", "node_modules/moch
393427
task("generate-code-coverage", series(preBuild, buildTests, generateCodeCoverage));
394428
task("generate-code-coverage").description = "Generates code coverage data via istanbul";
395429

396-
const preTest = parallel(buildRules, buildTests, buildServices, buildLssl);
430+
const preTest = parallel(buildTests, buildServices, buildLssl);
397431
preTest.displayName = "preTest";
398432

399433
const postTest = (done) => cmdLineOptions.lint ? lint(done) : done();

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ gulp runtests # Run tests using the built compiler and test infrastruct
9090
gulp runtests-parallel # Like runtests, but split across multiple threads. Uses a number of threads equal to the system
9191
# core count by default. Use --workers=<number> to adjust this.
9292
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
93-
gulp lint # Runs tslint on the TypeScript source.
93+
gulp lint # Runs eslint on the TypeScript source.
9494
gulp help # List the above commands.
9595
```
9696

0 commit comments

Comments
 (0)