eslint-config-jc 4.1.0 → 4.2.0
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/index.js +5 -0
- package/package.json +4 -1
- package/rules/jsx.js +167 -35
- package/rules/node.js +84 -0
- package/rules/react-class-comps.js +41 -0
- package/rules/react-prop-types.js +21 -0
- package/rules/react.js +41 -84
- package/rules/regex.js +1 -3
package/index.js
CHANGED
|
@@ -8,5 +8,10 @@ module.exports = {
|
|
|
8
8
|
"./rules/import.js",
|
|
9
9
|
"./rules/react.js",
|
|
10
10
|
"./rules/jsx.js",
|
|
11
|
+
// Not included by default:
|
|
12
|
+
// "./rules/typescript-typecheck.js",
|
|
13
|
+
// "./rules/node.js",
|
|
14
|
+
// "./rules/react-class-comps.js",
|
|
15
|
+
// "./rules/react-prop-types.js",
|
|
11
16
|
],
|
|
12
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-jc",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Josh-Cena's personal coding style",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -27,8 +27,11 @@
|
|
|
27
27
|
"./base": "./rules/base.js",
|
|
28
28
|
"./regex": "./rules/regex.js",
|
|
29
29
|
"./import": "./rules/import.js",
|
|
30
|
+
"./node": "./rules/node.js",
|
|
30
31
|
"./jsx": "./rules/jsx.js",
|
|
31
32
|
"./react": "./rules/react.js",
|
|
33
|
+
"./react-class-comps": "./rules/react-class-comps.js",
|
|
34
|
+
"./react-prop-types": "./rules/react-prop-types.js",
|
|
32
35
|
"./typescript": "./rules/typescript.js",
|
|
33
36
|
"./typescript-typecheck": "./rules/typescript-typecheck.js"
|
|
34
37
|
},
|
package/rules/jsx.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
plugins: ["jsx-a11y"],
|
|
2
|
+
plugins: ["jsx-a11y", "react"],
|
|
3
3
|
rules: {
|
|
4
4
|
// JSX a11y rules are taken from airbnb, not adjusted yet
|
|
5
5
|
"jsx-a11y/alt-text": [
|
|
@@ -13,7 +13,22 @@ module.exports = {
|
|
|
13
13
|
},
|
|
14
14
|
],
|
|
15
15
|
|
|
16
|
-
"jsx-a11y/anchor-
|
|
16
|
+
"jsx-a11y/anchor-ambiguous-text": [
|
|
17
|
+
"warn",
|
|
18
|
+
{
|
|
19
|
+
// Default
|
|
20
|
+
words: ["click here", "here", "link", "a link", "learn more"],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
|
|
24
|
+
"jsx-a11y/anchor-has-content": [
|
|
25
|
+
"error",
|
|
26
|
+
{
|
|
27
|
+
aspects: ["noHref", "invalidHref", "preferButton"],
|
|
28
|
+
components: ["Link"],
|
|
29
|
+
specialLink: ["to"],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
17
32
|
|
|
18
33
|
"jsx-a11y/anchor-is-valid": [
|
|
19
34
|
"error",
|
|
@@ -34,12 +49,7 @@ module.exports = {
|
|
|
34
49
|
|
|
35
50
|
"jsx-a11y/aria-unsupported-elements": "error",
|
|
36
51
|
|
|
37
|
-
"jsx-a11y/autocomplete-valid": [
|
|
38
|
-
"off",
|
|
39
|
-
{
|
|
40
|
-
inputComponents: [],
|
|
41
|
-
},
|
|
42
|
-
],
|
|
52
|
+
"jsx-a11y/autocomplete-valid": ["off", { inputComponents: [] }],
|
|
43
53
|
|
|
44
54
|
"jsx-a11y/click-events-have-key-events": "error",
|
|
45
55
|
|
|
@@ -73,7 +83,7 @@ module.exports = {
|
|
|
73
83
|
},
|
|
74
84
|
],
|
|
75
85
|
|
|
76
|
-
"jsx-a11y/heading-has-content": ["error", { components: [
|
|
86
|
+
"jsx-a11y/heading-has-content": ["error", { components: [] }],
|
|
77
87
|
|
|
78
88
|
"jsx-a11y/html-has-lang": "error",
|
|
79
89
|
|
|
@@ -81,7 +91,20 @@ module.exports = {
|
|
|
81
91
|
|
|
82
92
|
"jsx-a11y/img-redundant-alt": "error",
|
|
83
93
|
|
|
84
|
-
"jsx-a11y/interactive-supports-focus":
|
|
94
|
+
"jsx-a11y/interactive-supports-focus": [
|
|
95
|
+
"error",
|
|
96
|
+
{
|
|
97
|
+
tabbable: [
|
|
98
|
+
"button",
|
|
99
|
+
"checkbox",
|
|
100
|
+
"link",
|
|
101
|
+
"searchbox",
|
|
102
|
+
"spinbutton",
|
|
103
|
+
"switch",
|
|
104
|
+
"textbox",
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
85
108
|
|
|
86
109
|
"jsx-a11y/label-has-associated-control": [
|
|
87
110
|
"error",
|
|
@@ -105,24 +128,38 @@ module.exports = {
|
|
|
105
128
|
},
|
|
106
129
|
],
|
|
107
130
|
|
|
108
|
-
"jsx-a11y/mouse-events-have-key-events":
|
|
131
|
+
"jsx-a11y/mouse-events-have-key-events": [
|
|
132
|
+
"error",
|
|
133
|
+
{
|
|
134
|
+
hoverInHandlers: [
|
|
135
|
+
"onMouseOver",
|
|
136
|
+
"onMouseEnter",
|
|
137
|
+
"onPointerOver",
|
|
138
|
+
"onPointerEnter",
|
|
139
|
+
],
|
|
140
|
+
hoverOutHandlers: [
|
|
141
|
+
"onMouseOut",
|
|
142
|
+
"onMouseLeave",
|
|
143
|
+
"onPointerOut",
|
|
144
|
+
"onPointerLeave",
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
],
|
|
109
148
|
|
|
110
149
|
"jsx-a11y/no-access-key": "error",
|
|
111
150
|
|
|
112
|
-
"jsx-a11y/no-
|
|
151
|
+
"jsx-a11y/no-aria-hidden-on-focusable": "error",
|
|
152
|
+
|
|
153
|
+
"jsx-a11y/no-autofocus": ["error", { ignoreNonDOM: false }],
|
|
113
154
|
|
|
114
155
|
"jsx-a11y/no-distracting-elements": [
|
|
115
156
|
"error",
|
|
116
|
-
{
|
|
117
|
-
elements: ["marquee", "blink"],
|
|
118
|
-
},
|
|
157
|
+
{ elements: ["marquee", "blink"] },
|
|
119
158
|
],
|
|
120
159
|
|
|
121
160
|
"jsx-a11y/no-interactive-element-to-noninteractive-role": [
|
|
122
161
|
"error",
|
|
123
|
-
{
|
|
124
|
-
tr: ["none", "presentation"],
|
|
125
|
-
},
|
|
162
|
+
{ tr: ["none", "presentation"] },
|
|
126
163
|
],
|
|
127
164
|
|
|
128
165
|
"jsx-a11y/no-noninteractive-element-interactions": [
|
|
@@ -169,6 +206,7 @@ module.exports = {
|
|
|
169
206
|
"jsx-a11y/no-noninteractive-tabindex": [
|
|
170
207
|
"error",
|
|
171
208
|
{
|
|
209
|
+
allowExpressionValues: true,
|
|
172
210
|
roles: ["tabpanel"],
|
|
173
211
|
tags: [],
|
|
174
212
|
},
|
|
@@ -176,11 +214,17 @@ module.exports = {
|
|
|
176
214
|
|
|
177
215
|
"jsx-a11y/no-onchange": "off",
|
|
178
216
|
|
|
179
|
-
"jsx-a11y/no-redundant-roles":
|
|
217
|
+
"jsx-a11y/no-redundant-roles": [
|
|
218
|
+
"error",
|
|
219
|
+
{
|
|
220
|
+
nav: ["navigation"],
|
|
221
|
+
},
|
|
222
|
+
],
|
|
180
223
|
|
|
181
224
|
"jsx-a11y/no-static-element-interactions": [
|
|
182
225
|
"error",
|
|
183
226
|
{
|
|
227
|
+
allowExpressionValues: true,
|
|
184
228
|
handlers: [
|
|
185
229
|
"onClick",
|
|
186
230
|
"onMouseDown",
|
|
@@ -192,6 +236,8 @@ module.exports = {
|
|
|
192
236
|
},
|
|
193
237
|
],
|
|
194
238
|
|
|
239
|
+
"jsx-a11y/prefer-tag-over-role": "error",
|
|
240
|
+
|
|
195
241
|
"jsx-a11y/role-has-required-aria-props": "error",
|
|
196
242
|
|
|
197
243
|
"jsx-a11y/role-supports-aria-props": "error",
|
|
@@ -200,29 +246,69 @@ module.exports = {
|
|
|
200
246
|
|
|
201
247
|
"jsx-a11y/tabindex-no-positive": "error",
|
|
202
248
|
|
|
249
|
+
"react/button-has-type": [
|
|
250
|
+
"error",
|
|
251
|
+
{
|
|
252
|
+
button: true,
|
|
253
|
+
reset: false, // MDN: This behavior tends to annoy users
|
|
254
|
+
submit: true,
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
|
|
258
|
+
"react/iframe-missing-sandbox": "error",
|
|
259
|
+
|
|
203
260
|
"react/jsx-boolean-value": ["error", "never"],
|
|
204
261
|
|
|
205
|
-
"react/jsx-
|
|
262
|
+
"react/jsx-child-element-spacing": "warn",
|
|
263
|
+
|
|
264
|
+
// Formatting
|
|
265
|
+
"react/jsx-closing-bracket-location": "off",
|
|
266
|
+
|
|
267
|
+
// Formatting
|
|
268
|
+
"react/jsx-closing-tag-location": "off",
|
|
269
|
+
|
|
270
|
+
"react/jsx-curly-brace-presence": [
|
|
271
|
+
"error",
|
|
272
|
+
// Maybe one day we can use propElementValues: "never"...
|
|
273
|
+
{ children: "never", propElementValues: "ignore", props: "never" },
|
|
274
|
+
],
|
|
275
|
+
|
|
276
|
+
// Formatting
|
|
277
|
+
"react/jsx-curly-newline": "off",
|
|
278
|
+
|
|
279
|
+
// Formatting
|
|
280
|
+
"react/jsx-curly-spacing": "off",
|
|
206
281
|
|
|
207
|
-
//
|
|
282
|
+
// Formatting
|
|
283
|
+
"react/jsx-equals-spacing": "off",
|
|
284
|
+
|
|
285
|
+
// .js, .jsx, .tsx are all acceptable
|
|
208
286
|
"react/jsx-filename-extension": "off",
|
|
209
287
|
|
|
210
|
-
|
|
288
|
+
// Formatting
|
|
289
|
+
"react/jsx-first-prop-new-line": "off",
|
|
211
290
|
|
|
291
|
+
// Too stylistic
|
|
212
292
|
"react/jsx-handler-names": "off",
|
|
213
293
|
|
|
214
|
-
//
|
|
215
|
-
"react/jsx-
|
|
294
|
+
// Formatting
|
|
295
|
+
"react/jsx-indent": "off",
|
|
296
|
+
|
|
297
|
+
// Formatting
|
|
298
|
+
"react/jsx-indent-props": "off",
|
|
216
299
|
|
|
300
|
+
// Too stylistic
|
|
217
301
|
"react/jsx-max-depth": "off",
|
|
218
302
|
|
|
219
|
-
|
|
303
|
+
// Formatting
|
|
304
|
+
"react/jsx-max-props-per-line": "off",
|
|
220
305
|
|
|
221
|
-
|
|
306
|
+
// Formatting
|
|
307
|
+
"react/jsx-newline": "off",
|
|
222
308
|
|
|
223
|
-
"react/jsx-no-
|
|
309
|
+
"react/jsx-no-comment-textnodes": "error",
|
|
224
310
|
|
|
225
|
-
"react/jsx-no-duplicate-props": "error",
|
|
311
|
+
"react/jsx-no-duplicate-props": ["error", { ignoreCase: false }],
|
|
226
312
|
|
|
227
313
|
// We'll use strict-boolean-expressions instead
|
|
228
314
|
"react/jsx-no-leaked-render": "off",
|
|
@@ -231,23 +317,69 @@ module.exports = {
|
|
|
231
317
|
|
|
232
318
|
"react/jsx-no-script-url": "error",
|
|
233
319
|
|
|
234
|
-
"react/jsx-no-target-blank":
|
|
320
|
+
"react/jsx-no-target-blank": [
|
|
321
|
+
"error",
|
|
322
|
+
{
|
|
323
|
+
allowReferrer: false,
|
|
324
|
+
enforceDynamicLinks: "always",
|
|
325
|
+
forms: true,
|
|
326
|
+
links: true,
|
|
327
|
+
warnOnSpreadAttributes: true,
|
|
328
|
+
},
|
|
329
|
+
],
|
|
235
330
|
|
|
236
331
|
// Also checked by TypeScript
|
|
237
|
-
"react/jsx-no-undef": "error",
|
|
332
|
+
"react/jsx-no-undef": ["error", { allowGlobals: true }],
|
|
238
333
|
|
|
239
334
|
"react/jsx-no-useless-fragment": ["error", { allowExpressions: true }],
|
|
240
335
|
|
|
241
|
-
|
|
336
|
+
// Formatting
|
|
337
|
+
"react/jsx-one-expression-per-line": "off",
|
|
242
338
|
|
|
243
|
-
"react/jsx-
|
|
339
|
+
"react/jsx-pascal-case": [
|
|
340
|
+
"error",
|
|
341
|
+
{
|
|
342
|
+
allowAllCaps: true,
|
|
343
|
+
allowLeadingUnderscore: false,
|
|
344
|
+
allowNamespace: true,
|
|
345
|
+
},
|
|
346
|
+
],
|
|
244
347
|
|
|
245
|
-
|
|
348
|
+
// Formatting
|
|
349
|
+
"react/jsx-props-no-multi-spaces": "off",
|
|
246
350
|
|
|
247
|
-
|
|
351
|
+
// We like spreading
|
|
352
|
+
"react/jsx-props-no-spreading": "off",
|
|
248
353
|
|
|
249
|
-
"react/jsx-
|
|
354
|
+
"react/jsx-sort-props": 0,
|
|
355
|
+
|
|
356
|
+
// Formatting
|
|
357
|
+
"react/jsx-tag-spacing": "off",
|
|
250
358
|
|
|
251
359
|
"react/jsx-uses-vars": "warn",
|
|
360
|
+
|
|
361
|
+
// Formatting
|
|
362
|
+
"react/jsx-wrap-multilines": "off",
|
|
363
|
+
|
|
364
|
+
// Too stylistic
|
|
365
|
+
"react/no-adjacent-inline-elements": "off",
|
|
366
|
+
|
|
367
|
+
"react/no-children-prop": ["error", { allowFunctions: false }],
|
|
368
|
+
|
|
369
|
+
"react/no-invalid-html-attribute": "error",
|
|
370
|
+
|
|
371
|
+
// The original text allows for things like spellchecking and searching
|
|
372
|
+
"react/no-unescaped-entities": "off",
|
|
373
|
+
|
|
374
|
+
"react/no-unknown-property": [
|
|
375
|
+
"error",
|
|
376
|
+
{
|
|
377
|
+
// TODO: not released: requireDataLowercase: true,
|
|
378
|
+
},
|
|
379
|
+
],
|
|
380
|
+
|
|
381
|
+
"react/self-closing-comp": ["error", { component: true, html: true }],
|
|
382
|
+
|
|
383
|
+
"react/void-dom-elements-no-children": "error",
|
|
252
384
|
},
|
|
253
385
|
};
|
package/rules/node.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: ["n"],
|
|
3
|
+
rules: {
|
|
4
|
+
// Callback-related
|
|
5
|
+
"n/callback-return": "off",
|
|
6
|
+
|
|
7
|
+
"n/exports-style": ["error", "module.exports", { allowBatchAssign: false }],
|
|
8
|
+
|
|
9
|
+
// Checked by TypeScript
|
|
10
|
+
"n/file-extension-in-import": "off",
|
|
11
|
+
|
|
12
|
+
// On-demand loading is useful
|
|
13
|
+
"n/global-require": "off",
|
|
14
|
+
|
|
15
|
+
// Callback-related
|
|
16
|
+
"n/handle-callback-err": "off",
|
|
17
|
+
|
|
18
|
+
// Callback-related
|
|
19
|
+
"n/no-callback-literal": "off",
|
|
20
|
+
|
|
21
|
+
"n/no-deprecated-api": "error",
|
|
22
|
+
|
|
23
|
+
"n/no-exports-assign": "error",
|
|
24
|
+
|
|
25
|
+
// Shadowed by import/no-extraneous-dependencies
|
|
26
|
+
"n/no-extraneous-import": "off",
|
|
27
|
+
|
|
28
|
+
// Shadowed by import/no-extraneous-dependencies
|
|
29
|
+
"n/no-extraneous-require": "off",
|
|
30
|
+
|
|
31
|
+
// Checked by TypeScript
|
|
32
|
+
"n/no-missing-import": "off",
|
|
33
|
+
|
|
34
|
+
// Checked by TypeScript
|
|
35
|
+
"n/no-missing-require": "off",
|
|
36
|
+
|
|
37
|
+
// Not helpful
|
|
38
|
+
"n/no-mixed-requires": "off",
|
|
39
|
+
|
|
40
|
+
"n/no-new-require": "error",
|
|
41
|
+
|
|
42
|
+
"n/no-path-concat": "warn",
|
|
43
|
+
|
|
44
|
+
"n/no-process-env": "off",
|
|
45
|
+
|
|
46
|
+
// Useful in theory, but too noisy
|
|
47
|
+
"n/no-process-exit": "off",
|
|
48
|
+
|
|
49
|
+
"n/no-restricted-import": "off",
|
|
50
|
+
|
|
51
|
+
"n/no-restricted-require": "off",
|
|
52
|
+
|
|
53
|
+
"n/no-sync": ["warn", { allowAtRootLevel: false }],
|
|
54
|
+
|
|
55
|
+
"n/no-unpublished-bin": "error",
|
|
56
|
+
|
|
57
|
+
"n/no-unpublished-import": "off",
|
|
58
|
+
|
|
59
|
+
"n/no-unpublished-require": "off",
|
|
60
|
+
|
|
61
|
+
"n/prefer-global/buffer": ["error", "always"],
|
|
62
|
+
|
|
63
|
+
"n/prefer-global/console": ["error", "always"],
|
|
64
|
+
|
|
65
|
+
"n/prefer-global/process": ["error", "always"],
|
|
66
|
+
|
|
67
|
+
"n/prefer-global/text-decoder": ["error", "always"],
|
|
68
|
+
|
|
69
|
+
"n/prefer-global/text-encoder": ["error", "always"],
|
|
70
|
+
|
|
71
|
+
"n/prefer-global/url": ["error", "always"],
|
|
72
|
+
|
|
73
|
+
"n/prefer-global/url-search-params": ["error", "always"],
|
|
74
|
+
|
|
75
|
+
"n/prefer-promises/dns": "error",
|
|
76
|
+
|
|
77
|
+
"n/prefer-promises/fs": "error",
|
|
78
|
+
|
|
79
|
+
"n/process-exit-as-throw": "warn",
|
|
80
|
+
|
|
81
|
+
// Errors on TypeScript bin
|
|
82
|
+
"n/shebang": "off",
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
rules: {
|
|
3
|
+
"react/no-access-state-in-setstate": "error",
|
|
4
|
+
|
|
5
|
+
"react/no-arrow-function-lifecycle": "error",
|
|
6
|
+
|
|
7
|
+
"react/no-did-mount-set-state": "error",
|
|
8
|
+
|
|
9
|
+
"react/no-did-update-set-state": "error",
|
|
10
|
+
|
|
11
|
+
"react/no-direct-mutation-state": "error",
|
|
12
|
+
|
|
13
|
+
"react/no-redundant-should-component-update": "error",
|
|
14
|
+
|
|
15
|
+
// ???
|
|
16
|
+
"react/no-set-state": "off",
|
|
17
|
+
|
|
18
|
+
"react/no-unsafe": "error",
|
|
19
|
+
|
|
20
|
+
"react/no-unused-class-component-methods": "error",
|
|
21
|
+
|
|
22
|
+
"react/no-unused-state": "error",
|
|
23
|
+
|
|
24
|
+
"react/no-will-update-set-state": "error",
|
|
25
|
+
|
|
26
|
+
"react/prefer-es6-class": "error",
|
|
27
|
+
|
|
28
|
+
"react/prefer-stateless-function": "error",
|
|
29
|
+
|
|
30
|
+
// We mostly use function components, and this optimization is not critical
|
|
31
|
+
"react/require-optimization": "off",
|
|
32
|
+
|
|
33
|
+
"react/require-render-return": "error",
|
|
34
|
+
|
|
35
|
+
"react/sort-comp": 0,
|
|
36
|
+
|
|
37
|
+
"react/state-in-constructor": ["error", "never"],
|
|
38
|
+
|
|
39
|
+
"react/static-property-placement": ["error", "static public field"],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
rules: {
|
|
3
|
+
"react/default-props-match-prop-types": "off",
|
|
4
|
+
|
|
5
|
+
"react/forbid-foreign-prop-types": "off",
|
|
6
|
+
|
|
7
|
+
"react/forbid-prop-types": "off",
|
|
8
|
+
|
|
9
|
+
"react/no-unused-prop-types": "off",
|
|
10
|
+
|
|
11
|
+
"react/prefer-exact-props": "off",
|
|
12
|
+
|
|
13
|
+
"react/prop-types": "off",
|
|
14
|
+
|
|
15
|
+
"react/require-default-props": "off",
|
|
16
|
+
|
|
17
|
+
"react/sort-default-props": "off",
|
|
18
|
+
|
|
19
|
+
"react/sort-prop-types": "off",
|
|
20
|
+
},
|
|
21
|
+
};
|
package/rules/react.js
CHANGED
|
@@ -12,29 +12,17 @@ module.exports = {
|
|
|
12
12
|
|
|
13
13
|
"react/boolean-prop-naming": "off",
|
|
14
14
|
|
|
15
|
-
"react/button-has-type": [
|
|
16
|
-
"error",
|
|
17
|
-
{
|
|
18
|
-
button: true,
|
|
19
|
-
reset: false, // MDN: This behavior tends to annoy users
|
|
20
|
-
submit: true,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
|
|
24
|
-
// Checked by TypeScript
|
|
25
|
-
"react/default-props-match-prop-types": "off",
|
|
26
|
-
|
|
27
15
|
// Sometimes we do need `props` as a whole, e.g. for spreading
|
|
28
16
|
"react/destructuring-assignment": "off",
|
|
29
17
|
|
|
30
18
|
// Isn't useful
|
|
31
|
-
"react/display-name":
|
|
19
|
+
"react/display-name": "off",
|
|
20
|
+
|
|
21
|
+
"react/forbid-component-props": 0,
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
"react/forbid-foreign-prop-types": "error",
|
|
23
|
+
"react/forbid-dom-props": 0,
|
|
35
24
|
|
|
36
|
-
|
|
37
|
-
"react/forbid-prop-types": "off",
|
|
25
|
+
"react/forbid-elements": 0,
|
|
38
26
|
|
|
39
27
|
// Note that it false-positives for `const Foo: Comp = () => <></>`
|
|
40
28
|
"react/function-component-definition": [
|
|
@@ -45,23 +33,40 @@ module.exports = {
|
|
|
45
33
|
},
|
|
46
34
|
],
|
|
47
35
|
|
|
48
|
-
|
|
49
|
-
// 'react/hook-use-state': 'warn',
|
|
36
|
+
"react/hook-use-state": ["error", { allowDestructuredState: true }],
|
|
50
37
|
|
|
51
|
-
|
|
38
|
+
"react/jsx-fragments": ["error", "syntax"],
|
|
52
39
|
|
|
53
|
-
//
|
|
54
|
-
|
|
40
|
+
// There can be false positives, such as an array that's not used as a
|
|
41
|
+
// single child
|
|
42
|
+
"react/jsx-key": [
|
|
43
|
+
"error",
|
|
44
|
+
{
|
|
45
|
+
checkFragmentShorthand: true,
|
|
46
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/issues/2830
|
|
47
|
+
checkKeyMustBeforeSpread: true,
|
|
48
|
+
warnOnDuplicates: true,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
55
51
|
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
"react/jsx-no-bind": [
|
|
53
|
+
"warn",
|
|
54
|
+
{
|
|
55
|
+
allowArrowFunctions: false,
|
|
56
|
+
allowBind: false,
|
|
57
|
+
allowFunctions: false,
|
|
58
|
+
ignoreDOMComponents: true,
|
|
59
|
+
ignoreRefs: true,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
"react/no-array-index-key": "error",
|
|
63
|
+
"react/jsx-no-constructed-context-values": "error",
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
// We usually use automatic runtime
|
|
66
|
+
"react/jsx-uses-react": 0,
|
|
63
67
|
|
|
64
|
-
|
|
68
|
+
// In some cases this is fine (e.g. static websites)
|
|
69
|
+
"react/no-array-index-key": "warn",
|
|
65
70
|
|
|
66
71
|
"react/no-danger": "warn",
|
|
67
72
|
|
|
@@ -69,16 +74,10 @@ module.exports = {
|
|
|
69
74
|
|
|
70
75
|
"react/no-deprecated": "error",
|
|
71
76
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"react/no-did-update-set-state": "error",
|
|
75
|
-
|
|
76
|
-
"react/no-direct-mutation-state": "error",
|
|
77
|
-
|
|
77
|
+
// Deprecated API
|
|
78
78
|
"react/no-find-dom-node": "error",
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
// Deprecated API
|
|
82
81
|
"react/no-is-mounted": "error",
|
|
83
82
|
|
|
84
83
|
// It's useful for encapsulation.
|
|
@@ -86,77 +85,35 @@ module.exports = {
|
|
|
86
85
|
|
|
87
86
|
"react/no-namespace": "error",
|
|
88
87
|
|
|
89
|
-
"react/no-
|
|
88
|
+
"react/no-object-type-as-default-prop": "warn",
|
|
90
89
|
|
|
90
|
+
// ReactDOM.render itself is deprecated
|
|
91
91
|
"react/no-render-return-value": "error",
|
|
92
92
|
|
|
93
|
-
"react/no-
|
|
94
|
-
|
|
95
|
-
"react/no-string-refs": "error",
|
|
93
|
+
"react/no-string-refs": ["error", { noTemplateLiterals: true }],
|
|
96
94
|
|
|
97
95
|
"react/no-this-in-sfc": "error",
|
|
98
96
|
|
|
99
97
|
"react/no-typos": "error",
|
|
100
98
|
|
|
101
|
-
|
|
102
|
-
"react/no-unescaped-entities": "off",
|
|
103
|
-
|
|
104
|
-
"react/no-unknown-property": "error",
|
|
105
|
-
|
|
106
|
-
"react/no-unsafe": "error",
|
|
107
|
-
|
|
108
|
-
"react/no-unstable-nested-components": ["error", { allowAsProps: true }],
|
|
109
|
-
|
|
110
|
-
"react/no-unused-class-component-methods": "error",
|
|
111
|
-
|
|
112
|
-
// Checked by TypeScript
|
|
113
|
-
"react/no-unused-prop-types": "off",
|
|
114
|
-
|
|
115
|
-
"react/no-unused-state": "error",
|
|
116
|
-
|
|
117
|
-
"react/no-will-update-set-state": "error",
|
|
118
|
-
|
|
119
|
-
"react/prefer-es6-class": "error",
|
|
120
|
-
|
|
121
|
-
// Checked by TypeScript
|
|
122
|
-
"react/prefer-exact-props": "off",
|
|
99
|
+
"react/no-unstable-nested-components": ["warn", { allowAsProps: true }],
|
|
123
100
|
|
|
124
101
|
"react/prefer-read-only-props": "warn",
|
|
125
102
|
|
|
126
|
-
"react/prefer-stateless-function": "error",
|
|
127
|
-
|
|
128
|
-
// Checked by TypeScript
|
|
129
|
-
"react/prop-types": "off",
|
|
130
|
-
|
|
131
103
|
// Checked by TypeScript; we may also use JSX runtime
|
|
132
104
|
"react/react-in-jsx-scope": "off",
|
|
133
105
|
|
|
134
|
-
// Checked by TypeScript
|
|
135
|
-
"react/require-default-props": "off",
|
|
136
|
-
|
|
137
|
-
// We mostly use function components, and this optimization is not critical
|
|
138
|
-
"react/require-optimization": "off",
|
|
139
|
-
|
|
140
|
-
"react/require-render-return": "error",
|
|
141
|
-
|
|
142
|
-
"react/self-closing-comp": "error",
|
|
143
|
-
|
|
144
|
-
"react/sort-comp": "off",
|
|
145
|
-
|
|
146
|
-
"react/sort-prop-types": "off",
|
|
147
|
-
|
|
148
106
|
"react/state-in-constructor": "error",
|
|
149
107
|
|
|
150
108
|
"react/static-property-placement": "off",
|
|
151
109
|
|
|
110
|
+
// Also checked by TypeScript
|
|
152
111
|
"react/style-prop-object": "error",
|
|
153
|
-
|
|
154
|
-
"react/void-dom-elements-no-children": "error",
|
|
155
112
|
},
|
|
156
113
|
settings: {
|
|
157
114
|
react: {
|
|
158
115
|
pragma: "React",
|
|
159
|
-
version: "
|
|
116
|
+
version: "18",
|
|
160
117
|
},
|
|
161
118
|
},
|
|
162
119
|
};
|
package/rules/regex.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
plugins: ["regexp"],
|
|
3
3
|
rules: {
|
|
4
|
-
|
|
5
|
-
// even when T matches the empty string.
|
|
6
|
-
"regexp/confusing-quantifier": "off",
|
|
4
|
+
"regexp/confusing-quantifier": "error",
|
|
7
5
|
|
|
8
6
|
"regexp/control-character-escape": "error",
|
|
9
7
|
|