lint all ts files in scripts. remove tslint: directive. add extended eslint config for CI environment
This commit is contained in:
parent
b728bf4bfa
commit
3424f843f5
10
Gulpfile.js
10
Gulpfile.js
|
@ -334,13 +334,17 @@ task("run-eslint-rules-tests").description = "Runs the eslint rule tests";
|
||||||
const lintFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("lint")); };
|
const lintFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("lint")); };
|
||||||
const lintFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("lint")); };
|
const lintFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("lint")); };
|
||||||
const eslint = (folder) => async () => {
|
const eslint = (folder) => async () => {
|
||||||
|
const ESLINTRC_CI = ".eslintrc.ci.json";
|
||||||
|
const ESLINTRC = ".eslintrc.json";
|
||||||
|
const isCIEnv = process.env.CI === "true";
|
||||||
|
const config = isCIEnv && fs.existsSync(path.resolve(folder, ESLINTRC_CI)) ? ESLINTRC_CI : ESLINTRC;
|
||||||
|
|
||||||
const args = [
|
const args = [
|
||||||
"node_modules/eslint/bin/eslint",
|
"node_modules/eslint/bin/eslint",
|
||||||
"--config", `${ folder }/.eslintrc.json`,
|
"--config", `${ folder }/${ config }`,
|
||||||
"--format", "autolinkable-stylish",
|
"--format", "autolinkable-stylish",
|
||||||
"--rulesdir", "scripts/eslint/built/rules",
|
"--rulesdir", "scripts/eslint/built/rules",
|
||||||
"--ext", ".ts",
|
"--ext", ".ts", folder,
|
||||||
`${ folder }`,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (cmdLineOptions.fix) {
|
if (cmdLineOptions.fix) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"project": [
|
"project": [
|
||||||
"./importDefinitelyTypedTests/tsconfig.json",
|
"./importDefinitelyTypedTests/tsconfig.json",
|
||||||
"./eslint/tsconfig.json",
|
"./eslint/tsconfig.json",
|
||||||
"./tsconfig.json"
|
"./tsconfig.eslint.json"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
scripts/tsconfig.eslint.json
Normal file
4
scripts/tsconfig.eslint.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"include": ["*.ts", "types"]
|
||||||
|
}
|
|
@ -11,17 +11,12 @@
|
||||||
"lib": ["es6", "scripthost"],
|
"lib": ["es6", "scripthost"],
|
||||||
},
|
},
|
||||||
|
|
||||||
"includes": [
|
"include": [
|
||||||
"generateLocalizedDiagnosticMessages.ts",
|
"generateLocalizedDiagnosticMessages.ts",
|
||||||
"processDiagnosticMessages.ts",
|
"processDiagnosticMessages.ts",
|
||||||
"configurePrerelease.ts",
|
"configurePrerelease.ts",
|
||||||
"failed-tests.d.ts",
|
|
||||||
"buildProtocol.ts",
|
"buildProtocol.ts",
|
||||||
"produceLKG.ts",
|
"produceLKG.ts",
|
||||||
"word2md.ts"
|
"word2md.ts"
|
||||||
],
|
|
||||||
|
|
||||||
"exclude": [
|
|
||||||
"ambient.d.ts"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
7
src/.eslintrc.ci.json
Normal file
7
src/.eslintrc.ci.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"extends": "./.eslintrc.json",
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||||
|
"@typescript-eslint/no-unnecessary-type-assertion": "error"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1342,11 +1342,9 @@ namespace ts {
|
||||||
rawTextScanner.setText("`" + rawText + "`");
|
rawTextScanner.setText("`" + rawText + "`");
|
||||||
break;
|
break;
|
||||||
case SyntaxKind.TemplateHead:
|
case SyntaxKind.TemplateHead:
|
||||||
// tslint:disable-next-line no-invalid-template-strings
|
|
||||||
rawTextScanner.setText("`" + rawText + "${");
|
rawTextScanner.setText("`" + rawText + "${");
|
||||||
break;
|
break;
|
||||||
case SyntaxKind.TemplateMiddle:
|
case SyntaxKind.TemplateMiddle:
|
||||||
// tslint:disable-next-line no-invalid-template-strings
|
|
||||||
rawTextScanner.setText("}" + rawText + "${");
|
rawTextScanner.setText("}" + rawText + "${");
|
||||||
break;
|
break;
|
||||||
case SyntaxKind.TemplateTail:
|
case SyntaxKind.TemplateTail:
|
||||||
|
|
|
@ -599,10 +599,8 @@ namespace ts {
|
||||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||||
return "`" + rawText + "`";
|
return "`" + rawText + "`";
|
||||||
case SyntaxKind.TemplateHead:
|
case SyntaxKind.TemplateHead:
|
||||||
// tslint:disable-next-line no-invalid-template-strings
|
|
||||||
return "`" + rawText + "${";
|
return "`" + rawText + "${";
|
||||||
case SyntaxKind.TemplateMiddle:
|
case SyntaxKind.TemplateMiddle:
|
||||||
// tslint:disable-next-line no-invalid-template-strings
|
|
||||||
return "}" + rawText + "${";
|
return "}" + rawText + "${";
|
||||||
case SyntaxKind.TemplateTail:
|
case SyntaxKind.TemplateTail:
|
||||||
return "}" + rawText + "`";
|
return "}" + rawText + "`";
|
||||||
|
|
Loading…
Reference in a new issue