-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.eslintrc.js
113 lines (113 loc) · 3.99 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* eslint-env node */
// default configuration tuned for development
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
},
plugins: ["@typescript-eslint", "json", "react", "react-hooks", "unused-imports"],
env: {
browser: true,
es6: true
},
settings: {
react: {
pragma: "React",
version: "detect"
}
},
ignorePatterns: [
"build/", "node_modules/"
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:eslint-comments/recommended",
"plugin:json/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
rules: {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-confusing-non-null-assertion": "error",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off", // 27 as of 2020-09-13
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-shadow": ["error", { builtinGlobals: false, hoist: "all", allow: ["resolve", "reject"] }],
"@typescript-eslint/no-unused-vars": "off", // moved to unused-imports
"@typescript-eslint/prefer-optional-chain": "off", // 300 as of 2020-09-13
curly: ["error", "multi-line", "consistent"],
"dot-notation": "error",
"eol-last": "warn",
eqeqeq: ["error", "smart"],
"eslint-comments/no-unused-disable": "off", // enabled in .eslintrc.build.js
"max-len": ["warn", { code: 120, ignoreUrls: true }],
"no-bitwise": "error",
"no-debugger": "off", // enabled in .eslintrc.build.js
"no-duplicate-imports": "error",
"no-sequences": "error",
"no-shadow": "off", // superseded by @typescript-eslint/no-shadow
"no-tabs": "error",
"no-unneeded-ternary": "error",
"no-unused-expressions": ["error", { allowShortCircuit: true }],
"no-unused-vars": "off", // superseded by @typescript-eslint/no-unused-vars
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-var": "error",
"no-whitespace-before-property": "error",
"object-shorthand": "error",
"prefer-const": ["error", {"destructuring": "all"}],
"prefer-object-spread": "error",
"prefer-regex-literals": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
radix: "error",
"react/jsx-closing-tag-location": "error",
"react/jsx-handler-names": "off", // 13 as of 2020-09-13
"react/jsx-no-useless-fragment": "error",
"react/no-access-state-in-setstate": "error",
"react/no-danger": "error",
"react/no-unsafe": ["off", { checkAliases: true }], // 1 as of 2020-09-13
"react/no-unused-state": "error",
"react/prop-types": "off",
semi: ["error", "always"],
"unused-imports/no-unused-imports": "warn",
"unused-imports/no-unused-vars": ["warn",
{ args: "none", ignoreRestSiblings: true, "destructuredArrayIgnorePattern": "^_" }],
},
overrides: [
{ // test files
files: ["*.test.*", "jest-resolver.js", "setupTests.ts"],
env: {
node: true,
jest: true
},
rules: {
"@typescript-eslint/no-non-null-assertion": "off",
// require() can be useful in mocking
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-var-requires": "off",
}
},
{ // eslint configs
files: [".eslintrc*.js"],
env: {
node: true
}
},
{ // webpack configs
files: ["webpack.config.js"],
env: {
node: true
},
rules: {
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-var-requires": "off"
}
}
]
};