Skip to content

Commit 466ee10

Browse files
committed
add .eslintrc for src and scripts. update typescript-eslint
1 parent b3afb55 commit 466ee10

10 files changed

Lines changed: 73 additions & 57 deletions

File tree

.eslintrc.json

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
"parserOptions": {
44
"warnOnUnsupportedTypeScriptVersion": false,
55
"ecmaVersion": 6,
6-
"sourceType": "module",
7-
"project": "./tsconfig.eslint.json"
6+
"sourceType": "module"
87
},
98
"env": {
109
"browser": false,
@@ -25,8 +24,6 @@
2524
"@typescript-eslint/no-inferrable-types": "error",
2625
"@typescript-eslint/no-misused-new": "error",
2726
"@typescript-eslint/no-this-alias": "error",
28-
"@typescript-eslint/no-unnecessary-qualifier": "error",
29-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
3027
"@typescript-eslint/prefer-for-of": "error",
3128
"@typescript-eslint/prefer-function-type": "error",
3229
"@typescript-eslint/prefer-namespace-keyword": "error",
@@ -80,8 +77,9 @@
8077
"no-return-await": "error",
8178
"no-restricted-globals": ["error",
8279
{ "name": "setTimeout" },
83-
{ "name": "setInterval" },
8480
{ "name": "clearTimeout" },
81+
{ "name": "setInterval" },
82+
{ "name": "clearInterval" },
8583
{ "name": "setImmediate" },
8684
{ "name": "clearImmediate" }
8785
],
@@ -102,24 +100,5 @@
102100
"space-in-parens": "error",
103101
"unicode-bom": ["error", "never"],
104102
"use-isnan": "error"
105-
},
106-
"overrides": [{
107-
"files": ["src/lib/*.d.ts"],
108-
"rules": {
109-
"@typescript-eslint/interface-name-prefix": "off",
110-
"@typescript-eslint/prefer-function-type": "off",
111-
"@typescript-eslint/unified-signatures": "off",
112-
113-
// scripts/eslint/rules
114-
"no-keywords": "off",
115-
116-
// eslint
117-
"no-var": "off"
118-
}
119-
}, {
120-
"files": ["src/lib/es2019.array.d.ts"],
121-
"rules": {
122-
"@typescript-eslint/array-type": "off"
123-
}
124-
}]
103+
}
125104
}

.vscode/settings.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"eslint.validate": [
3-
"javascript",
43
{
54
"language": "typescript",
65
"autoFix": true
76
}
87
],
98
"eslint.options": {
10-
"rulePaths": ["./scripts/eslint/built/rules/"],
11-
}
9+
"rulePaths": ["../scripts/eslint/built/rules/"],
10+
"ext": [".ts"]
11+
},
12+
"eslint.workingDirectories": ["./src", "./scripts"]
1213
}

Gulpfile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,14 @@ task("run-eslint-rules-tests").description = "Runs the eslint rule tests";
333333

334334
const lintFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("lint")); };
335335
const lintFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("lint")); };
336-
const eslint = (path) => async () => {
336+
const eslint = (folder) => async () => {
337337
const args = [
338338
"node_modules/eslint/bin/eslint",
339+
"--config", `${ folder }/.eslintrc.json`,
339340
"--format", "autolinkable-stylish",
340341
"--rulesdir", "scripts/eslint/built/rules",
341342
"--ext", ".ts",
342-
`${ path }`,
343+
`${ folder }`,
343344
];
344345

345346
if (cmdLineOptions.fix) {

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
"@types/through2": "latest",
5656
"@types/travis-fold": "latest",
5757
"@types/xml2js": "^0.4.0",
58-
"@typescript-eslint/eslint-plugin": "2.0.0-alpha.4",
59-
"@typescript-eslint/experimental-utils": "2.0.0-alpha.4",
60-
"@typescript-eslint/parser": "2.0.0-alpha.4",
58+
"@typescript-eslint/eslint-plugin": "2.0.0",
59+
"@typescript-eslint/experimental-utils": "2.0.0",
60+
"@typescript-eslint/parser": "2.0.0",
6161
"async": "latest",
6262
"azure-devops-node-api": "^8.0.0",
6363
"browser-resolve": "^1.11.2",
@@ -67,7 +67,7 @@
6767
"convert-source-map": "latest",
6868
"del": "latest",
6969
"eslint": "6.1.0",
70-
"eslint-formatter-autolinkable-stylish": "1.0.0",
70+
"eslint-formatter-autolinkable-stylish": "1.0.1",
7171
"eslint-plugin-import": "2.18.2",
7272
"eslint-plugin-jsdoc": "15.7.2",
7373
"eslint-plugin-no-null": "1.0.2",

scripts/.eslintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../.eslintrc.json",
3+
"parserOptions": {
4+
"tsconfigRootDir": "scripts",
5+
"project": [
6+
"./importDefinitelyTypedTests/tsconfig.json",
7+
"./eslint/tsconfig.json",
8+
"./tsconfig.json"
9+
]
10+
}
11+
}

scripts/eslint/tsconfig.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222

2323
"include": [
2424
"rules",
25-
"tests",
26-
"tests/support/*.json"
25+
"tests"
2726
],
2827

2928
"exclude": [
30-
"tests/fixtures"
29+
"fixtures"
3130
]
3231
}

scripts/tsconfig.json

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
{
22
"compilerOptions": {
3+
"strictNullChecks": true,
34
"removeComments": false,
4-
"target": "es6",
5-
"module": "commonjs",
65
"declaration": false,
76
"sourceMap": true,
8-
"lib": [
9-
"es6",
10-
"scripthost"
11-
],
12-
"strictNullChecks": true,
137
"newLine": "lf",
14-
"types": ["node"]
8+
"target": "es6",
9+
"module": "commonjs",
10+
"types": ["node"],
11+
"lib": ["es6", "scripthost"],
1512
},
16-
"files": [
17-
"produceLKG.ts",
18-
"buildProtocol.ts",
19-
"processDiagnosticMessages.ts",
13+
14+
"includes": [
2015
"generateLocalizedDiagnosticMessages.ts",
16+
"processDiagnosticMessages.ts",
2117
"configurePrerelease.ts",
18+
"failed-tests.d.ts",
19+
"buildProtocol.ts",
20+
"produceLKG.ts",
2221
"word2md.ts"
22+
],
23+
24+
"exclude": [
25+
"ambient.d.ts"
2326
]
2427
}

src/.eslintrc.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"extends": "../.eslintrc.json",
3+
"parserOptions": {
4+
"tsconfigRootDir": "src",
5+
"project": "./tsconfig-base.json"
6+
},
7+
"overrides": [
8+
{
9+
"files": ["lib/*.d.ts"],
10+
"rules": {
11+
"@typescript-eslint/interface-name-prefix": "off",
12+
"@typescript-eslint/prefer-function-type": "off",
13+
"@typescript-eslint/unified-signatures": "off",
14+
15+
// scripts/eslint/rules
16+
"no-keywords": "off",
17+
18+
// eslint
19+
"no-var": "off"
20+
}
21+
},
22+
{
23+
"files": ["lib/es2019.array.d.ts"],
24+
"rules": {
25+
"@typescript-eslint/array-type": "off"
26+
}
27+
}
28+
]
29+
}

src/watchGuard/watchGuard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ try {
1515
watcher.close();
1616
}
1717
catch { /*ignore*/ }
18-
process.exit(0);
18+
process.exit(0);

tsconfig.eslint.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)