@innovixx/eslint-config 3.0.7 → 3.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.
@@ -1,501 +1,501 @@
1
1
  /** @type {import('eslint').Linter.Config} */
2
2
 
3
3
  const reactRules = {
4
- rules: {
5
- // View link below for react rules documentation
6
- // https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
7
-
8
- // Specify whether double or single quotes should be used in JSX attributes
9
- // https://eslint.org/docs/rules/jsx-quotes
10
- 'jsx-quotes': ['error', 'prefer-double'],
11
-
12
- 'class-methods-use-this': ['error', {
13
- exceptMethods: [
14
- 'render',
15
- 'getInitialState',
16
- 'getDefaultProps',
17
- 'getChildContext',
18
- 'componentWillMount',
19
- 'UNSAFE_componentWillMount',
20
- 'componentDidMount',
21
- 'componentWillReceiveProps',
22
- 'UNSAFE_componentWillReceiveProps',
23
- 'shouldComponentUpdate',
24
- 'componentWillUpdate',
25
- 'UNSAFE_componentWillUpdate',
26
- 'componentDidUpdate',
27
- 'componentWillUnmount',
28
- 'componentDidCatch',
29
- 'getSnapshotBeforeUpdate',
30
- ],
31
- }],
32
-
33
- // Prevent missing displayName in a React component definition
34
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
35
- 'react/display-name': ['off', { ignoreTranspilerName: false }],
36
-
37
- // Forbid certain propTypes (any, array, object)
38
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-prop-types.md
39
- 'react/forbid-prop-types': ['error', {
40
- forbid: ['any', 'array', 'object'],
41
- checkContextTypes: true,
42
- checkChildContextTypes: true,
43
- }],
44
-
45
- // Forbid certain props on DOM Nodes
46
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-dom-props.md
47
- 'react/forbid-dom-props': ['off', { forbid: [] }],
48
-
49
- // Enforce boolean attributes notation in JSX
50
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
51
- 'react/jsx-boolean-value': ['error', 'never', { always: [] }],
52
-
53
- // Validate closing bracket location in JSX
54
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
55
- 'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
56
-
57
- // Validate closing tag location in JSX
58
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
59
- 'react/jsx-closing-tag-location': 'error',
60
-
61
- // Enforce or disallow spaces inside of curly braces in JSX attributes
62
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
63
- 'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
64
-
65
- // Enforce event handler naming conventions in JSX
66
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
67
- 'react/jsx-handler-names': ['off', {
68
- eventHandlerPrefix: 'handle',
69
- eventHandlerPropPrefix: 'on',
70
- }],
71
-
72
- // Validate props indentation in JSX
73
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
74
- 'react/jsx-indent-props': ['error', 2],
75
-
76
- // Validate JSX has key prop when in array or iterator
77
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
78
- 'react/jsx-key': 'off',
79
-
80
- // Limit maximum of props on a single line in JSX
81
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
82
- 'react/jsx-max-props-per-line': ['error', { maximum: 1 }],
83
-
84
- // Prevent usage of .bind() in JSX props
85
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
86
- 'react/jsx-no-bind': ['error', {
87
- ignoreRefs: true,
88
- allowArrowFunctions: true,
89
- allowFunctions: false,
90
- allowBind: false,
91
- ignoreDOMComponents: true,
92
- }],
93
-
94
- // Prevent duplicate props in JSX
95
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
96
- 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
97
-
98
- // Prevent usage of unwrapped JSX strings
99
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
100
- 'react/jsx-no-literals': ['off', { noStrings: true }],
101
-
102
- // Disallow undeclared variables in JSX
103
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
104
- 'react/jsx-no-undef': 'error',
105
-
106
- // Enforce PascalCase for user-defined JSX components
107
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
108
- 'react/jsx-pascal-case': ['error', {
109
- allowAllCaps: true,
110
- ignore: [],
111
- }],
112
-
113
- // Enforce propTypes declarations alphabetical sorting
114
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
115
- 'react/sort-prop-types': ['off', {
116
- ignoreCase: true,
117
- callbacksLast: false,
118
- requiredFirst: false,
119
- sortShapeProp: true,
120
- }],
121
-
122
- // Deprecated in favor of react/jsx-sort-props
123
- 'react/jsx-sort-prop-types': 'off',
124
-
125
- // Enforce props alphabetical sorting
126
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
127
- 'react/jsx-sort-props': ['off', {
128
- ignoreCase: true,
129
- callbacksLast: false,
130
- shorthandFirst: false,
131
- shorthandLast: false,
132
- noSortAlphabetically: false,
133
- reservedFirst: true,
134
- }],
135
-
136
- // Enforce defaultProps declarations alphabetical sorting
137
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
138
- 'react/jsx-sort-default-props': ['off', {
139
- ignoreCase: true,
140
- }],
141
-
142
- // Prevent React to be incorrectly marked as unused
143
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
144
- 'react/jsx-uses-react': ['error'],
145
-
146
- // Prevent variables used in JSX to be incorrectly marked as unused
147
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
148
- 'react/jsx-uses-vars': 'error',
149
-
150
- // Prevent usage of dangerous JSX properties
151
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
152
- 'react/no-danger': 'off',
153
-
154
- // Prevent usage of deprecated methods
155
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
156
- 'react/no-deprecated': ['error'],
157
-
158
- // Prevent usage of setState in componentDidMount
159
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
160
- // this is necessary for server-rendering
161
- 'react/no-did-mount-set-state': 'off',
162
-
163
- // Prevent usage of setState in componentDidUpdate
164
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
165
- 'react/no-did-update-set-state': 'off',
166
-
167
- // Prevent usage of setState in componentWillUpdate
168
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
169
- 'react/no-will-update-set-state': 'error',
170
-
171
- // Prevent direct mutation of this.state
172
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
173
- 'react/no-direct-mutation-state': 'off',
174
-
175
- // Prevent usage of isMounted
176
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
177
- 'react/no-is-mounted': 'error',
178
-
179
- // Prevent multiple component definition per file
180
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
181
- 'react/no-multi-comp': 'off',
182
-
183
- // Prevent usage of setState
184
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
185
- 'react/no-set-state': 'off',
186
-
187
- // Prevent using string references
188
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
189
- 'react/no-string-refs': 'error',
190
-
191
- // Prevent usage of unknown DOM property
192
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
193
- 'react/no-unknown-property': 'error',
194
-
195
- // Require ES6 class declarations over React.createClass
196
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
197
- 'react/prefer-es6-class': ['error', 'always'],
198
-
199
- // Require stateless functions when not using lifecycle methods, setState or ref
200
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
201
- 'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
202
-
203
- // Prevent missing props validation in a React component definition
204
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
205
- 'react/prop-types': ['error', {
206
- ignore: [],
207
- customValidators: [],
208
- skipUndeclared: false,
209
- }],
210
-
211
- // Prevent missing React when using JSX
212
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
213
- 'react/react-in-jsx-scope': 'error',
214
-
215
- // Require render() methods to return something
216
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
217
- 'react/require-render-return': 'error',
218
-
219
- // Prevent extra closing tags for components without children
220
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
221
- 'react/self-closing-comp': 'error',
222
-
223
- // Enforce component methods order
224
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
225
- 'react/sort-comp': ['error', {
226
- order: [
227
- 'static-variables',
228
- 'static-methods',
229
- 'instance-variables',
230
- 'lifecycle',
231
- '/^on.+$/',
232
- 'getters',
233
- 'setters',
234
- '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
235
- 'instance-methods',
236
- 'everything-else',
237
- 'rendering',
238
- ],
239
- groups: {
240
- lifecycle: [
241
- 'displayName',
242
- 'propTypes',
243
- 'contextTypes',
244
- 'childContextTypes',
245
- 'mixins',
246
- 'statics',
247
- 'defaultProps',
248
- 'constructor',
249
- 'getDefaultProps',
250
- 'getInitialState',
251
- 'state',
252
- 'getChildContext',
253
- 'getDerivedStateFromProps',
254
- 'componentWillMount',
255
- 'UNSAFE_componentWillMount',
256
- 'componentDidMount',
257
- 'componentWillReceiveProps',
258
- 'UNSAFE_componentWillReceiveProps',
259
- 'shouldComponentUpdate',
260
- 'componentWillUpdate',
261
- 'UNSAFE_componentWillUpdate',
262
- 'getSnapshotBeforeUpdate',
263
- 'componentDidUpdate',
264
- 'componentDidCatch',
265
- 'componentWillUnmount',
266
- ],
267
- rendering: [
268
- '/^render.+$/',
269
- 'render',
270
- ],
271
- },
272
- }],
273
-
274
- // Prevent missing parentheses around multilines JSX
275
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
276
- 'react/jsx-wrap-multilines': ['error', {
277
- declaration: 'parens-new-line',
278
- assignment: 'parens-new-line',
279
- return: 'parens-new-line',
280
- arrow: 'parens-new-line',
281
- condition: 'parens-new-line',
282
- logical: 'parens-new-line',
283
- prop: 'parens-new-line',
284
- }],
285
-
286
- // Require that the first prop in a JSX element be on a new line when the element is multiline
287
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
288
- 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
289
-
290
- // Enforce spacing around jsx equals signs
291
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
292
- 'react/jsx-equals-spacing': ['error', 'never'],
293
-
294
- // Enforce JSX indentation
295
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
296
- 'react/jsx-indent': ['error', 2],
297
-
298
- // Disallow target="_blank" on links
299
- // https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
300
- 'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
301
-
302
- // only .jsx files may have JSX
303
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
304
- 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
305
-
306
- // prevent accidental JS comments from being injected into JSX as text
307
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
308
- 'react/jsx-no-comment-textnodes': 'error',
309
-
310
- // disallow using React.render/ReactDOM.render's return value
311
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
312
- 'react/no-render-return-value': 'error',
313
-
314
- // require a shouldComponentUpdate method, or PureRenderMixin
315
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
316
- 'react/require-optimization': ['off', { allowDecorators: [] }],
317
-
318
- // warn against using findDOMNode()
319
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
320
- 'react/no-find-dom-node': 'error',
321
-
322
- // Forbid certain props on Components
323
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
324
- 'react/forbid-component-props': ['off', { forbid: [] }],
325
-
326
- // Forbid certain elements
327
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
328
- 'react/forbid-elements': ['off', { forbid: [] }],
329
-
330
- // Prevent problem with children and props.dangerouslySetInnerHTML
331
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
332
- 'react/no-danger-with-children': 'error',
333
-
334
- // Prevent unused propType definitions
335
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
336
- 'react/no-unused-prop-types': ['error', {
337
- customValidators: [
338
- ],
339
- skipShapeProps: true,
340
- }],
341
-
342
- // Require style prop value be an object or var
343
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
344
- 'react/style-prop-object': 'error',
345
-
346
- // Prevent invalid characters from appearing in markup
347
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
348
- 'react/no-unescaped-entities': 'error',
349
-
350
- // Prevent passing of children as props
351
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
352
- 'react/no-children-prop': 'error',
353
-
354
- // Validate whitespace in and around the JSX opening and closing brackets
355
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
356
- 'react/jsx-tag-spacing': ['error', {
357
- closingSlash: 'never',
358
- beforeSelfClosing: 'always',
359
- afterOpening: 'never',
360
- beforeClosing: 'never',
361
- }],
362
-
363
- // Enforce spaces before the closing bracket of self-closing JSX elements
364
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
365
- // Deprecated in favor of jsx-tag-spacing
366
- 'react/jsx-space-before-closing': ['off', 'always'],
367
-
368
- // Prevent usage of Array index in keys
369
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
370
- 'react/no-array-index-key': 'off',
371
-
372
- // Enforce a defaultProps definition for every prop that is not a required prop
373
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/require-default-props.md
374
- 'react/require-default-props': 'off',
375
-
376
- // Forbids using non-exported propTypes
377
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
378
- // this is intentionally set to "warn". it would be "error",
379
- // but it's only critical if you're stripping propTypes in production.
380
- 'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
381
-
382
- // Prevent void DOM elements from receiving children
383
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
384
- 'react/void-dom-elements-no-children': 'error',
385
-
386
- // Enforce all defaultProps have a corresponding non-required PropType
387
- // https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/default-props-match-prop-types.md
388
- 'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: false }],
389
-
390
- // Prevent usage of shouldComponentUpdate when extending React.PureComponent
391
- // https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md
392
- 'react/no-redundant-should-component-update': 'error',
393
-
394
- // Prevent unused state values
395
- // https://github.com/yannickcr/eslint-plugin-react/pull/1103/
396
- 'react/no-unused-state': 'error',
397
-
398
- // Enforces consistent naming for boolean props
399
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
400
- 'react/boolean-prop-naming': ['off', {
401
- propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
402
- rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
403
- message: '',
404
- }],
405
-
406
- // Prevents common casing typos
407
- // https://github.com/yannickcr/eslint-plugin-react/blob/73abadb697034b5ccb514d79fb4689836fe61f91/docs/rules/no-typos.md
408
- 'react/no-typos': 'error',
409
-
410
- // Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
411
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
412
- 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
413
-
414
- // One JSX Element Per Line
415
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
416
- 'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
417
-
418
- // Enforce consistent usage of destructuring assignment of props, state, and context
419
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
420
- 'react/destructuring-assignment': ['error', 'always'],
421
-
422
- // Prevent using this.state within a this.setState
423
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-access-state-in-setstate.md
424
- 'react/no-access-state-in-setstate': 'error',
425
-
426
- // Prevent usage of button elements without an explicit type attribute
427
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
428
- 'react/button-has-type': ['error', {
429
- button: true,
430
- submit: true,
431
- reset: false,
432
- }],
433
-
434
- // Ensures inline tags are not rendered without spaces between them
435
- 'react/jsx-child-element-spacing': 'off',
436
-
437
- // Prevent this from being used in stateless functional components
438
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md
439
- 'react/no-this-in-sfc': 'error',
440
-
441
- // Validate JSX maximum depth
442
- // https://github.com/yannickcr/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
443
- 'react/jsx-max-depth': 'off',
444
-
445
- // Disallow multiple spaces between inline JSX props
446
- // https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
447
- 'react/jsx-props-no-multi-spaces': 'error',
448
-
449
- // Prevent usage of UNSAFE_ methods
450
- // https://github.com/yannickcr/eslint-plugin-react/blob/157cc932be2cfaa56b3f5b45df6f6d4322a2f660/docs/rules/no-unsafe.md
451
- 'react/no-unsafe': 'off',
452
-
453
- // Enforce shorthand or standard form for React fragments
454
- // https://github.com/yannickcr/eslint-plugin-react/blob/bc976b837abeab1dffd90ac6168b746a83fc83cc/docs/rules/jsx-fragments.md
455
- 'react/jsx-fragments': ['error', 'element'],
456
-
457
- // Enforce linebreaks in curly braces in JSX attributes and expressions.
458
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
459
- 'react/jsx-curly-newline': ['error', {
460
- multiline: 'consistent',
461
- singleline: 'consistent',
462
- }],
463
-
464
- // Enforce state initialization style
465
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
466
- // TODO: set to "never" once babel-preset-airbnb supports public class fields
467
- 'react/state-in-constructor': ['error', 'always'],
468
-
469
- // Enforces where React component static properties should be positioned
470
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
471
- // TODO: set to "static public field" once babel-preset-airbnb supports public class fields
472
- 'react/static-property-placement': ['error', 'property assignment'],
473
-
474
- // Disallow JSX props spreading
475
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
476
- 'react/jsx-props-no-spreading': 'off',
477
-
478
- // Enforce that props are read-only
479
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
480
- 'react/prefer-read-only-props': 'off',
481
- },
482
-
483
- settings: {
484
- 'import/resolver': {
485
- node: {
486
- extensions: ['.js', '.jsx', '.json'],
487
- },
488
- },
489
- react: {
490
- pragma: 'React',
491
- version: 'detect',
492
- },
493
- propWrapperFunctions: [
494
- 'forbidExtraProps', // https://www.npmjs.com/package/airbnb-prop-types
495
- 'exact', // https://www.npmjs.com/package/prop-types-exact
496
- 'Object.freeze', // https://tc39.github.io/ecma262/#sec-object.freeze
497
- ],
498
- },
4
+ rules: {
5
+ // View link below for react rules documentation
6
+ // https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
7
+
8
+ // Specify whether double or single quotes should be used in JSX attributes
9
+ // https://eslint.org/docs/rules/jsx-quotes
10
+ 'jsx-quotes': ['error', 'prefer-double'],
11
+
12
+ 'class-methods-use-this': ['error', {
13
+ exceptMethods: [
14
+ 'render',
15
+ 'getInitialState',
16
+ 'getDefaultProps',
17
+ 'getChildContext',
18
+ 'componentWillMount',
19
+ 'UNSAFE_componentWillMount',
20
+ 'componentDidMount',
21
+ 'componentWillReceiveProps',
22
+ 'UNSAFE_componentWillReceiveProps',
23
+ 'shouldComponentUpdate',
24
+ 'componentWillUpdate',
25
+ 'UNSAFE_componentWillUpdate',
26
+ 'componentDidUpdate',
27
+ 'componentWillUnmount',
28
+ 'componentDidCatch',
29
+ 'getSnapshotBeforeUpdate',
30
+ ],
31
+ }],
32
+
33
+ // Prevent missing displayName in a React component definition
34
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
35
+ 'react/display-name': ['off', { ignoreTranspilerName: false }],
36
+
37
+ // Forbid certain propTypes (any, array, object)
38
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-prop-types.md
39
+ 'react/forbid-prop-types': ['error', {
40
+ forbid: ['any', 'array', 'object'],
41
+ checkContextTypes: true,
42
+ checkChildContextTypes: true,
43
+ }],
44
+
45
+ // Forbid certain props on DOM Nodes
46
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-dom-props.md
47
+ 'react/forbid-dom-props': ['off', { forbid: [] }],
48
+
49
+ // Enforce boolean attributes notation in JSX
50
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
51
+ 'react/jsx-boolean-value': ['error', 'never', { always: [] }],
52
+
53
+ // Validate closing bracket location in JSX
54
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
55
+ 'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
56
+
57
+ // Validate closing tag location in JSX
58
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
59
+ 'react/jsx-closing-tag-location': 'error',
60
+
61
+ // Enforce or disallow spaces inside of curly braces in JSX attributes
62
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
63
+ 'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
64
+
65
+ // Enforce event handler naming conventions in JSX
66
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
67
+ 'react/jsx-handler-names': ['off', {
68
+ eventHandlerPrefix: 'handle',
69
+ eventHandlerPropPrefix: 'on',
70
+ }],
71
+
72
+ // Validate props indentation in JSX
73
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
74
+ 'react/jsx-indent-props': ['error', 'tab'],
75
+
76
+ // Validate JSX has key prop when in array or iterator
77
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
78
+ 'react/jsx-key': 'off',
79
+
80
+ // Limit maximum of props on a single line in JSX
81
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
82
+ 'react/jsx-max-props-per-line': ['error', { maximum: 1 }],
83
+
84
+ // Prevent usage of .bind() in JSX props
85
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
86
+ 'react/jsx-no-bind': ['error', {
87
+ ignoreRefs: true,
88
+ allowArrowFunctions: true,
89
+ allowFunctions: false,
90
+ allowBind: false,
91
+ ignoreDOMComponents: true,
92
+ }],
93
+
94
+ // Prevent duplicate props in JSX
95
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
96
+ 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
97
+
98
+ // Prevent usage of unwrapped JSX strings
99
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
100
+ 'react/jsx-no-literals': ['off', { noStrings: true }],
101
+
102
+ // Disallow undeclared variables in JSX
103
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
104
+ 'react/jsx-no-undef': 'error',
105
+
106
+ // Enforce PascalCase for user-defined JSX components
107
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
108
+ 'react/jsx-pascal-case': ['error', {
109
+ allowAllCaps: true,
110
+ ignore: [],
111
+ }],
112
+
113
+ // Enforce propTypes declarations alphabetical sorting
114
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
115
+ 'react/sort-prop-types': ['off', {
116
+ ignoreCase: true,
117
+ callbacksLast: false,
118
+ requiredFirst: false,
119
+ sortShapeProp: true,
120
+ }],
121
+
122
+ // Deprecated in favor of react/jsx-sort-props
123
+ 'react/jsx-sort-prop-types': 'off',
124
+
125
+ // Enforce props alphabetical sorting
126
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
127
+ 'react/jsx-sort-props': ['off', {
128
+ ignoreCase: true,
129
+ callbacksLast: false,
130
+ shorthandFirst: false,
131
+ shorthandLast: false,
132
+ noSortAlphabetically: false,
133
+ reservedFirst: true,
134
+ }],
135
+
136
+ // Enforce defaultProps declarations alphabetical sorting
137
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
138
+ 'react/jsx-sort-default-props': ['off', {
139
+ ignoreCase: true,
140
+ }],
141
+
142
+ // Prevent React to be incorrectly marked as unused
143
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
144
+ 'react/jsx-uses-react': ['error'],
145
+
146
+ // Prevent variables used in JSX to be incorrectly marked as unused
147
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
148
+ 'react/jsx-uses-vars': 'error',
149
+
150
+ // Prevent usage of dangerous JSX properties
151
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
152
+ 'react/no-danger': 'off',
153
+
154
+ // Prevent usage of deprecated methods
155
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
156
+ 'react/no-deprecated': ['error'],
157
+
158
+ // Prevent usage of setState in componentDidMount
159
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
160
+ // this is necessary for server-rendering
161
+ 'react/no-did-mount-set-state': 'off',
162
+
163
+ // Prevent usage of setState in componentDidUpdate
164
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
165
+ 'react/no-did-update-set-state': 'off',
166
+
167
+ // Prevent usage of setState in componentWillUpdate
168
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
169
+ 'react/no-will-update-set-state': 'error',
170
+
171
+ // Prevent direct mutation of this.state
172
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
173
+ 'react/no-direct-mutation-state': 'off',
174
+
175
+ // Prevent usage of isMounted
176
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
177
+ 'react/no-is-mounted': 'error',
178
+
179
+ // Prevent multiple component definition per file
180
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
181
+ 'react/no-multi-comp': 'off',
182
+
183
+ // Prevent usage of setState
184
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
185
+ 'react/no-set-state': 'off',
186
+
187
+ // Prevent using string references
188
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
189
+ 'react/no-string-refs': 'error',
190
+
191
+ // Prevent usage of unknown DOM property
192
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
193
+ 'react/no-unknown-property': 'error',
194
+
195
+ // Require ES6 class declarations over React.createClass
196
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
197
+ 'react/prefer-es6-class': ['error', 'always'],
198
+
199
+ // Require stateless functions when not using lifecycle methods, setState or ref
200
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
201
+ 'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
202
+
203
+ // Prevent missing props validation in a React component definition
204
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
205
+ 'react/prop-types': ['error', {
206
+ ignore: [],
207
+ customValidators: [],
208
+ skipUndeclared: false,
209
+ }],
210
+
211
+ // Prevent missing React when using JSX
212
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
213
+ 'react/react-in-jsx-scope': 'error',
214
+
215
+ // Require render() methods to return something
216
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
217
+ 'react/require-render-return': 'error',
218
+
219
+ // Prevent extra closing tags for components without children
220
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
221
+ 'react/self-closing-comp': 'error',
222
+
223
+ // Enforce component methods order
224
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
225
+ 'react/sort-comp': ['error', {
226
+ order: [
227
+ 'static-variables',
228
+ 'static-methods',
229
+ 'instance-variables',
230
+ 'lifecycle',
231
+ '/^on.+$/',
232
+ 'getters',
233
+ 'setters',
234
+ '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
235
+ 'instance-methods',
236
+ 'everything-else',
237
+ 'rendering',
238
+ ],
239
+ groups: {
240
+ lifecycle: [
241
+ 'displayName',
242
+ 'propTypes',
243
+ 'contextTypes',
244
+ 'childContextTypes',
245
+ 'mixins',
246
+ 'statics',
247
+ 'defaultProps',
248
+ 'constructor',
249
+ 'getDefaultProps',
250
+ 'getInitialState',
251
+ 'state',
252
+ 'getChildContext',
253
+ 'getDerivedStateFromProps',
254
+ 'componentWillMount',
255
+ 'UNSAFE_componentWillMount',
256
+ 'componentDidMount',
257
+ 'componentWillReceiveProps',
258
+ 'UNSAFE_componentWillReceiveProps',
259
+ 'shouldComponentUpdate',
260
+ 'componentWillUpdate',
261
+ 'UNSAFE_componentWillUpdate',
262
+ 'getSnapshotBeforeUpdate',
263
+ 'componentDidUpdate',
264
+ 'componentDidCatch',
265
+ 'componentWillUnmount',
266
+ ],
267
+ rendering: [
268
+ '/^render.+$/',
269
+ 'render',
270
+ ],
271
+ },
272
+ }],
273
+
274
+ // Prevent missing parentheses around multilines JSX
275
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
276
+ 'react/jsx-wrap-multilines': ['error', {
277
+ declaration: 'parens-new-line',
278
+ assignment: 'parens-new-line',
279
+ return: 'parens-new-line',
280
+ arrow: 'parens-new-line',
281
+ condition: 'parens-new-line',
282
+ logical: 'parens-new-line',
283
+ prop: 'parens-new-line',
284
+ }],
285
+
286
+ // Require that the first prop in a JSX element be on a new line when the element is multiline
287
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
288
+ 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
289
+
290
+ // Enforce spacing around jsx equals signs
291
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
292
+ 'react/jsx-equals-spacing': ['error', 'never'],
293
+
294
+ // Enforce JSX indentation
295
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
296
+ 'react/jsx-indent': ['error', 2],
297
+
298
+ // Disallow target="_blank" on links
299
+ // https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
300
+ 'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
301
+
302
+ // only .jsx files may have JSX
303
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
304
+ 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
305
+
306
+ // prevent accidental JS comments from being injected into JSX as text
307
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
308
+ 'react/jsx-no-comment-textnodes': 'error',
309
+
310
+ // disallow using React.render/ReactDOM.render's return value
311
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
312
+ 'react/no-render-return-value': 'error',
313
+
314
+ // require a shouldComponentUpdate method, or PureRenderMixin
315
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
316
+ 'react/require-optimization': ['off', { allowDecorators: [] }],
317
+
318
+ // warn against using findDOMNode()
319
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
320
+ 'react/no-find-dom-node': 'error',
321
+
322
+ // Forbid certain props on Components
323
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
324
+ 'react/forbid-component-props': ['off', { forbid: [] }],
325
+
326
+ // Forbid certain elements
327
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
328
+ 'react/forbid-elements': ['off', { forbid: [] }],
329
+
330
+ // Prevent problem with children and props.dangerouslySetInnerHTML
331
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
332
+ 'react/no-danger-with-children': 'error',
333
+
334
+ // Prevent unused propType definitions
335
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
336
+ 'react/no-unused-prop-types': ['error', {
337
+ customValidators: [
338
+ ],
339
+ skipShapeProps: true,
340
+ }],
341
+
342
+ // Require style prop value be an object or var
343
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
344
+ 'react/style-prop-object': 'error',
345
+
346
+ // Prevent invalid characters from appearing in markup
347
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
348
+ 'react/no-unescaped-entities': 'error',
349
+
350
+ // Prevent passing of children as props
351
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
352
+ 'react/no-children-prop': 'error',
353
+
354
+ // Validate whitespace in and around the JSX opening and closing brackets
355
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
356
+ 'react/jsx-tag-spacing': ['error', {
357
+ closingSlash: 'never',
358
+ beforeSelfClosing: 'always',
359
+ afterOpening: 'never',
360
+ beforeClosing: 'never',
361
+ }],
362
+
363
+ // Enforce spaces before the closing bracket of self-closing JSX elements
364
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
365
+ // Deprecated in favor of jsx-tag-spacing
366
+ 'react/jsx-space-before-closing': ['off', 'always'],
367
+
368
+ // Prevent usage of Array index in keys
369
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
370
+ 'react/no-array-index-key': 'off',
371
+
372
+ // Enforce a defaultProps definition for every prop that is not a required prop
373
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/require-default-props.md
374
+ 'react/require-default-props': 'off',
375
+
376
+ // Forbids using non-exported propTypes
377
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
378
+ // this is intentionally set to "warn". it would be "error",
379
+ // but it's only critical if you're stripping propTypes in production.
380
+ 'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
381
+
382
+ // Prevent void DOM elements from receiving children
383
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
384
+ 'react/void-dom-elements-no-children': 'error',
385
+
386
+ // Enforce all defaultProps have a corresponding non-required PropType
387
+ // https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/default-props-match-prop-types.md
388
+ 'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: false }],
389
+
390
+ // Prevent usage of shouldComponentUpdate when extending React.PureComponent
391
+ // https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md
392
+ 'react/no-redundant-should-component-update': 'error',
393
+
394
+ // Prevent unused state values
395
+ // https://github.com/yannickcr/eslint-plugin-react/pull/1103/
396
+ 'react/no-unused-state': 'error',
397
+
398
+ // Enforces consistent naming for boolean props
399
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
400
+ 'react/boolean-prop-naming': ['off', {
401
+ propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
402
+ rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
403
+ message: '',
404
+ }],
405
+
406
+ // Prevents common casing typos
407
+ // https://github.com/yannickcr/eslint-plugin-react/blob/73abadb697034b5ccb514d79fb4689836fe61f91/docs/rules/no-typos.md
408
+ 'react/no-typos': 'error',
409
+
410
+ // Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
411
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
412
+ 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
413
+
414
+ // One JSX Element Per Line
415
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
416
+ 'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
417
+
418
+ // Enforce consistent usage of destructuring assignment of props, state, and context
419
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
420
+ 'react/destructuring-assignment': ['error', 'always'],
421
+
422
+ // Prevent using this.state within a this.setState
423
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-access-state-in-setstate.md
424
+ 'react/no-access-state-in-setstate': 'error',
425
+
426
+ // Prevent usage of button elements without an explicit type attribute
427
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
428
+ 'react/button-has-type': ['error', {
429
+ button: true,
430
+ submit: true,
431
+ reset: false,
432
+ }],
433
+
434
+ // Ensures inline tags are not rendered without spaces between them
435
+ 'react/jsx-child-element-spacing': 'off',
436
+
437
+ // Prevent this from being used in stateless functional components
438
+ // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md
439
+ 'react/no-this-in-sfc': 'error',
440
+
441
+ // Validate JSX maximum depth
442
+ // https://github.com/yannickcr/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
443
+ 'react/jsx-max-depth': 'off',
444
+
445
+ // Disallow multiple spaces between inline JSX props
446
+ // https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
447
+ 'react/jsx-props-no-multi-spaces': 'error',
448
+
449
+ // Prevent usage of UNSAFE_ methods
450
+ // https://github.com/yannickcr/eslint-plugin-react/blob/157cc932be2cfaa56b3f5b45df6f6d4322a2f660/docs/rules/no-unsafe.md
451
+ 'react/no-unsafe': 'off',
452
+
453
+ // Enforce shorthand or standard form for React fragments
454
+ // https://github.com/yannickcr/eslint-plugin-react/blob/bc976b837abeab1dffd90ac6168b746a83fc83cc/docs/rules/jsx-fragments.md
455
+ 'react/jsx-fragments': ['error', 'element'],
456
+
457
+ // Enforce linebreaks in curly braces in JSX attributes and expressions.
458
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
459
+ 'react/jsx-curly-newline': ['error', {
460
+ multiline: 'consistent',
461
+ singleline: 'consistent',
462
+ }],
463
+
464
+ // Enforce state initialization style
465
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
466
+ // TODO: set to "never" once babel-preset-airbnb supports public class fields
467
+ 'react/state-in-constructor': ['error', 'always'],
468
+
469
+ // Enforces where React component static properties should be positioned
470
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
471
+ // TODO: set to "static public field" once babel-preset-airbnb supports public class fields
472
+ 'react/static-property-placement': ['error', 'property assignment'],
473
+
474
+ // Disallow JSX props spreading
475
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
476
+ 'react/jsx-props-no-spreading': 'off',
477
+
478
+ // Enforce that props are read-only
479
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
480
+ 'react/prefer-read-only-props': 'off',
481
+ },
482
+
483
+ settings: {
484
+ 'import/resolver': {
485
+ node: {
486
+ extensions: ['.js', '.jsx', '.json'],
487
+ },
488
+ },
489
+ react: {
490
+ pragma: 'React',
491
+ version: 'detect',
492
+ },
493
+ propWrapperFunctions: [
494
+ 'forbidExtraProps', // https://www.npmjs.com/package/airbnb-prop-types
495
+ 'exact', // https://www.npmjs.com/package/prop-types-exact
496
+ 'Object.freeze', // https://tc39.github.io/ecma262/#sec-object.freeze
497
+ ],
498
+ },
499
499
  };
500
500
 
501
501
  export default reactRules;