@morgs32/eslint-config 2.0.6 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -332
- package/base.eslintrc.js +337 -0
- package/package.json +8 -6
package/.eslintrc.js
CHANGED
|
@@ -1,335 +1,4 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
module.exports = {
|
|
3
|
-
extends: ['
|
|
4
|
-
ignorePatterns: ['**/lib', '**/dist'],
|
|
5
|
-
settings: {
|
|
6
|
-
react: {
|
|
7
|
-
version: 'detect',
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
plugins: [
|
|
11
|
-
'import',
|
|
12
|
-
'unused-imports',
|
|
13
|
-
'react',
|
|
14
|
-
'react-hooks',
|
|
15
|
-
'jsx-a11y',
|
|
16
|
-
'@typescript-eslint',
|
|
17
|
-
'jest',
|
|
18
|
-
'testing-library',
|
|
19
|
-
],
|
|
20
|
-
|
|
21
|
-
rules: {
|
|
22
|
-
'spaced-comment': ['error', 'always', { markers: ['/'] }],
|
|
23
|
-
'unused-imports/no-unused-imports': 'error',
|
|
24
|
-
'comma-spacing': ['error', { before: false, after: true }],
|
|
25
|
-
'react/jsx-indent': ['error', 2],
|
|
26
|
-
'space-infix-ops': ['error'],
|
|
27
|
-
quotes: ['error', 'single'],
|
|
28
|
-
'space-before-blocks': 'error',
|
|
29
|
-
'keyword-spacing': 'error',
|
|
30
|
-
'object-curly-spacing': ['error', 'always'],
|
|
31
|
-
'react/jsx-indent-props': [2, 2],
|
|
32
|
-
'react/jsx-first-prop-new-line': [2, 'multiline'],
|
|
33
|
-
|
|
34
|
-
// https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/index.js
|
|
35
|
-
'array-callback-return': 'warn',
|
|
36
|
-
'default-case': ['warn', { commentPattern: '^no default$' }],
|
|
37
|
-
'dot-location': ['warn', 'property'],
|
|
38
|
-
eqeqeq: ['warn', 'smart'],
|
|
39
|
-
'new-parens': 'warn',
|
|
40
|
-
'no-array-constructor': 'warn',
|
|
41
|
-
'no-caller': 'warn',
|
|
42
|
-
'no-cond-assign': ['warn', 'except-parens'],
|
|
43
|
-
'no-const-assign': 'warn',
|
|
44
|
-
'no-control-regex': 'warn',
|
|
45
|
-
'no-delete-var': 'warn',
|
|
46
|
-
'no-dupe-args': 'warn',
|
|
47
|
-
'no-dupe-class-members': 'warn',
|
|
48
|
-
'no-dupe-keys': 'warn',
|
|
49
|
-
'no-duplicate-case': 'warn',
|
|
50
|
-
'no-empty-character-class': 'warn',
|
|
51
|
-
'no-empty-pattern': 'warn',
|
|
52
|
-
'no-eval': 'warn',
|
|
53
|
-
'no-ex-assign': 'warn',
|
|
54
|
-
'no-extend-native': 'warn',
|
|
55
|
-
'no-extra-bind': 'warn',
|
|
56
|
-
'no-extra-label': 'warn',
|
|
57
|
-
'no-fallthrough': 'warn',
|
|
58
|
-
'no-func-assign': 'warn',
|
|
59
|
-
'no-implied-eval': 'warn',
|
|
60
|
-
'no-invalid-regexp': 'warn',
|
|
61
|
-
'no-iterator': 'warn',
|
|
62
|
-
'no-label-var': 'warn',
|
|
63
|
-
'no-labels': ['warn', { allowLoop: true, allowSwitch: false }],
|
|
64
|
-
'no-lone-blocks': 'warn',
|
|
65
|
-
'no-loop-func': 'warn',
|
|
66
|
-
'no-mixed-operators': [
|
|
67
|
-
'warn',
|
|
68
|
-
{
|
|
69
|
-
groups: [
|
|
70
|
-
['&', '|', '^', '~', '<<', '>>', '>>>'],
|
|
71
|
-
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
|
|
72
|
-
['&&', '||'],
|
|
73
|
-
['in', 'instanceof'],
|
|
74
|
-
],
|
|
75
|
-
allowSamePrecedence: false,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
'no-multi-str': 'warn',
|
|
79
|
-
'no-global-assign': 'warn',
|
|
80
|
-
'no-unsafe-negation': 'warn',
|
|
81
|
-
'no-new-func': 'warn',
|
|
82
|
-
'no-new-object': 'warn',
|
|
83
|
-
'no-new-symbol': 'warn',
|
|
84
|
-
'no-new-wrappers': 'warn',
|
|
85
|
-
'no-obj-calls': 'warn',
|
|
86
|
-
'no-octal': 'warn',
|
|
87
|
-
'no-octal-escape': 'warn',
|
|
88
|
-
'no-redeclare': 'warn',
|
|
89
|
-
'no-regex-spaces': 'warn',
|
|
90
|
-
'no-restricted-syntax': ['warn', 'WithStatement'],
|
|
91
|
-
'no-script-url': 'warn',
|
|
92
|
-
'no-self-assign': 'warn',
|
|
93
|
-
'no-self-compare': 'warn',
|
|
94
|
-
'no-sequences': 'warn',
|
|
95
|
-
'no-shadow-restricted-names': 'warn',
|
|
96
|
-
'no-sparse-arrays': 'warn',
|
|
97
|
-
'no-template-curly-in-string': 'warn',
|
|
98
|
-
'no-this-before-super': 'warn',
|
|
99
|
-
'no-throw-literal': 'warn',
|
|
100
|
-
'no-undef': 'error',
|
|
101
|
-
// "no-restricted-globals": ["error"].concat(restrictedGlobals),
|
|
102
|
-
'no-unreachable': 'warn',
|
|
103
|
-
'no-unused-expressions': [
|
|
104
|
-
'error',
|
|
105
|
-
{
|
|
106
|
-
allowShortCircuit: true,
|
|
107
|
-
allowTernary: true,
|
|
108
|
-
allowTaggedTemplates: true,
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
'no-unused-labels': 'warn',
|
|
112
|
-
'no-unused-vars': [
|
|
113
|
-
'warn',
|
|
114
|
-
{
|
|
115
|
-
args: 'none',
|
|
116
|
-
ignoreRestSiblings: true,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
'no-use-before-define': [
|
|
120
|
-
'warn',
|
|
121
|
-
{
|
|
122
|
-
functions: false,
|
|
123
|
-
classes: false,
|
|
124
|
-
variables: false,
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
'no-useless-computed-key': 'warn',
|
|
128
|
-
'no-useless-concat': 'warn',
|
|
129
|
-
'no-useless-constructor': 'warn',
|
|
130
|
-
'no-useless-escape': 'warn',
|
|
131
|
-
'no-useless-rename': [
|
|
132
|
-
'warn',
|
|
133
|
-
{
|
|
134
|
-
ignoreDestructuring: false,
|
|
135
|
-
ignoreImport: false,
|
|
136
|
-
ignoreExport: false,
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
'no-with': 'warn',
|
|
140
|
-
'no-whitespace-before-property': 'warn',
|
|
141
|
-
'react-hooks/exhaustive-deps': 'warn',
|
|
142
|
-
'require-yield': 'warn',
|
|
143
|
-
'rest-spread-spacing': ['warn', 'never'],
|
|
144
|
-
strict: ['warn', 'never'],
|
|
145
|
-
'unicode-bom': ['warn', 'never'],
|
|
146
|
-
'use-isnan': 'warn',
|
|
147
|
-
'valid-typeof': 'warn',
|
|
148
|
-
'no-restricted-properties': [
|
|
149
|
-
'error',
|
|
150
|
-
{
|
|
151
|
-
object: 'require',
|
|
152
|
-
property: 'ensure',
|
|
153
|
-
message:
|
|
154
|
-
'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
object: 'System',
|
|
158
|
-
property: 'import',
|
|
159
|
-
message:
|
|
160
|
-
'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
'getter-return': 'warn',
|
|
164
|
-
|
|
165
|
-
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
|
|
166
|
-
'import/first': 'error',
|
|
167
|
-
'import/no-amd': 'error',
|
|
168
|
-
'import/no-anonymous-default-export': 'warn',
|
|
169
|
-
'import/no-webpack-loader-syntax': 'error',
|
|
170
|
-
|
|
171
|
-
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
|
|
172
|
-
'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
|
|
173
|
-
'react/jsx-no-comment-textnodes': 'warn',
|
|
174
|
-
'react/jsx-no-duplicate-props': 'warn',
|
|
175
|
-
'react/jsx-no-target-blank': 'warn',
|
|
176
|
-
'react/jsx-no-undef': 'error',
|
|
177
|
-
'react/jsx-pascal-case': [
|
|
178
|
-
'warn',
|
|
179
|
-
{
|
|
180
|
-
allowAllCaps: true,
|
|
181
|
-
ignore: [],
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
'react/no-danger-with-children': 'warn',
|
|
185
|
-
// Disabled because of undesirable warnings
|
|
186
|
-
// See https://github.com/facebook/create-react-app/issues/5204 for
|
|
187
|
-
// blockers until its re-enabled
|
|
188
|
-
// 'react/no-deprecated': 'warn',
|
|
189
|
-
'react/no-direct-mutation-state': 'warn',
|
|
190
|
-
'react/no-is-mounted': 'warn',
|
|
191
|
-
'react/no-typos': 'error',
|
|
192
|
-
'react/require-render-return': 'error',
|
|
193
|
-
'react/style-prop-object': 'warn',
|
|
194
|
-
|
|
195
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
|
|
196
|
-
'jsx-a11y/alt-text': 'warn',
|
|
197
|
-
'jsx-a11y/anchor-has-content': 'warn',
|
|
198
|
-
'jsx-a11y/anchor-is-valid': [
|
|
199
|
-
'warn',
|
|
200
|
-
{
|
|
201
|
-
aspects: ['noHref', 'invalidHref'],
|
|
202
|
-
},
|
|
203
|
-
],
|
|
204
|
-
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
|
|
205
|
-
'jsx-a11y/aria-props': 'warn',
|
|
206
|
-
'jsx-a11y/aria-proptypes': 'warn',
|
|
207
|
-
'jsx-a11y/aria-role': ['warn', { ignoreNonDOM: true }],
|
|
208
|
-
'jsx-a11y/aria-unsupported-elements': 'warn',
|
|
209
|
-
'jsx-a11y/heading-has-content': 'warn',
|
|
210
|
-
'jsx-a11y/iframe-has-title': 'warn',
|
|
211
|
-
'jsx-a11y/img-redundant-alt': 'warn',
|
|
212
|
-
'jsx-a11y/no-access-key': 'warn',
|
|
213
|
-
'jsx-a11y/no-distracting-elements': 'warn',
|
|
214
|
-
'jsx-a11y/no-redundant-roles': 'warn',
|
|
215
|
-
'jsx-a11y/role-has-required-aria-props': 'warn',
|
|
216
|
-
'jsx-a11y/role-supports-aria-props': 'warn',
|
|
217
|
-
'jsx-a11y/scope': 'warn',
|
|
218
|
-
|
|
219
|
-
// https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks
|
|
220
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
221
|
-
},
|
|
222
|
-
overrides: [
|
|
223
|
-
{
|
|
224
|
-
files: ['**/*.stories.*'],
|
|
225
|
-
rules: {
|
|
226
|
-
'import/no-anonymous-default-export': 'off',
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
// https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/jest.js
|
|
231
|
-
{
|
|
232
|
-
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
|
|
233
|
-
env: {
|
|
234
|
-
'jest/globals': true,
|
|
235
|
-
},
|
|
236
|
-
// A subset of the recommended rules:
|
|
237
|
-
rules: {
|
|
238
|
-
// https://github.com/jest-community/eslint-plugin-jest
|
|
239
|
-
'jest/no-conditional-expect': 'error',
|
|
240
|
-
'jest/no-identical-title': 'error',
|
|
241
|
-
'jest/no-interpolation-in-snapshots': 'error',
|
|
242
|
-
'jest/no-jasmine-globals': 'error',
|
|
243
|
-
'jest/no-mocks-import': 'error',
|
|
244
|
-
'jest/valid-describe-callback': 'error',
|
|
245
|
-
'jest/valid-expect': 'error',
|
|
246
|
-
'jest/valid-expect-in-promise': 'error',
|
|
247
|
-
'jest/valid-title': 'warn',
|
|
248
|
-
|
|
249
|
-
// https://github.com/testing-library/eslint-plugin-testing-library
|
|
250
|
-
'testing-library/await-async-query': 'error',
|
|
251
|
-
'testing-library/await-async-utils': 'error',
|
|
252
|
-
'testing-library/no-await-sync-query': 'error',
|
|
253
|
-
'testing-library/no-container': 'error',
|
|
254
|
-
'testing-library/no-debugging-utils': 'error',
|
|
255
|
-
'testing-library/no-dom-import': ['error', 'react'],
|
|
256
|
-
'testing-library/no-node-access': 'error',
|
|
257
|
-
'testing-library/no-promise-in-fire-event': 'error',
|
|
258
|
-
'testing-library/no-render-in-setup': 'error',
|
|
259
|
-
'testing-library/no-unnecessary-act': 'error',
|
|
260
|
-
'testing-library/no-wait-for-empty-callback': 'error',
|
|
261
|
-
'testing-library/no-wait-for-multiple-assertions': 'error',
|
|
262
|
-
'testing-library/no-wait-for-side-effects': 'error',
|
|
263
|
-
'testing-library/no-wait-for-snapshot': 'error',
|
|
264
|
-
'testing-library/prefer-find-by': 'error',
|
|
265
|
-
'testing-library/prefer-presence-queries': 'error',
|
|
266
|
-
'testing-library/prefer-query-by-disappearance': 'error',
|
|
267
|
-
'testing-library/prefer-screen-queries': 'error',
|
|
268
|
-
'testing-library/render-result-naming-convention': 'error',
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
|
|
272
|
-
// https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/index.js
|
|
273
|
-
{
|
|
274
|
-
files: ['**/*.ts?(x)'],
|
|
275
|
-
// parser: "@typescript-eslint/parser",
|
|
276
|
-
// parserOptions: {
|
|
277
|
-
// ecmaVersion: 2018,
|
|
278
|
-
// sourceType: "module",
|
|
279
|
-
// ecmaFeatures: {
|
|
280
|
-
// jsx: true,
|
|
281
|
-
// },
|
|
282
|
-
|
|
283
|
-
// // typescript-eslint specific options
|
|
284
|
-
// warnOnUnsupportedTypeScriptVersion: true,
|
|
285
|
-
// },
|
|
286
|
-
// plugins: ["@typescript-eslint"],
|
|
287
|
-
// If adding a typescript-eslint version of an existing ESLint rule,
|
|
288
|
-
// make sure to disable the ESLint rule here.
|
|
289
|
-
rules: {
|
|
290
|
-
// TypeScript's `noFallthroughCasesInSwitch` option is more robust (#6906)
|
|
291
|
-
'default-case': 'off',
|
|
292
|
-
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)
|
|
293
|
-
'no-dupe-class-members': 'off',
|
|
294
|
-
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
|
|
295
|
-
'no-undef': 'off',
|
|
296
|
-
|
|
297
|
-
// Add TypeScript specific rules (and turn off ESLint equivalents)
|
|
298
|
-
'@typescript-eslint/consistent-type-assertions': 'warn',
|
|
299
|
-
'no-array-constructor': 'off',
|
|
300
|
-
'@typescript-eslint/no-array-constructor': 'warn',
|
|
301
|
-
'no-redeclare': 'off',
|
|
302
|
-
'@typescript-eslint/no-redeclare': 'warn',
|
|
303
|
-
'no-use-before-define': 'off',
|
|
304
|
-
'@typescript-eslint/no-use-before-define': [
|
|
305
|
-
'warn',
|
|
306
|
-
{
|
|
307
|
-
functions: false,
|
|
308
|
-
classes: false,
|
|
309
|
-
variables: false,
|
|
310
|
-
typedefs: false,
|
|
311
|
-
},
|
|
312
|
-
],
|
|
313
|
-
'no-unused-expressions': 'off',
|
|
314
|
-
'@typescript-eslint/no-unused-expressions': [
|
|
315
|
-
'error',
|
|
316
|
-
{
|
|
317
|
-
allowShortCircuit: true,
|
|
318
|
-
allowTernary: true,
|
|
319
|
-
allowTaggedTemplates: true,
|
|
320
|
-
},
|
|
321
|
-
],
|
|
322
|
-
'no-unused-vars': 'off',
|
|
323
|
-
'@typescript-eslint/no-unused-vars': [
|
|
324
|
-
'warn',
|
|
325
|
-
{
|
|
326
|
-
args: 'none',
|
|
327
|
-
ignoreRestSiblings: true,
|
|
328
|
-
},
|
|
329
|
-
],
|
|
330
|
-
'no-useless-constructor': 'off',
|
|
331
|
-
'@typescript-eslint/no-useless-constructor': 'warn',
|
|
332
|
-
},
|
|
333
|
-
},
|
|
334
|
-
],
|
|
3
|
+
extends: ['./base.eslintrc', 'prettier'],
|
|
335
4
|
}
|
package/base.eslintrc.js
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
module.exports = {
|
|
3
|
+
extends: ['next/core-web-vitals'],
|
|
4
|
+
ignorePatterns: ['**/lib', '**/dist'],
|
|
5
|
+
settings: {
|
|
6
|
+
react: {
|
|
7
|
+
version: 'detect',
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
plugins: [
|
|
11
|
+
'import',
|
|
12
|
+
'unused-imports',
|
|
13
|
+
'react',
|
|
14
|
+
'react-hooks',
|
|
15
|
+
'jsx-a11y',
|
|
16
|
+
'@typescript-eslint',
|
|
17
|
+
'jest',
|
|
18
|
+
'testing-library',
|
|
19
|
+
'prettier',
|
|
20
|
+
],
|
|
21
|
+
|
|
22
|
+
rules: {
|
|
23
|
+
'prettier/prettier': 'error',
|
|
24
|
+
'spaced-comment': ['error', 'always', { markers: ['/'] }],
|
|
25
|
+
'unused-imports/no-unused-imports': 'error',
|
|
26
|
+
'comma-spacing': ['error', { before: false, after: true }],
|
|
27
|
+
'react/jsx-indent': ['error', 2],
|
|
28
|
+
'space-infix-ops': ['error'],
|
|
29
|
+
quotes: ['error', 'single'],
|
|
30
|
+
'space-before-blocks': 'error',
|
|
31
|
+
'keyword-spacing': 'error',
|
|
32
|
+
'object-curly-spacing': ['error', 'always'],
|
|
33
|
+
'react/jsx-indent-props': [2, 2],
|
|
34
|
+
'react/jsx-first-prop-new-line': [2, 'multiline'],
|
|
35
|
+
|
|
36
|
+
// https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/index.js
|
|
37
|
+
'array-callback-return': 'warn',
|
|
38
|
+
'default-case': ['warn', { commentPattern: '^no default$' }],
|
|
39
|
+
'dot-location': ['warn', 'property'],
|
|
40
|
+
eqeqeq: ['warn', 'smart'],
|
|
41
|
+
'new-parens': 'warn',
|
|
42
|
+
'no-array-constructor': 'warn',
|
|
43
|
+
'no-caller': 'warn',
|
|
44
|
+
'no-cond-assign': ['warn', 'except-parens'],
|
|
45
|
+
'no-const-assign': 'warn',
|
|
46
|
+
'no-control-regex': 'warn',
|
|
47
|
+
'no-delete-var': 'warn',
|
|
48
|
+
'no-dupe-args': 'warn',
|
|
49
|
+
'no-dupe-class-members': 'warn',
|
|
50
|
+
'no-dupe-keys': 'warn',
|
|
51
|
+
'no-duplicate-case': 'warn',
|
|
52
|
+
'no-empty-character-class': 'warn',
|
|
53
|
+
'no-empty-pattern': 'warn',
|
|
54
|
+
'no-eval': 'warn',
|
|
55
|
+
'no-ex-assign': 'warn',
|
|
56
|
+
'no-extend-native': 'warn',
|
|
57
|
+
'no-extra-bind': 'warn',
|
|
58
|
+
'no-extra-label': 'warn',
|
|
59
|
+
'no-fallthrough': 'warn',
|
|
60
|
+
'no-func-assign': 'warn',
|
|
61
|
+
'no-implied-eval': 'warn',
|
|
62
|
+
'no-invalid-regexp': 'warn',
|
|
63
|
+
'no-iterator': 'warn',
|
|
64
|
+
'no-label-var': 'warn',
|
|
65
|
+
'no-labels': ['warn', { allowLoop: true, allowSwitch: false }],
|
|
66
|
+
'no-lone-blocks': 'warn',
|
|
67
|
+
'no-loop-func': 'warn',
|
|
68
|
+
'no-mixed-operators': [
|
|
69
|
+
'warn',
|
|
70
|
+
{
|
|
71
|
+
groups: [
|
|
72
|
+
['&', '|', '^', '~', '<<', '>>', '>>>'],
|
|
73
|
+
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
|
|
74
|
+
['&&', '||'],
|
|
75
|
+
['in', 'instanceof'],
|
|
76
|
+
],
|
|
77
|
+
allowSamePrecedence: false,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
'no-multi-str': 'warn',
|
|
81
|
+
'no-global-assign': 'warn',
|
|
82
|
+
'no-unsafe-negation': 'warn',
|
|
83
|
+
'no-new-func': 'warn',
|
|
84
|
+
'no-new-object': 'warn',
|
|
85
|
+
'no-new-symbol': 'warn',
|
|
86
|
+
'no-new-wrappers': 'warn',
|
|
87
|
+
'no-obj-calls': 'warn',
|
|
88
|
+
'no-octal': 'warn',
|
|
89
|
+
'no-octal-escape': 'warn',
|
|
90
|
+
'no-redeclare': 'warn',
|
|
91
|
+
'no-regex-spaces': 'warn',
|
|
92
|
+
'no-restricted-syntax': ['warn', 'WithStatement'],
|
|
93
|
+
'no-script-url': 'warn',
|
|
94
|
+
'no-self-assign': 'warn',
|
|
95
|
+
'no-self-compare': 'warn',
|
|
96
|
+
'no-sequences': 'warn',
|
|
97
|
+
'no-shadow-restricted-names': 'warn',
|
|
98
|
+
'no-sparse-arrays': 'warn',
|
|
99
|
+
'no-template-curly-in-string': 'warn',
|
|
100
|
+
'no-this-before-super': 'warn',
|
|
101
|
+
'no-throw-literal': 'warn',
|
|
102
|
+
'no-undef': 'error',
|
|
103
|
+
// "no-restricted-globals": ["error"].concat(restrictedGlobals),
|
|
104
|
+
'no-unreachable': 'warn',
|
|
105
|
+
'no-unused-expressions': [
|
|
106
|
+
'error',
|
|
107
|
+
{
|
|
108
|
+
allowShortCircuit: true,
|
|
109
|
+
allowTernary: true,
|
|
110
|
+
allowTaggedTemplates: true,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
'no-unused-labels': 'warn',
|
|
114
|
+
'no-unused-vars': [
|
|
115
|
+
'warn',
|
|
116
|
+
{
|
|
117
|
+
args: 'none',
|
|
118
|
+
ignoreRestSiblings: true,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
'no-use-before-define': [
|
|
122
|
+
'warn',
|
|
123
|
+
{
|
|
124
|
+
functions: false,
|
|
125
|
+
classes: false,
|
|
126
|
+
variables: false,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
'no-useless-computed-key': 'warn',
|
|
130
|
+
'no-useless-concat': 'warn',
|
|
131
|
+
'no-useless-constructor': 'warn',
|
|
132
|
+
'no-useless-escape': 'warn',
|
|
133
|
+
'no-useless-rename': [
|
|
134
|
+
'warn',
|
|
135
|
+
{
|
|
136
|
+
ignoreDestructuring: false,
|
|
137
|
+
ignoreImport: false,
|
|
138
|
+
ignoreExport: false,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
'no-with': 'warn',
|
|
142
|
+
'no-whitespace-before-property': 'warn',
|
|
143
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
144
|
+
'require-yield': 'warn',
|
|
145
|
+
'rest-spread-spacing': ['warn', 'never'],
|
|
146
|
+
strict: ['warn', 'never'],
|
|
147
|
+
'unicode-bom': ['warn', 'never'],
|
|
148
|
+
'use-isnan': 'warn',
|
|
149
|
+
'valid-typeof': 'warn',
|
|
150
|
+
'no-restricted-properties': [
|
|
151
|
+
'error',
|
|
152
|
+
{
|
|
153
|
+
object: 'require',
|
|
154
|
+
property: 'ensure',
|
|
155
|
+
message:
|
|
156
|
+
'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
object: 'System',
|
|
160
|
+
property: 'import',
|
|
161
|
+
message:
|
|
162
|
+
'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
'getter-return': 'warn',
|
|
166
|
+
|
|
167
|
+
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
|
|
168
|
+
'import/first': 'error',
|
|
169
|
+
'import/no-amd': 'error',
|
|
170
|
+
'import/no-anonymous-default-export': 'warn',
|
|
171
|
+
'import/no-webpack-loader-syntax': 'error',
|
|
172
|
+
|
|
173
|
+
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
|
|
174
|
+
'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
|
|
175
|
+
'react/jsx-no-comment-textnodes': 'warn',
|
|
176
|
+
'react/jsx-no-duplicate-props': 'warn',
|
|
177
|
+
'react/jsx-no-target-blank': 'warn',
|
|
178
|
+
'react/jsx-no-undef': 'error',
|
|
179
|
+
'react/jsx-pascal-case': [
|
|
180
|
+
'warn',
|
|
181
|
+
{
|
|
182
|
+
allowAllCaps: true,
|
|
183
|
+
ignore: [],
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
'react/no-danger-with-children': 'warn',
|
|
187
|
+
// Disabled because of undesirable warnings
|
|
188
|
+
// See https://github.com/facebook/create-react-app/issues/5204 for
|
|
189
|
+
// blockers until its re-enabled
|
|
190
|
+
// 'react/no-deprecated': 'warn',
|
|
191
|
+
'react/no-direct-mutation-state': 'warn',
|
|
192
|
+
'react/no-is-mounted': 'warn',
|
|
193
|
+
'react/no-typos': 'error',
|
|
194
|
+
'react/require-render-return': 'error',
|
|
195
|
+
'react/style-prop-object': 'warn',
|
|
196
|
+
|
|
197
|
+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
|
|
198
|
+
'jsx-a11y/alt-text': 'warn',
|
|
199
|
+
'jsx-a11y/anchor-has-content': 'warn',
|
|
200
|
+
'jsx-a11y/anchor-is-valid': [
|
|
201
|
+
'warn',
|
|
202
|
+
{
|
|
203
|
+
aspects: ['noHref', 'invalidHref'],
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
|
|
207
|
+
'jsx-a11y/aria-props': 'warn',
|
|
208
|
+
'jsx-a11y/aria-proptypes': 'warn',
|
|
209
|
+
'jsx-a11y/aria-role': ['warn', { ignoreNonDOM: true }],
|
|
210
|
+
'jsx-a11y/aria-unsupported-elements': 'warn',
|
|
211
|
+
'jsx-a11y/heading-has-content': 'warn',
|
|
212
|
+
'jsx-a11y/iframe-has-title': 'warn',
|
|
213
|
+
'jsx-a11y/img-redundant-alt': 'warn',
|
|
214
|
+
'jsx-a11y/no-access-key': 'warn',
|
|
215
|
+
'jsx-a11y/no-distracting-elements': 'warn',
|
|
216
|
+
'jsx-a11y/no-redundant-roles': 'warn',
|
|
217
|
+
'jsx-a11y/role-has-required-aria-props': 'warn',
|
|
218
|
+
'jsx-a11y/role-supports-aria-props': 'warn',
|
|
219
|
+
'jsx-a11y/scope': 'warn',
|
|
220
|
+
|
|
221
|
+
// https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks
|
|
222
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
223
|
+
},
|
|
224
|
+
overrides: [
|
|
225
|
+
{
|
|
226
|
+
files: ['**/*.stories.*'],
|
|
227
|
+
rules: {
|
|
228
|
+
'import/no-anonymous-default-export': 'off',
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
// https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/jest.js
|
|
233
|
+
{
|
|
234
|
+
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
|
|
235
|
+
env: {
|
|
236
|
+
'jest/globals': true,
|
|
237
|
+
},
|
|
238
|
+
// A subset of the recommended rules:
|
|
239
|
+
rules: {
|
|
240
|
+
// https://github.com/jest-community/eslint-plugin-jest
|
|
241
|
+
'jest/no-conditional-expect': 'error',
|
|
242
|
+
'jest/no-identical-title': 'error',
|
|
243
|
+
'jest/no-interpolation-in-snapshots': 'error',
|
|
244
|
+
'jest/no-jasmine-globals': 'error',
|
|
245
|
+
'jest/no-mocks-import': 'error',
|
|
246
|
+
'jest/valid-describe-callback': 'error',
|
|
247
|
+
'jest/valid-expect': 'error',
|
|
248
|
+
'jest/valid-expect-in-promise': 'error',
|
|
249
|
+
'jest/valid-title': 'warn',
|
|
250
|
+
|
|
251
|
+
// https://github.com/testing-library/eslint-plugin-testing-library
|
|
252
|
+
'testing-library/await-async-query': 'error',
|
|
253
|
+
'testing-library/await-async-utils': 'error',
|
|
254
|
+
'testing-library/no-await-sync-query': 'error',
|
|
255
|
+
'testing-library/no-container': 'error',
|
|
256
|
+
'testing-library/no-debugging-utils': 'error',
|
|
257
|
+
'testing-library/no-dom-import': ['error', 'react'],
|
|
258
|
+
'testing-library/no-node-access': 'error',
|
|
259
|
+
'testing-library/no-promise-in-fire-event': 'error',
|
|
260
|
+
'testing-library/no-render-in-setup': 'error',
|
|
261
|
+
'testing-library/no-unnecessary-act': 'error',
|
|
262
|
+
'testing-library/no-wait-for-empty-callback': 'error',
|
|
263
|
+
'testing-library/no-wait-for-multiple-assertions': 'error',
|
|
264
|
+
'testing-library/no-wait-for-side-effects': 'error',
|
|
265
|
+
'testing-library/no-wait-for-snapshot': 'error',
|
|
266
|
+
'testing-library/prefer-find-by': 'error',
|
|
267
|
+
'testing-library/prefer-presence-queries': 'error',
|
|
268
|
+
'testing-library/prefer-query-by-disappearance': 'error',
|
|
269
|
+
'testing-library/prefer-screen-queries': 'error',
|
|
270
|
+
'testing-library/render-result-naming-convention': 'error',
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
// https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/index.js
|
|
275
|
+
{
|
|
276
|
+
files: ['**/*.ts?(x)'],
|
|
277
|
+
// parser: "@typescript-eslint/parser",
|
|
278
|
+
// parserOptions: {
|
|
279
|
+
// ecmaVersion: 2018,
|
|
280
|
+
// sourceType: "module",
|
|
281
|
+
// ecmaFeatures: {
|
|
282
|
+
// jsx: true,
|
|
283
|
+
// },
|
|
284
|
+
|
|
285
|
+
// // typescript-eslint specific options
|
|
286
|
+
// warnOnUnsupportedTypeScriptVersion: true,
|
|
287
|
+
// },
|
|
288
|
+
// plugins: ["@typescript-eslint"],
|
|
289
|
+
// If adding a typescript-eslint version of an existing ESLint rule,
|
|
290
|
+
// make sure to disable the ESLint rule here.
|
|
291
|
+
rules: {
|
|
292
|
+
// TypeScript's `noFallthroughCasesInSwitch` option is more robust (#6906)
|
|
293
|
+
'default-case': 'off',
|
|
294
|
+
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)
|
|
295
|
+
'no-dupe-class-members': 'off',
|
|
296
|
+
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
|
|
297
|
+
'no-undef': 'off',
|
|
298
|
+
|
|
299
|
+
// Add TypeScript specific rules (and turn off ESLint equivalents)
|
|
300
|
+
'@typescript-eslint/consistent-type-assertions': 'warn',
|
|
301
|
+
'no-array-constructor': 'off',
|
|
302
|
+
'@typescript-eslint/no-array-constructor': 'warn',
|
|
303
|
+
'no-redeclare': 'off',
|
|
304
|
+
'@typescript-eslint/no-redeclare': 'warn',
|
|
305
|
+
'no-use-before-define': 'off',
|
|
306
|
+
'@typescript-eslint/no-use-before-define': [
|
|
307
|
+
'warn',
|
|
308
|
+
{
|
|
309
|
+
functions: false,
|
|
310
|
+
classes: false,
|
|
311
|
+
variables: false,
|
|
312
|
+
typedefs: false,
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
'no-unused-expressions': 'off',
|
|
316
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
317
|
+
'error',
|
|
318
|
+
{
|
|
319
|
+
allowShortCircuit: true,
|
|
320
|
+
allowTernary: true,
|
|
321
|
+
allowTaggedTemplates: true,
|
|
322
|
+
},
|
|
323
|
+
],
|
|
324
|
+
'no-unused-vars': 'off',
|
|
325
|
+
'@typescript-eslint/no-unused-vars': [
|
|
326
|
+
'warn',
|
|
327
|
+
{
|
|
328
|
+
args: 'none',
|
|
329
|
+
ignoreRestSiblings: true,
|
|
330
|
+
},
|
|
331
|
+
],
|
|
332
|
+
'no-useless-constructor': 'off',
|
|
333
|
+
'@typescript-eslint/no-useless-constructor': 'warn',
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
],
|
|
337
|
+
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morgs32/eslint-config",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": ".eslintrc.js",
|
|
6
6
|
"files": [
|
|
7
|
-
"
|
|
7
|
+
"*.eslintrc.js"
|
|
8
8
|
],
|
|
9
|
-
"scripts": {
|
|
10
|
-
"lint": "eslint ."
|
|
11
|
-
},
|
|
12
9
|
"repository": {
|
|
13
10
|
"type": "git",
|
|
14
11
|
"url": "git+https://github.com/morgs32/eslint-config.git"
|
|
@@ -22,7 +19,9 @@
|
|
|
22
19
|
"dependencies": {
|
|
23
20
|
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
|
24
21
|
"eslint-config-next": "^13.4.12",
|
|
22
|
+
"eslint-config-prettier": "^8.10.0",
|
|
25
23
|
"eslint-plugin-jest": "^27.2.3",
|
|
24
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
26
25
|
"eslint-plugin-react": "^7.33.1",
|
|
27
26
|
"eslint-plugin-testing-library": "^5.11.0",
|
|
28
27
|
"eslint-plugin-unused-imports": "^3.0.0"
|
|
@@ -39,5 +38,8 @@
|
|
|
39
38
|
"next": "^13.4.12",
|
|
40
39
|
"react": "^18.2.0",
|
|
41
40
|
"typescript": "^5.1.6"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"lint": "eslint ."
|
|
42
44
|
}
|
|
43
|
-
}
|
|
45
|
+
}
|