Skip to content

Commit dccce73

Browse files
authored
fix(perf): typescript: disable rules required type infomation (#98)
1 parent 7e0ad90 commit dccce73

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

lib/typescript.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ module.exports = {
22
parser: "@typescript-eslint/parser",
33
plugins: ["@typescript-eslint"],
44
extends: ["plugin:@typescript-eslint/recommended"],
5+
// It's 5〜10x slower with the project setting.
6+
// So We disable it until the issue has been fixed
7+
/*
58
parserOptions: {
69
project: "./tsconfig.json"
710
},
11+
*/
812
rules: {
913
"@typescript-eslint/array-type": ["error", "array-simple"],
10-
"@typescript-eslint/no-for-in-array": "error",
1114

1215
"no-useless-constructor": "off",
1316
"@typescript-eslint/no-useless-constructor": "warn",
1417
"@typescript-eslint/type-annotation-spacing": "warn",
1518
"@typescript-eslint/unified-signatures": "warn",
16-
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
1719
"@typescript-eslint/indent": ["warn", 2, { SwitchCase: 1 }],
1820

1921
"@typescript-eslint/camelcase": "off",
@@ -31,5 +33,10 @@ module.exports = {
3133
"@typescript-eslint/no-var-requires": "off",
3234
"@typescript-eslint/prefer-interface": "off",
3335
"@typescript-eslint/prefer-namespace-keyword": "off"
36+
37+
// These rules are required type information,
38+
// which means these can be checked without parserOptions.project
39+
// "@typescript-eslint/no-for-in-array": "error",
40+
// "@typescript-eslint/no-unnecessary-type-assertion": "warn",
3441
}
3542
};

test/react-typescript-test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ describe("react-typescript", () => {
1414
errors: ["@typescript-eslint/array-type"]
1515
},
1616
"warning.tsx": {
17-
warnings: [
18-
"@typescript-eslint/no-useless-constructor",
19-
"@typescript-eslint/no-unnecessary-type-assertion"
20-
]
17+
warnings: ["@typescript-eslint/no-useless-constructor"]
2118
}
2219
});
2320
});

test/typescript-test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ describe("typescript", () => {
1111
errors: ["@typescript-eslint/array-type"]
1212
},
1313
"warning.ts": {
14-
warnings: [
15-
"@typescript-eslint/no-useless-constructor",
16-
"@typescript-eslint/no-unnecessary-type-assertion"
17-
]
14+
warnings: ["@typescript-eslint/no-useless-constructor"]
1815
}
1916
});
2017
});

0 commit comments

Comments
 (0)