eslint-config-seekingalpha-react 7.49.0 → 9.0.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/CHANGELOG.md +8 -0
- package/README.md +15 -10
- package/index.js +13 -19
- package/package.json +2 -1
- package/rules/config.js +1 -1
- package/rules/eslint-plugin-jsx-a11y/index.js +5 -4
- package/rules/eslint-plugin-react/index.js +12 -3
- package/rules/eslint-plugin-react/jsx.js +239 -248
- package/rules/eslint-plugin-react/react.js +356 -358
- package/rules/eslint-plugin-react-hooks/index.js +5 -2
- package/prettier.js +0 -21
|
@@ -1,368 +1,366 @@
|
|
|
1
1
|
// https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
rules
|
|
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
|
-
allowedFor: ['Button', 'Icon', 'Link'],
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
|
|
63
|
-
/*
|
|
64
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-dom-props.md
|
|
65
|
-
* https://www.w3.org/TR/html5-diff/#obsolete-attributes
|
|
66
|
-
*/
|
|
67
|
-
'react/forbid-dom-props': [
|
|
68
|
-
'error',
|
|
69
|
-
{
|
|
70
|
-
forbid: [
|
|
71
|
-
'abbr',
|
|
72
|
-
'align',
|
|
73
|
-
'axis',
|
|
74
|
-
'bgcolor',
|
|
75
|
-
'border',
|
|
76
|
-
'cellpadding',
|
|
77
|
-
'cellspacing',
|
|
78
|
-
'char',
|
|
79
|
-
'charoff',
|
|
80
|
-
'charset',
|
|
81
|
-
'clear',
|
|
82
|
-
'coords',
|
|
83
|
-
'frame',
|
|
84
|
-
'frameborder',
|
|
85
|
-
'hspace',
|
|
86
|
-
'longdesc',
|
|
87
|
-
'marginheight',
|
|
88
|
-
'marginwidth',
|
|
89
|
-
'rev',
|
|
90
|
-
'scope',
|
|
91
|
-
'scrolling',
|
|
92
|
-
'shape',
|
|
93
|
-
'size',
|
|
94
|
-
'valign',
|
|
95
|
-
'vspace',
|
|
96
|
-
],
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
|
|
100
|
-
/*
|
|
101
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
|
|
102
|
-
* https://www.w3.org/TR/html5-diff/#obsolete-elements
|
|
103
|
-
*/
|
|
104
|
-
'react/forbid-elements': [
|
|
105
|
-
'error',
|
|
106
|
-
{
|
|
107
|
-
forbid: [
|
|
108
|
-
'acronym',
|
|
109
|
-
'applet',
|
|
110
|
-
'basefont',
|
|
111
|
-
'big',
|
|
112
|
-
'center',
|
|
113
|
-
'dir',
|
|
114
|
-
'font',
|
|
115
|
-
'frame',
|
|
116
|
-
'frameset',
|
|
117
|
-
'noframes',
|
|
118
|
-
'isindex',
|
|
119
|
-
'noframes',
|
|
120
|
-
's',
|
|
121
|
-
'strike',
|
|
122
|
-
'tt',
|
|
123
|
-
'u',
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
|
|
128
|
-
/*
|
|
129
|
-
* no prop types usage
|
|
130
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
|
|
131
|
-
*/
|
|
132
|
-
'react/forbid-foreign-prop-types': 'off',
|
|
133
|
-
|
|
134
|
-
/*
|
|
135
|
-
* no prop types usage
|
|
136
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
|
|
137
|
-
*/
|
|
138
|
-
'react/forbid-prop-types': 'off',
|
|
139
|
-
|
|
140
|
-
'react/forward-ref-uses-ref': 'error',
|
|
141
|
-
|
|
142
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
|
|
143
|
-
'react/function-component-definition': [
|
|
144
|
-
'error',
|
|
145
|
-
{
|
|
146
|
-
namedComponents: 'arrow-function',
|
|
147
|
-
unnamedComponents: 'arrow-function',
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
|
|
151
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
152
|
-
'react/hook-use-state': [
|
|
153
|
-
'error',
|
|
154
|
-
{
|
|
155
|
-
allowDestructuredState: true,
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
|
|
159
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md
|
|
160
|
-
'react/iframe-missing-sandbox': 'error',
|
|
161
|
-
|
|
162
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md
|
|
163
|
-
'react/no-access-state-in-setstate': 'error',
|
|
164
|
-
|
|
165
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md
|
|
166
|
-
'react/no-adjacent-inline-elements': 'error',
|
|
167
|
-
|
|
168
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
169
|
-
'react/no-array-index-key': 'error',
|
|
170
|
-
|
|
171
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-arrow-function-lifecycle.md
|
|
172
|
-
'react/no-arrow-function-lifecycle': 'error',
|
|
173
|
-
|
|
174
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
|
|
175
|
-
'react/no-children-prop': 'error',
|
|
176
|
-
|
|
177
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
|
|
178
|
-
'react/no-danger-with-children': 'error',
|
|
179
|
-
|
|
180
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
|
|
181
|
-
'react/no-deprecated': 'error',
|
|
182
|
-
|
|
183
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
|
|
184
|
-
'react/no-did-mount-set-state': 'off',
|
|
185
|
-
|
|
186
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
|
|
187
|
-
'react/no-did-update-set-state': 'off',
|
|
188
|
-
|
|
189
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
190
|
-
'react/no-direct-mutation-state': 'error',
|
|
191
|
-
|
|
192
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
|
|
193
|
-
'react/no-find-dom-node': 'error',
|
|
194
|
-
|
|
195
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md
|
|
196
|
-
'react/no-invalid-html-attribute': 'error',
|
|
197
|
-
|
|
198
|
-
/*
|
|
199
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
|
|
200
|
-
* https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html
|
|
201
|
-
*/
|
|
202
|
-
'react/no-is-mounted': 'error',
|
|
203
|
-
|
|
204
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
|
|
205
|
-
'react/no-multi-comp': 'off',
|
|
206
|
-
|
|
207
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-namespace.md
|
|
208
|
-
'react/no-namespace': 'error',
|
|
209
|
-
|
|
210
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md
|
|
211
|
-
'react/no-redundant-should-component-update': 'error',
|
|
212
|
-
|
|
213
|
-
/*
|
|
214
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
|
|
215
|
-
* using this return value is legacy and should be avoided because future versions of React may render
|
|
216
|
-
* components asynchronously in some cases.
|
|
217
|
-
*/
|
|
218
|
-
'react/no-render-return-value': 'error',
|
|
219
|
-
|
|
220
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
|
|
221
|
-
'react/no-set-state': 'off',
|
|
222
|
-
|
|
223
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-typos.md
|
|
224
|
-
'react/no-typos': 'error',
|
|
225
|
-
|
|
226
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
|
|
227
|
-
'react/no-string-refs': 'error',
|
|
228
|
-
|
|
229
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
|
|
230
|
-
'react/no-this-in-sfc': 'error',
|
|
231
|
-
|
|
232
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
|
|
233
|
-
'react/no-unescaped-entities': 'error',
|
|
234
|
-
|
|
235
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
|
|
236
|
-
'react/no-unknown-property': 'error',
|
|
237
|
-
|
|
238
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md
|
|
239
|
-
'react/no-unsafe': 'error',
|
|
240
|
-
|
|
241
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
|
|
242
|
-
'react/no-unstable-nested-components': 'error',
|
|
243
|
-
|
|
244
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md
|
|
245
|
-
'react/no-unused-class-component-methods': 'error',
|
|
246
|
-
|
|
247
|
-
/*
|
|
248
|
-
* no prop types usage
|
|
249
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
|
|
250
|
-
*/
|
|
251
|
-
'react/no-unused-prop-types': 'off',
|
|
252
|
-
|
|
253
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-state.md
|
|
254
|
-
'react/no-unused-state': 'error',
|
|
255
|
-
|
|
256
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
|
|
257
|
-
'react/no-will-update-set-state': 'error',
|
|
258
|
-
|
|
259
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
260
|
-
'react/prefer-es6-class': ['error', 'always'],
|
|
261
|
-
|
|
262
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-exact-props.md
|
|
263
|
-
'react/prefer-exact-props': 'off',
|
|
264
|
-
|
|
265
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
266
|
-
'react/prefer-stateless-function': [
|
|
267
|
-
'error',
|
|
268
|
-
{
|
|
269
|
-
ignorePureComponents: true,
|
|
270
|
-
},
|
|
271
|
-
],
|
|
272
|
-
|
|
273
|
-
/*
|
|
274
|
-
* no prop types usage
|
|
275
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
|
|
276
|
-
*/
|
|
277
|
-
'react/prop-types': 'off',
|
|
278
|
-
|
|
279
|
-
/*
|
|
280
|
-
* off after update to 16.4
|
|
281
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
|
|
282
|
-
*/
|
|
283
|
-
'react/react-in-jsx-scope': 'off',
|
|
284
|
-
|
|
285
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
|
|
286
|
-
'react/require-default-props': 'off',
|
|
287
|
-
|
|
288
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
|
|
289
|
-
'react/require-optimization': [
|
|
290
|
-
'error',
|
|
291
|
-
{
|
|
292
|
-
allowDecorators: ['pureComponentDecorator'],
|
|
293
|
-
},
|
|
294
|
-
],
|
|
295
|
-
|
|
296
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
|
|
297
|
-
'react/require-render-return': 'error',
|
|
298
|
-
|
|
299
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
300
|
-
'react/self-closing-comp': 'error',
|
|
301
|
-
|
|
302
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
|
|
303
|
-
'react/sort-comp': [
|
|
304
|
-
'error',
|
|
305
|
-
{
|
|
306
|
-
order: [
|
|
307
|
-
'static-methods',
|
|
308
|
-
'lifecycle',
|
|
309
|
-
'/^on.+$/',
|
|
310
|
-
'getters',
|
|
311
|
-
'setters',
|
|
312
|
-
'instance-methods',
|
|
313
|
-
'everything-else',
|
|
314
|
-
'rendering',
|
|
315
|
-
],
|
|
316
|
-
groups: {
|
|
317
|
-
lifecycle: [
|
|
318
|
-
'displayName',
|
|
319
|
-
'propTypes',
|
|
320
|
-
'contextTypes',
|
|
321
|
-
'childContextTypes',
|
|
322
|
-
'mixins',
|
|
323
|
-
'statics',
|
|
324
|
-
'defaultProps',
|
|
325
|
-
'instance-variables',
|
|
326
|
-
'constructor',
|
|
327
|
-
'getDefaultProps',
|
|
328
|
-
'state',
|
|
329
|
-
'getInitialState',
|
|
330
|
-
'getChildContext',
|
|
331
|
-
'getDerivedStateFromProps',
|
|
332
|
-
'componentWillMount',
|
|
333
|
-
'UNSAFE_componentWillMount',
|
|
334
|
-
'componentDidMount',
|
|
335
|
-
'componentWillReceiveProps',
|
|
336
|
-
'UNSAFE_componentWillReceiveProps',
|
|
337
|
-
'shouldComponentUpdate',
|
|
338
|
-
'componentWillUpdate',
|
|
339
|
-
'UNSAFE_componentWillUpdate',
|
|
340
|
-
'getSnapshotBeforeUpdate',
|
|
341
|
-
'componentDidUpdate',
|
|
342
|
-
'componentDidCatch',
|
|
343
|
-
'componentWillUnmount',
|
|
344
|
-
],
|
|
345
|
-
rendering: ['/^render.+$/', 'render'],
|
|
3
|
+
export default {
|
|
4
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
|
|
5
|
+
'react/boolean-prop-naming': [
|
|
6
|
+
'error',
|
|
7
|
+
{
|
|
8
|
+
propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
|
|
9
|
+
rule: '^(is|has|should)[A-Z]([A-Za-z0-9]?)+',
|
|
10
|
+
message:
|
|
11
|
+
'It is better if your prop ({{ propName }}) matches this pattern: ({{ pattern }})',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
|
|
15
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
|
|
16
|
+
'react/button-has-type': [
|
|
17
|
+
'error',
|
|
18
|
+
{
|
|
19
|
+
button: true,
|
|
20
|
+
submit: true,
|
|
21
|
+
reset: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
|
|
25
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/checked-requires-onchange-or-readonly.md
|
|
26
|
+
'react/checked-requires-onchange-or-readonly': 'error',
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* no prop types usage
|
|
30
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md
|
|
31
|
+
*/
|
|
32
|
+
'react/default-props-match-prop-types': 'off',
|
|
33
|
+
|
|
34
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
|
|
35
|
+
'react/destructuring-assignment': ['error', 'always'],
|
|
36
|
+
|
|
37
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
|
38
|
+
'react/display-name': [
|
|
39
|
+
'off',
|
|
40
|
+
{
|
|
41
|
+
ignoreTranspilerName: false,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
|
|
47
|
+
* https://brigade.engineering/don-t-pass-css-classes-between-components-e9f7ab192785
|
|
48
|
+
*/
|
|
49
|
+
'react/forbid-component-props': [
|
|
50
|
+
'error',
|
|
51
|
+
{
|
|
52
|
+
forbid: [
|
|
53
|
+
'style',
|
|
54
|
+
{
|
|
55
|
+
propName: 'className',
|
|
56
|
+
allowedFor: ['Button', 'Icon', 'Link'],
|
|
346
57
|
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-dom-props.md
|
|
64
|
+
* https://www.w3.org/TR/html5-diff/#obsolete-attributes
|
|
65
|
+
*/
|
|
66
|
+
'react/forbid-dom-props': [
|
|
67
|
+
'error',
|
|
68
|
+
{
|
|
69
|
+
forbid: [
|
|
70
|
+
'abbr',
|
|
71
|
+
'align',
|
|
72
|
+
'axis',
|
|
73
|
+
'bgcolor',
|
|
74
|
+
'border',
|
|
75
|
+
'cellpadding',
|
|
76
|
+
'cellspacing',
|
|
77
|
+
'char',
|
|
78
|
+
'charoff',
|
|
79
|
+
'charset',
|
|
80
|
+
'clear',
|
|
81
|
+
'coords',
|
|
82
|
+
'frame',
|
|
83
|
+
'frameborder',
|
|
84
|
+
'hspace',
|
|
85
|
+
'longdesc',
|
|
86
|
+
'marginheight',
|
|
87
|
+
'marginwidth',
|
|
88
|
+
'rev',
|
|
89
|
+
'scope',
|
|
90
|
+
'scrolling',
|
|
91
|
+
'shape',
|
|
92
|
+
'size',
|
|
93
|
+
'valign',
|
|
94
|
+
'vspace',
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
|
|
99
|
+
/*
|
|
100
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
|
|
101
|
+
* https://www.w3.org/TR/html5-diff/#obsolete-elements
|
|
102
|
+
*/
|
|
103
|
+
'react/forbid-elements': [
|
|
104
|
+
'error',
|
|
105
|
+
{
|
|
106
|
+
forbid: [
|
|
107
|
+
'acronym',
|
|
108
|
+
'applet',
|
|
109
|
+
'basefont',
|
|
110
|
+
'big',
|
|
111
|
+
'center',
|
|
112
|
+
'dir',
|
|
113
|
+
'font',
|
|
114
|
+
'frame',
|
|
115
|
+
'frameset',
|
|
116
|
+
'noframes',
|
|
117
|
+
'isindex',
|
|
118
|
+
'noframes',
|
|
119
|
+
's',
|
|
120
|
+
'strike',
|
|
121
|
+
'tt',
|
|
122
|
+
'u',
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
|
|
127
|
+
/*
|
|
128
|
+
* no prop types usage
|
|
129
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
|
|
130
|
+
*/
|
|
131
|
+
'react/forbid-foreign-prop-types': 'off',
|
|
132
|
+
|
|
133
|
+
/*
|
|
134
|
+
* no prop types usage
|
|
135
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
|
|
136
|
+
*/
|
|
137
|
+
'react/forbid-prop-types': 'off',
|
|
138
|
+
|
|
139
|
+
'react/forward-ref-uses-ref': 'error',
|
|
140
|
+
|
|
141
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
|
|
142
|
+
'react/function-component-definition': [
|
|
143
|
+
'error',
|
|
144
|
+
{
|
|
145
|
+
namedComponents: 'arrow-function',
|
|
146
|
+
unnamedComponents: 'arrow-function',
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
|
|
150
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
151
|
+
'react/hook-use-state': [
|
|
152
|
+
'error',
|
|
153
|
+
{
|
|
154
|
+
allowDestructuredState: true,
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
|
|
158
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md
|
|
159
|
+
'react/iframe-missing-sandbox': 'error',
|
|
160
|
+
|
|
161
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md
|
|
162
|
+
'react/no-access-state-in-setstate': 'error',
|
|
163
|
+
|
|
164
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md
|
|
165
|
+
'react/no-adjacent-inline-elements': 'error',
|
|
166
|
+
|
|
167
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
168
|
+
'react/no-array-index-key': 'error',
|
|
169
|
+
|
|
170
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-arrow-function-lifecycle.md
|
|
171
|
+
'react/no-arrow-function-lifecycle': 'error',
|
|
172
|
+
|
|
173
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
|
|
174
|
+
'react/no-children-prop': 'error',
|
|
175
|
+
|
|
176
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
|
|
177
|
+
'react/no-danger-with-children': 'error',
|
|
178
|
+
|
|
179
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
|
|
180
|
+
'react/no-deprecated': 'error',
|
|
181
|
+
|
|
182
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
|
|
183
|
+
'react/no-did-mount-set-state': 'off',
|
|
184
|
+
|
|
185
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
|
|
186
|
+
'react/no-did-update-set-state': 'off',
|
|
187
|
+
|
|
188
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
189
|
+
'react/no-direct-mutation-state': 'error',
|
|
190
|
+
|
|
191
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
|
|
192
|
+
'react/no-find-dom-node': 'error',
|
|
193
|
+
|
|
194
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md
|
|
195
|
+
'react/no-invalid-html-attribute': 'error',
|
|
196
|
+
|
|
197
|
+
/*
|
|
198
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
|
|
199
|
+
* https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html
|
|
200
|
+
*/
|
|
201
|
+
'react/no-is-mounted': 'error',
|
|
202
|
+
|
|
203
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
|
|
204
|
+
'react/no-multi-comp': 'off',
|
|
205
|
+
|
|
206
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-namespace.md
|
|
207
|
+
'react/no-namespace': 'error',
|
|
208
|
+
|
|
209
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md
|
|
210
|
+
'react/no-redundant-should-component-update': 'error',
|
|
211
|
+
|
|
212
|
+
/*
|
|
213
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
|
|
214
|
+
* using this return value is legacy and should be avoided because future versions of React may render
|
|
215
|
+
* components asynchronously in some cases.
|
|
216
|
+
*/
|
|
217
|
+
'react/no-render-return-value': 'error',
|
|
218
|
+
|
|
219
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
|
|
220
|
+
'react/no-set-state': 'off',
|
|
221
|
+
|
|
222
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-typos.md
|
|
223
|
+
'react/no-typos': 'error',
|
|
224
|
+
|
|
225
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
|
|
226
|
+
'react/no-string-refs': 'error',
|
|
227
|
+
|
|
228
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
|
|
229
|
+
'react/no-this-in-sfc': 'error',
|
|
230
|
+
|
|
231
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
|
|
232
|
+
'react/no-unescaped-entities': 'error',
|
|
233
|
+
|
|
234
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
|
|
235
|
+
'react/no-unknown-property': 'error',
|
|
236
|
+
|
|
237
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md
|
|
238
|
+
'react/no-unsafe': 'error',
|
|
239
|
+
|
|
240
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
|
|
241
|
+
'react/no-unstable-nested-components': 'error',
|
|
242
|
+
|
|
243
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md
|
|
244
|
+
'react/no-unused-class-component-methods': 'error',
|
|
245
|
+
|
|
246
|
+
/*
|
|
247
|
+
* no prop types usage
|
|
248
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
|
|
249
|
+
*/
|
|
250
|
+
'react/no-unused-prop-types': 'off',
|
|
251
|
+
|
|
252
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-state.md
|
|
253
|
+
'react/no-unused-state': 'error',
|
|
254
|
+
|
|
255
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
|
|
256
|
+
'react/no-will-update-set-state': 'error',
|
|
257
|
+
|
|
258
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
259
|
+
'react/prefer-es6-class': ['error', 'always'],
|
|
260
|
+
|
|
261
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-exact-props.md
|
|
262
|
+
'react/prefer-exact-props': 'off',
|
|
263
|
+
|
|
264
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
265
|
+
'react/prefer-stateless-function': [
|
|
266
|
+
'error',
|
|
267
|
+
{
|
|
268
|
+
ignorePureComponents: true,
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
|
|
272
|
+
/*
|
|
273
|
+
* no prop types usage
|
|
274
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
|
|
275
|
+
*/
|
|
276
|
+
'react/prop-types': 'off',
|
|
277
|
+
|
|
278
|
+
/*
|
|
279
|
+
* off after update to 16.4
|
|
280
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
|
|
281
|
+
*/
|
|
282
|
+
'react/react-in-jsx-scope': 'off',
|
|
283
|
+
|
|
284
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
|
|
285
|
+
'react/require-default-props': 'off',
|
|
286
|
+
|
|
287
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
|
|
288
|
+
'react/require-optimization': [
|
|
289
|
+
'error',
|
|
290
|
+
{
|
|
291
|
+
allowDecorators: ['pureComponentDecorator'],
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
|
|
295
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
|
|
296
|
+
'react/require-render-return': 'error',
|
|
297
|
+
|
|
298
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
299
|
+
'react/self-closing-comp': 'error',
|
|
300
|
+
|
|
301
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
|
|
302
|
+
'react/sort-comp': [
|
|
303
|
+
'error',
|
|
304
|
+
{
|
|
305
|
+
order: [
|
|
306
|
+
'static-methods',
|
|
307
|
+
'lifecycle',
|
|
308
|
+
'/^on.+$/',
|
|
309
|
+
'getters',
|
|
310
|
+
'setters',
|
|
311
|
+
'instance-methods',
|
|
312
|
+
'everything-else',
|
|
313
|
+
'rendering',
|
|
314
|
+
],
|
|
315
|
+
groups: {
|
|
316
|
+
lifecycle: [
|
|
317
|
+
'displayName',
|
|
318
|
+
'propTypes',
|
|
319
|
+
'contextTypes',
|
|
320
|
+
'childContextTypes',
|
|
321
|
+
'mixins',
|
|
322
|
+
'statics',
|
|
323
|
+
'defaultProps',
|
|
324
|
+
'instance-variables',
|
|
325
|
+
'constructor',
|
|
326
|
+
'getDefaultProps',
|
|
327
|
+
'state',
|
|
328
|
+
'getInitialState',
|
|
329
|
+
'getChildContext',
|
|
330
|
+
'getDerivedStateFromProps',
|
|
331
|
+
'componentWillMount',
|
|
332
|
+
'UNSAFE_componentWillMount',
|
|
333
|
+
'componentDidMount',
|
|
334
|
+
'componentWillReceiveProps',
|
|
335
|
+
'UNSAFE_componentWillReceiveProps',
|
|
336
|
+
'shouldComponentUpdate',
|
|
337
|
+
'componentWillUpdate',
|
|
338
|
+
'UNSAFE_componentWillUpdate',
|
|
339
|
+
'getSnapshotBeforeUpdate',
|
|
340
|
+
'componentDidUpdate',
|
|
341
|
+
'componentDidCatch',
|
|
342
|
+
'componentWillUnmount',
|
|
343
|
+
],
|
|
344
|
+
rendering: ['/^render.+$/', 'render'],
|
|
347
345
|
},
|
|
348
|
-
|
|
346
|
+
},
|
|
347
|
+
],
|
|
349
348
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
349
|
+
/*
|
|
350
|
+
* no prop types usage
|
|
351
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
|
|
352
|
+
*/
|
|
353
|
+
'react/sort-prop-types': 'off',
|
|
355
354
|
|
|
356
|
-
|
|
357
|
-
|
|
355
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
356
|
+
'react/style-prop-object': 'error',
|
|
358
357
|
|
|
359
|
-
|
|
360
|
-
|
|
358
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
|
|
359
|
+
'react/void-dom-elements-no-children': 'error',
|
|
361
360
|
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
|
|
362
|
+
'react/state-in-constructor': ['error', 'always'],
|
|
364
363
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
},
|
|
364
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
|
|
365
|
+
'react/static-property-placement': ['error', 'static public field'],
|
|
368
366
|
};
|