-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc
224 lines (221 loc) · 11.3 KB
/
.eslintrc
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
{
"extends": [
// https://github.com/eslint/eslint/blob/master/conf/eslint-recommended.js#L13-L71
"eslint:recommended",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.ts#L6-L33
"plugin:@typescript-eslint/recommended",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts#L6-L25
"plugin:@typescript-eslint/recommended-requiring-type-checking",
// https://github.com/benmosher/eslint-plugin-import/blob/master/config/recommended.js#L6-L27
"plugin:import/recommended",
// https://github.com/benmosher/eslint-plugin-import/blob/master/config/typescript.js#L9-L27
"plugin:import/typescript",
// https://github.com/jest-community/eslint-plugin-jest#rules
"plugin:jest/recommended",
// https://github.com/jest-community/eslint-plugin-jest#rules
"plugin:jest/style",
// https://github.com/prettier/eslint-plugin-prettier/blob/master/eslint-plugin-prettier.js#L92-L100
"plugin:prettier/recommended"
],
// Some @typescript-eslint rules need it
"parserOptions": {
"project": "tsconfig.json"
},
"root": true,
"rules": {
// https://eslint.org/docs/rules/consistent-return
"consistent-return": "error",
// https://eslint.org/docs/rules/default-case-last
"default-case-last": "error",
// https://eslint.org/docs/rules/default-case
"default-case": "error",
// Handled by @typescript-eslint/default-param-last
// https://eslint.org/docs/rules/default-param-last
"default-param-last": "off",
// Handled by @typescript-eslint/dot-notation
// https://eslint.org/docs/rules/dot-notation
"dot-notation": "off",
// https://eslint.org/docs/rules/eqeqeq
"eqeqeq": "error",
// https://eslint.org/docs/rules/id-denylist
"id-denylist": ["error", "err"],
// https://eslint.org/docs/rules/line-comment-position
"line-comment-position": [
"error",
{ "position": "above", "ignorePattern": "(Prefix|Suffix) (=|!)==" }
],
// https://eslint.org/docs/rules/no-alert
"no-alert": "error",
// https://eslint.org/docs/rules/no-console
"no-console": ["error", { "allow": ["error"] }],
// https://eslint.org/docs/rules/no-implicit-coercion
"no-implicit-coercion": "error",
// https://eslint.org/docs/rules/no-new-wrappers
"no-new-wrappers": "error",
// https://eslint.org/docs/rules/no-param-reassign
"no-param-reassign": "error",
// https://eslint.org/docs/rules/no-plusplus
"no-plusplus": "error",
// https://eslint.org/docs/rules/no-restricted-imports
"no-restricted-imports": [
"error",
{
"name": "lodash",
"message": "Please use `import <package> from \"lodash/<package>\";` instead."
}
],
// https://eslint.org/docs/rules/no-return-assign
"no-return-assign": "error",
// Handled by @typescript-eslint/return-await
// https://eslint.org/docs/rules/no-return-await
"no-return-await": "off",
// https://eslint.org/docs/rules/no-self-compare
"no-self-compare": "error",
// https://eslint.org/docs/rules/no-unneeded-ternary
"no-unneeded-ternary": "error",
// Handled by @typescript-eslint/no-unused-expressions
// https://eslint.org/docs/rules/no-unused-expressions
"no-unused-expressions": "off",
// https://eslint.org/docs/rules/no-useless-computed-key
"no-useless-computed-key": "error",
// https://eslint.org/docs/rules/no-useless-concat
"no-useless-concat": "error",
// https://eslint.org/docs/rules/no-useless-rename
"no-useless-rename": "error",
// https://eslint.org/docs/rules/no-useless-return
"no-useless-return": "error",
// https://eslint.org/docs/rules/object-shorthand
"object-shorthand": "error",
// https://eslint.org/docs/rules/one-var
"one-var": ["error", "never"],
// https://eslint.org/docs/rules/operator-assignment
"operator-assignment": ["error", "always"],
// https://eslint.org/docs/rules/prefer-arrow-callback
"prefer-arrow-callback": "error",
// https://eslint.org/docs/rules/prefer-destructuring
"prefer-destructuring": "error",
// https://eslint.org/docs/rules/prefer-named-capture-group
"prefer-named-capture-group": "error",
// https://eslint.org/docs/rules/prefer-promise-reject-errors
"prefer-promise-reject-errors": "error",
// https://eslint.org/docs/rules/prefer-template
"prefer-template": "error",
// https://eslint.org/docs/rules/radix
"radix": "error",
// https://eslint.org/docs/rules/sort-imports
"sort-imports": [
"error",
{
"ignoreCase": false,
"ignoreDeclarationSort": true,
"ignoreMemberSort": false
}
],
// https://eslint.org/docs/rules/yoda
"yoda": ["error", "never"],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md
"@typescript-eslint/consistent-indexed-object-style": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-assertions.md
"@typescript-eslint/consistent-type-assertions": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
"@typescript-eslint/consistent-type-definitions": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-imports.md
"@typescript-eslint/consistent-type-imports": [
"error",
{ "prefer": "no-type-imports" }
],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/default-param-last.md
"@typescript-eslint/default-param-last": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
"@typescript-eslint/dot-notation": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
"@typescript-eslint/explicit-function-return-type": [
"error",
{ "allowExpressions": true }
],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/method-signature-style.md
"@typescript-eslint/method-signature-style": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md
"@typescript-eslint/no-confusing-non-null-assertion": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md
"@typescript-eslint/no-implicit-any-catch": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-void-type.md
"@typescript-eslint/no-invalid-void-type": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md
"@typescript-eslint/no-unnecessary-condition": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md
"@typescript-eslint/no-unnecessary-type-arguments": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md
"@typescript-eslint/no-unnecessary-type-constraint": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
"@typescript-eslint/no-unused-expressions": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md
"@typescript-eslint/prefer-reduce-type-parameter": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md
"@typescript-eslint/prefer-string-starts-ends-with": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
"@typescript-eslint/return-await": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md
"@typescript-eslint/strict-boolean-expressions": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unified-signatures.md
"@typescript-eslint/unified-signatures": "error",
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/exports-last.md
"import/exports-last": "error",
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
"import/first": "error",
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/group-exports.md
"import/group-exports": "error",
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
"import/newline-after-import": "error",
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
"import/no-absolute-path": "error",
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-anonymous-default-export.md
"import/no-anonymous-default-export": "error",
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
"import/no-mutable-exports": "error",
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-self-import.md
"import/no-self-import": "error",
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-useless-path-segments.md
"import/no-useless-path-segments": ["error", { "noUselessIndex": true }],
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
"import/order": [
"error",
{
"alphabetize": { "order": "asc", "caseInsensitive": false },
"groups": [
"builtin",
"external",
"internal",
["parent", "sibling", "index"],
"object",
"type",
"unknown"
],
"newlines-between": "always",
"warnOnUnassignedImports": true
}
],
// https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/consistent-test-it.md
"jest/consistent-test-it": ["error", { "withinDescribe": "test" }],
// https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-duplicate-hooks.md
"jest/no-duplicate-hooks": "error",
// https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-on-top.md
"jest/prefer-hooks-on-top": "error",
// https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-spy-on.md
"jest/prefer-spy-on": "error",
// https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-strict-equal.md
"jest/prefer-strict-equal": "error",
// https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-to-throw-message.md
"jest/require-to-throw-message": "error"
},
"settings": {
// https://github.com/benmosher/eslint-plugin-import/issues/1582#issuecomment-568951354
"import/resolver": {
"node": {
"moduleDirectory": ["node_modules", "src"]
}
}
}
}