-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
66 lines (57 loc) · 2.33 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const typescriptProjects = ["./tsconfig.json", "./tsconfig.eslint.json"];
/** @type import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> */
const config = {
root: true,
env: {
es2021: true,
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: { project: typescriptProjects, tsconfigRootDir: __dirname },
plugins: ["@typescript-eslint"],
rules: {},
};
/** @type import("eslint").Linter.ConfigOverride<import("eslint").Linter.RulesRecord>[] */
const overrides = [
{
/**
* This following rules can't be used on JavaScript in codebases with
* mixed JS/TS, so we turn them off on all `.js`-files
* @see https://github.com/typescript-eslint/typescript-eslint/blob/aee723813ec47ccac0a165cf1bc9674f6257b609/packages/eslint-plugin/docs/rules/explicit-function-return-type.md#configuring-in-a-mixed-jsts-codebase
* @see https://github.com/typescript-eslint/typescript-eslint/blob/aee723813ec47ccac0a165cf1bc9674f6257b609/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md#configuring-in-a-mixed-jsts-codebase
* @see https://github.com/typescript-eslint/typescript-eslint/blob/1f3c34426cea6d04df2393032e0728ade7390d3c/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md#configuring-in-a-mixed-jsts-codebase
*/
files: ["*.js"],
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-implicit-any-catch": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
},
},
{
/**
* Configurations in project root
*/
files: ["./*.js"],
env: {
node: true,
},
rules: {
"@typescript-eslint/no-var-requires": "off",
},
},
{
/**
* Jest recommended rules for all files jest would match
* NB: This might conflict with other test-frameworks
*/
files: ["*.test.js", "*.test.ts", "*.test.tsx"],
extends: ["plugin:jest/recommended"],
},
];
module.exports = { ...config, overrides };