lint all ts files in scripts. remove tslint: directive. add extended eslint config for CI environment

This commit is contained in:
Alexander T 2019-08-14 14:10:40 +03:00
parent b728bf4bfa
commit 3424f843f5
7 changed files with 20 additions and 14 deletions

View file

@ -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 lintFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("lint")); };
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 = [
"node_modules/eslint/bin/eslint",
"--config", `${ folder }/.eslintrc.json`,
"--config", `${ folder }/${ config }`,
"--format", "autolinkable-stylish",
"--rulesdir", "scripts/eslint/built/rules",
"--ext", ".ts",
`${ folder }`,
"--ext", ".ts", folder,
];
if (cmdLineOptions.fix) {

View file

@ -5,7 +5,7 @@
"project": [
"./importDefinitelyTypedTests/tsconfig.json",
"./eslint/tsconfig.json",
"./tsconfig.json"
"./tsconfig.eslint.json"
]
}
}

View file

@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["*.ts", "types"]
}

View file

@ -11,17 +11,12 @@
"lib": ["es6", "scripthost"],
},
"includes": [
"include": [
"generateLocalizedDiagnosticMessages.ts",
"processDiagnosticMessages.ts",
"configurePrerelease.ts",
"failed-tests.d.ts",
"buildProtocol.ts",
"produceLKG.ts",
"word2md.ts"
],
"exclude": [
"ambient.d.ts"
]
}

7
src/.eslintrc.ci.json Normal file
View file

@ -0,0 +1,7 @@
{
"extends": "./.eslintrc.json",
"rules": {
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error"
}
}

View file

@ -1342,11 +1342,9 @@ namespace ts {
rawTextScanner.setText("`" + rawText + "`");
break;
case SyntaxKind.TemplateHead:
// tslint:disable-next-line no-invalid-template-strings
rawTextScanner.setText("`" + rawText + "${");
break;
case SyntaxKind.TemplateMiddle:
// tslint:disable-next-line no-invalid-template-strings
rawTextScanner.setText("}" + rawText + "${");
break;
case SyntaxKind.TemplateTail:

View file

@ -599,10 +599,8 @@ namespace ts {
case SyntaxKind.NoSubstitutionTemplateLiteral:
return "`" + rawText + "`";
case SyntaxKind.TemplateHead:
// tslint:disable-next-line no-invalid-template-strings
return "`" + rawText + "${";
case SyntaxKind.TemplateMiddle:
// tslint:disable-next-line no-invalid-template-strings
return "}" + rawText + "${";
case SyntaxKind.TemplateTail:
return "}" + rawText + "`";