eslint-config-airbnb-extended 0.4.0 → 0.5.1

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.
@@ -18,18 +18,13 @@ const reactRules = {
18
18
  },
19
19
  settings: {
20
20
  react: {
21
- pragma: 'React',
22
21
  version: 'detect',
23
22
  },
24
- propWrapperFunctions: [
25
- 'forbidExtraProps', // https://www.npmjs.com/package/airbnb-prop-types
26
- 'exact', // https://www.npmjs.com/package/prop-types-exact
27
- 'Object.freeze', // https://tc39.github.io/ecma262/#sec-object.freeze
28
- ],
29
23
  },
30
24
  // View link below for react rules documentation
31
25
  // https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules
32
26
  rules: {
27
+ // Allow Redux devtools variable
33
28
  'no-underscore-dangle': [
34
29
  dangleRules[0],
35
30
  Object.assign(Object.assign({}, dangleRules[1]), { allow: [...dangleRules[1].allow, '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'] }),
@@ -37,6 +32,7 @@ const reactRules = {
37
32
  // Specify whether double or single quotes should be used in JSX attributes
38
33
  // https://eslint.org/docs/rules/jsx-quotes
39
34
  'jsx-quotes': ['error', 'prefer-double'],
35
+ // Class Methods can be used in react
40
36
  'class-methods-use-this': [
41
37
  'error',
42
38
  {
@@ -60,138 +56,340 @@ const reactRules = {
60
56
  ],
61
57
  },
62
58
  ],
59
+ // Enforces consistent naming for boolean props
60
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
61
+ 'react/boolean-prop-naming': 'off',
62
+ // Prevent usage of button elements without an explicit type attribute
63
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
64
+ 'react/button-has-type': 'error',
63
65
  // This rule enforces onChange or readonly attribute for checked property of input elements.
64
66
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/checked-requires-onchange-or-readonly.md
65
- 'react/checked-requires-onchange-or-readonly': [
66
- 'off',
67
+ 'react/checked-requires-onchange-or-readonly': 'off',
68
+ // Enforce all defaultProps have a corresponding non-required PropType
69
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md
70
+ 'react/default-props-match-prop-types': [
71
+ 'error',
67
72
  {
68
- ignoreMissingProperties: false,
69
- ignoreExclusiveCheckedAttribute: false,
73
+ allowRequiredDefaults: false,
70
74
  },
71
75
  ],
76
+ // Enforce consistent usage of destructuring assignment of props, state, and context
77
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
78
+ 'react/destructuring-assignment': ['error', 'always'],
72
79
  // Prevent missing displayName in a React component definition
73
80
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md
74
- 'react/display-name': ['off', { ignoreTranspilerName: false }],
81
+ 'react/display-name': 'off',
82
+ // Forbid certain props on Components
83
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
84
+ 'react/forbid-component-props': 'off',
85
+ // Forbid certain props on DOM Nodes
86
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-dom-props.md
87
+ 'react/forbid-dom-props': 'off',
88
+ // Forbid certain elements
89
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
90
+ 'react/forbid-elements': 'off',
91
+ // Forbids using non-exported propTypes
92
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
93
+ // this is intentionally set to "warn". it would be "error",
94
+ // but it's only critical if you're stripping propTypes in production.
95
+ 'react/forbid-foreign-prop-types': [
96
+ 'warn',
97
+ {
98
+ allowInPropTypes: true,
99
+ },
100
+ ],
75
101
  // Forbid certain propTypes (any, array, object)
76
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-prop-types.md
102
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
77
103
  'react/forbid-prop-types': [
78
104
  'error',
79
105
  {
80
- forbid: ['any', 'array', 'object'],
81
106
  checkContextTypes: true,
82
107
  checkChildContextTypes: true,
83
108
  },
84
109
  ],
85
- // Forbid certain props on DOM Nodes
86
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-dom-props.md
87
- 'react/forbid-dom-props': ['off', { forbid: [] }],
110
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forward-ref-uses-ref.md
111
+ 'react/forward-ref-uses-ref': 'error',
112
+ // Enforce a specific function type for function components
113
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
114
+ 'react/function-component-definition': [
115
+ 'error',
116
+ {
117
+ namedComponents: ['function-declaration', 'function-expression'],
118
+ unnamedComponents: 'function-expression',
119
+ },
120
+ ],
121
+ // Ensure destructuring and symmetric naming of useState hook value and setter variables
122
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
123
+ 'react/hook-use-state': 'off',
124
+ // Enforce sandbox attribute on iframe elements
125
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md
126
+ 'react/iframe-missing-sandbox': 'off',
88
127
  // Enforce boolean attributes notation in JSX
89
128
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
90
- 'react/jsx-boolean-value': ['error', 'never', { always: [] }],
129
+ 'react/jsx-boolean-value': [
130
+ 'error',
131
+ 'never',
132
+ {
133
+ always: [],
134
+ },
135
+ ],
136
+ // Ensures inline tags are not rendered without spaces between them
137
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-child-element-spacing.md
138
+ 'react/jsx-child-element-spacing': 'off',
91
139
  // Validate closing bracket location in JSX
92
140
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
93
141
  'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
94
142
  // Validate closing tag location in JSX
95
143
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
96
144
  'react/jsx-closing-tag-location': 'error',
97
- // Enforce or disallow spaces inside of curly braces in JSX attributes
145
+ // Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
146
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
147
+ 'react/jsx-curly-brace-presence': [
148
+ 'error',
149
+ {
150
+ props: 'never',
151
+ children: 'never',
152
+ },
153
+ ],
154
+ // Enforce linebreaks in curly braces in JSX attributes and expressions.
155
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
156
+ 'react/jsx-curly-newline': 'error',
157
+ // Enforce or disallow spaces inside curly braces in JSX attributes
98
158
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
99
- 'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
100
- // Enforce event handler naming conventions in JSX
101
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
102
- 'react/jsx-handler-names': [
103
- 'off',
159
+ 'react/jsx-curly-spacing': [
160
+ 'error',
161
+ 'never',
104
162
  {
105
- eventHandlerPrefix: 'handle',
106
- eventHandlerPropPrefix: 'on',
163
+ allowMultiline: true,
107
164
  },
108
165
  ],
166
+ // Enforce spacing around jsx equals signs
167
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
168
+ 'react/jsx-equals-spacing': ['error', 'never'],
169
+ // only .jsx files may have JSX
170
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
171
+ 'react/jsx-filename-extension': [
172
+ 'error',
173
+ {
174
+ extensions: ['.jsx'],
175
+ },
176
+ ],
177
+ // Require that the first prop in a JSX element be on a new line when the element is multiline
178
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
179
+ 'react/jsx-first-prop-new-line': 'error',
180
+ // Enforce shorthand or standard form for React fragments
181
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
182
+ 'react/jsx-fragments': ['error', 'syntax'],
183
+ // Enforce event handler naming conventions in JSX
184
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
185
+ 'react/jsx-handler-names': 'off',
109
186
  // Validate props indentation in JSX
110
187
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
111
188
  'react/jsx-indent-props': ['error', 2],
189
+ // Enforce JSX indentation
190
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
191
+ 'react/jsx-indent': ['error', 2],
112
192
  // Validate JSX has key prop when in array or iterator
113
193
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
114
194
  // Turned off because it has too many false positives
115
195
  'react/jsx-key': 'off',
196
+ // Validate JSX maximum depth
197
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-depth.md
198
+ 'react/jsx-max-depth': 'off',
116
199
  // Limit maximum of props on a single line in JSX
117
200
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
118
- 'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
201
+ 'react/jsx-max-props-per-line': [
202
+ 'error',
203
+ {
204
+ maximum: 1,
205
+ when: 'multiline',
206
+ },
207
+ ],
208
+ // Enforce a new line after jsx elements and expressions
209
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-newline.md
210
+ 'react/jsx-newline': 'off',
119
211
  // Prevent usage of .bind() in JSX props
120
212
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
121
213
  'react/jsx-no-bind': [
122
214
  'error',
123
215
  {
216
+ ignoreDOMComponents: true,
124
217
  ignoreRefs: true,
125
218
  allowArrowFunctions: true,
126
219
  allowFunctions: false,
127
220
  allowBind: false,
128
- ignoreDOMComponents: true,
129
221
  },
130
222
  ],
223
+ // prevent accidental JS comments from being injected into JSX as text
224
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
225
+ 'react/jsx-no-comment-textnodes': 'error',
226
+ // Prevent react contexts from taking non-stable values
227
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-constructed-context-values.md
228
+ 'react/jsx-no-constructed-context-values': 'error',
131
229
  // Prevent duplicate props in JSX
132
230
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
133
- 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
231
+ 'react/jsx-no-duplicate-props': [
232
+ 'error',
233
+ {
234
+ ignoreCase: true,
235
+ },
236
+ ],
237
+ // Prevent problematic leaked values from being rendered
238
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
239
+ 'react/jsx-no-leaked-render': 'off',
134
240
  // Prevent usage of unwrapped JSX strings
135
241
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
136
- 'react/jsx-no-literals': ['off', { noStrings: true }],
242
+ 'react/jsx-no-literals': 'off',
243
+ // Prevent usage of `javascript:` URLs
244
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
245
+ 'react/jsx-no-script-url': [
246
+ 'error',
247
+ [
248
+ {
249
+ name: 'Link',
250
+ props: ['to', 'href'],
251
+ },
252
+ {
253
+ name: 'NavLink',
254
+ props: ['to'],
255
+ },
256
+ // Custom
257
+ {
258
+ name: 'NextLink',
259
+ props: ['to', 'href'],
260
+ },
261
+ ],
262
+ {
263
+ includeFromSettings: true,
264
+ },
265
+ ],
266
+ // Disallow target="_blank" on links
267
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
268
+ 'react/jsx-no-target-blank': [
269
+ 'error',
270
+ {
271
+ allowReferrer: false,
272
+ enforceDynamicLinks: 'always',
273
+ warnOnSpreadAttributes: false,
274
+ links: true,
275
+ forms: false,
276
+ },
277
+ ],
137
278
  // Disallow undeclared variables in JSX
138
279
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
139
- 'react/jsx-no-undef': 'error',
140
- // Enforce PascalCase for user-defined JSX components
141
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
142
- 'react/jsx-pascal-case': [
280
+ 'react/jsx-no-undef': [
143
281
  'error',
144
282
  {
145
- allowAllCaps: true,
146
- ignore: [],
283
+ allowGlobals: false,
147
284
  },
148
285
  ],
149
- // Enforce propTypes declarations alphabetical sorting
150
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
151
- 'react/sort-prop-types': [
152
- 'off',
286
+ // Disallow unnecessary fragments
287
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
288
+ 'react/jsx-no-useless-fragment': [
289
+ 'error',
153
290
  {
154
- ignoreCase: true,
155
- callbacksLast: false,
156
- requiredFirst: false,
157
- sortShapeProp: true,
291
+ allowExpressions: true,
158
292
  },
159
293
  ],
160
- // Deprecated in favor of react/jsx-sort-props
161
- 'react/jsx-sort-prop-types': 'off',
162
- // Enforce props alphabetical sorting
163
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
164
- 'react/jsx-sort-props': [
165
- 'off',
294
+ // One JSX Element Per Line
295
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md
296
+ 'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
297
+ // Enforce PascalCase for user-defined JSX components
298
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
299
+ 'react/jsx-pascal-case': [
300
+ 'error',
166
301
  {
167
- ignoreCase: true,
168
- callbacksLast: false,
169
- shorthandFirst: false,
170
- shorthandLast: false,
171
- noSortAlphabetically: false,
172
- reservedFirst: true,
302
+ allowAllCaps: true,
303
+ allowLeadingUnderscore: false,
304
+ allowNamespace: true,
305
+ ignore: [],
173
306
  },
174
307
  ],
308
+ // Disallow multiple spaces between inline JSX props
309
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md
310
+ 'react/jsx-props-no-multi-spaces': 'error',
311
+ // Disallow JSX prop spreading the same identifier multiple times
312
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spread-multi.md
313
+ 'react/jsx-props-no-spread-multi': 'error',
314
+ // Disallow JSX props spreading
315
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
316
+ 'react/jsx-props-no-spreading': 'off',
175
317
  // Enforce defaultProps declarations alphabetical sorting
176
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
177
- 'react/jsx-sort-default-props': [
178
- 'off',
318
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-default-props.md
319
+ // @deprecated
320
+ 'react/jsx-sort-default-props': 'off',
321
+ // Enforce props alphabetical sorting
322
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
323
+ 'react/jsx-sort-props': 'off',
324
+ // Enforce spaces before the closing bracket of self-closing JSX elements, Deprecated in favor of jsx-tag-spacing
325
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
326
+ // @deprecated
327
+ 'react/jsx-space-before-closing': 'off',
328
+ // Validate whitespace in and around the JSX opening and closing brackets
329
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
330
+ 'react/jsx-tag-spacing': [
331
+ 'error',
179
332
  {
180
- ignoreCase: true,
333
+ closingSlash: 'never',
334
+ beforeSelfClosing: 'always',
335
+ afterOpening: 'never',
336
+ beforeClosing: 'never',
181
337
  },
182
338
  ],
183
339
  // Prevent React to be incorrectly marked as unused
184
340
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
185
- 'react/jsx-uses-react': ['error'],
341
+ 'react/jsx-uses-react': 'error',
186
342
  // Prevent variables used in JSX to be incorrectly marked as unused
187
343
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
188
344
  'react/jsx-uses-vars': 'error',
345
+ // Prevent missing parentheses around multilines JSX
346
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
347
+ 'react/jsx-wrap-multilines': [
348
+ 'error',
349
+ {
350
+ declaration: 'parens-new-line',
351
+ assignment: 'parens-new-line',
352
+ return: 'parens-new-line',
353
+ arrow: 'parens-new-line',
354
+ condition: 'parens-new-line',
355
+ logical: 'parens-new-line',
356
+ prop: 'parens-new-line',
357
+ },
358
+ ],
359
+ // Prevent using this.state within a this.setState
360
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md
361
+ 'react/no-access-state-in-setstate': 'error',
362
+ // Prevent adjacent inline elements not separated by whitespace
363
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md
364
+ 'react/no-adjacent-inline-elements': 'off',
365
+ // Prevent usage of Array index in keys
366
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
367
+ 'react/no-array-index-key': 'error',
368
+ // Lifecycle methods should be methods on the prototype, not class fields
369
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-arrow-function-lifecycle.md
370
+ 'react/no-arrow-function-lifecycle': 'error',
371
+ // Prevent passing of children as props
372
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
373
+ 'react/no-children-prop': [
374
+ 'error',
375
+ {
376
+ allowFunctions: false,
377
+ },
378
+ ],
379
+ // Prevent problem with children and props.dangerouslySetInnerHTML
380
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
381
+ 'react/no-danger-with-children': 'error',
189
382
  // Prevent usage of dangerous JSX properties
190
383
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
191
- 'react/no-danger': 'warn',
384
+ 'react/no-danger': [
385
+ 'warn',
386
+ {
387
+ customComponentNames: [],
388
+ },
389
+ ],
192
390
  // Prevent usage of deprecated methods
193
391
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
194
- 'react/no-deprecated': ['error'],
392
+ 'react/no-deprecated': 'error',
195
393
  // Prevent usage of setState in componentDidMount
196
394
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
197
395
  // this is necessary for server-rendering
@@ -199,33 +397,104 @@ const reactRules = {
199
397
  // Prevent usage of setState in componentDidUpdate
200
398
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
201
399
  'react/no-did-update-set-state': 'error',
202
- // Prevent usage of setState in componentWillUpdate
203
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
204
- 'react/no-will-update-set-state': 'error',
205
400
  // Prevent direct mutation of this.state
206
401
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
207
- 'react/no-direct-mutation-state': 'off',
402
+ 'react/no-direct-mutation-state': 'error',
403
+ // warn against using findDOMNode()
404
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
405
+ 'react/no-find-dom-node': 'error',
406
+ // Prevent usage of invalid attributes
407
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md
408
+ 'react/no-invalid-html-attribute': 'error',
208
409
  // Prevent usage of isMounted
209
410
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
210
411
  'react/no-is-mounted': 'error',
211
412
  // Prevent multiple component definition per file
212
413
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
213
414
  'react/no-multi-comp': 'off',
415
+ // Enforce that namespaces are not used in React elements
416
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-namespace.md
417
+ 'react/no-namespace': 'error',
418
+ // Disallow usage of referential-type variables as default param in functional component
419
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-object-type-as-default-prop.md
420
+ 'react/no-object-type-as-default-prop': 'off',
421
+ // Prevent usage of shouldComponentUpdate when extending React.PureComponent
422
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md
423
+ 'react/no-redundant-should-component-update': 'error',
424
+ // disallow using React.render/ReactDOM.render's return value
425
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
426
+ 'react/no-render-return-value': 'error',
214
427
  // Prevent usage of setState
215
428
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
216
429
  'react/no-set-state': 'off',
217
430
  // Prevent using string references
218
431
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
219
- 'react/no-string-refs': 'error',
432
+ 'react/no-string-refs': [
433
+ 'error',
434
+ {
435
+ noTemplateLiterals: true,
436
+ },
437
+ ],
438
+ // Prevent this from being used in stateless functional components
439
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
440
+ 'react/no-this-in-sfc': 'error',
441
+ // Prevents common casing typos
442
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-typos.md
443
+ 'react/no-typos': 'error',
444
+ // Prevent invalid characters from appearing in markup
445
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
446
+ 'react/no-unescaped-entities': 'error',
220
447
  // Prevent usage of unknown DOM property
221
448
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
222
- 'react/no-unknown-property': 'error',
449
+ 'react/no-unknown-property': [
450
+ 'error',
451
+ {
452
+ ignore: [],
453
+ requireDataLowercase: false,
454
+ },
455
+ ],
456
+ // Prevent usage of UNSAFE_ methods
457
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md
458
+ 'react/no-unsafe': 'off',
459
+ // Prevent creating unstable components inside components
460
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
461
+ 'react/no-unstable-nested-components': 'error',
462
+ // Prevent declaring unused methods of component class
463
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md
464
+ 'react/no-unused-class-component-methods': 'error',
465
+ // Prevent unused propType definitions
466
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
467
+ 'react/no-unused-prop-types': [
468
+ 'error',
469
+ {
470
+ ignore: [],
471
+ customValidators: [],
472
+ skipShapeProps: true,
473
+ },
474
+ ],
475
+ // Prevent unused state values
476
+ // https://github.com/jsx-eslint/eslint-plugin-react/pull/1103/
477
+ 'react/no-unused-state': 'error',
478
+ // Prevent usage of setState in componentWillUpdate
479
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
480
+ 'react/no-will-update-set-state': 'error',
223
481
  // Require ES6 class declarations over React.createClass
224
482
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
225
483
  'react/prefer-es6-class': ['error', 'always'],
484
+ // Prefer exact proptypes definitions
485
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-exact-props.md
486
+ 'react/prefer-exact-props': 'error',
487
+ // Enforce that props are read-only
488
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
489
+ 'react/prefer-read-only-props': 'off',
226
490
  // Require stateless functions when not using lifecycle methods, setState or ref
227
491
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
228
- 'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
492
+ 'react/prefer-stateless-function': [
493
+ 'error',
494
+ {
495
+ ignorePureComponents: true,
496
+ },
497
+ ],
229
498
  // Prevent missing props validation in a React component definition
230
499
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prop-types.md
231
500
  'react/prop-types': [
@@ -239,14 +508,33 @@ const reactRules = {
239
508
  // Prevent missing React when using JSX
240
509
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
241
510
  'react/react-in-jsx-scope': 'error',
511
+ // Enforce a defaultProps definition for every prop that is not a required prop
512
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
513
+ 'react/require-default-props': [
514
+ 'error',
515
+ {
516
+ forbidDefaultForRequired: true,
517
+ classes: 'defaultProps',
518
+ functions: 'defaultArguments',
519
+ },
520
+ ],
521
+ // require a shouldComponentUpdate method, or PureRenderMixin
522
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
523
+ 'react/require-optimization': 'off',
242
524
  // Require render() methods to return something
243
525
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
244
526
  'react/require-render-return': 'error',
245
527
  // Prevent extra closing tags for components without children
246
528
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
247
- 'react/self-closing-comp': 'error',
529
+ 'react/self-closing-comp': [
530
+ 'error',
531
+ {
532
+ component: true,
533
+ html: true,
534
+ },
535
+ ],
248
536
  // Enforce component methods order
249
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
537
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
250
538
  'react/sort-comp': [
251
539
  'error',
252
540
  {
@@ -296,280 +584,29 @@ const reactRules = {
296
584
  },
297
585
  },
298
586
  ],
299
- // Prevent missing parentheses around multilines JSX
300
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
301
- 'react/jsx-wrap-multilines': [
302
- 'error',
303
- {
304
- declaration: 'parens-new-line',
305
- assignment: 'parens-new-line',
306
- return: 'parens-new-line',
307
- arrow: 'parens-new-line',
308
- condition: 'parens-new-line',
309
- logical: 'parens-new-line',
310
- prop: 'parens-new-line',
311
- },
312
- ],
313
- // Require that the first prop in a JSX element be on a new line when the element is multiline
314
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
315
- 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
316
- // Enforce spacing around jsx equals signs
317
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
318
- 'react/jsx-equals-spacing': ['error', 'never'],
319
- // Enforce JSX indentation
320
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
321
- 'react/jsx-indent': ['error', 2],
322
- // Disallow target="_blank" on links
323
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
324
- 'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
325
- // only .jsx files may have JSX
326
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
327
- 'react/jsx-filename-extension': ['error', { extensions: ['.jsx'] }],
328
- // prevent accidental JS comments from being injected into JSX as text
329
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
330
- 'react/jsx-no-comment-textnodes': 'error',
331
- // disallow using React.render/ReactDOM.render's return value
332
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
333
- 'react/no-render-return-value': 'error',
334
- // require a shouldComponentUpdate method, or PureRenderMixin
335
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
336
- 'react/require-optimization': ['off', { allowDecorators: [] }],
337
- // warn against using findDOMNode()
338
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
339
- 'react/no-find-dom-node': 'error',
340
- // Forbid certain props on Components
341
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
342
- 'react/forbid-component-props': ['off', { forbid: [] }],
343
- // Forbid certain elements
344
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
345
- 'react/forbid-elements': ['off', { forbid: [] }],
346
- // Prevent problem with children and props.dangerouslySetInnerHTML
347
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
348
- 'react/no-danger-with-children': 'error',
349
- // Prevent unused propType definitions
350
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
351
- 'react/no-unused-prop-types': [
352
- 'error',
353
- {
354
- customValidators: [],
355
- skipShapeProps: true,
356
- },
357
- ],
358
- // Require style prop value be an object or var
359
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
360
- 'react/style-prop-object': 'error',
361
- // Prevent invalid characters from appearing in markup
362
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
363
- 'react/no-unescaped-entities': 'error',
364
- // Prevent passing of children as props
365
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
366
- 'react/no-children-prop': 'error',
367
- // Validate whitespace in and around the JSX opening and closing brackets
368
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
369
- 'react/jsx-tag-spacing': [
370
- 'error',
371
- {
372
- closingSlash: 'never',
373
- beforeSelfClosing: 'always',
374
- afterOpening: 'never',
375
- beforeClosing: 'never',
376
- },
377
- ],
378
- // Enforce spaces before the closing bracket of self-closing JSX elements
379
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
380
- // Deprecated in favor of jsx-tag-spacing
381
- 'react/jsx-space-before-closing': ['off', 'always'],
382
- // Prevent usage of Array index in keys
383
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
384
- 'react/no-array-index-key': 'error',
385
- // Enforce a defaultProps definition for every prop that is not a required prop
386
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/require-default-props.md
387
- 'react/require-default-props': [
388
- 'error',
389
- {
390
- forbidDefaultForRequired: true,
391
- },
392
- ],
393
- // Forbids using non-exported propTypes
394
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
395
- // this is intentionally set to "warn". it would be "error",
396
- // but it's only critical if you're stripping propTypes in production.
397
- 'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
398
- // Prevent void DOM elements from receiving children
399
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
400
- 'react/void-dom-elements-no-children': 'error',
401
- // Enforce all defaultProps have a corresponding non-required PropType
402
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/default-props-match-prop-types.md
403
- 'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: false }],
404
- // Prevent usage of shouldComponentUpdate when extending React.PureComponent
405
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md
406
- 'react/no-redundant-should-component-update': 'error',
407
- // Prevent unused state values
408
- // https://github.com/jsx-eslint/eslint-plugin-react/pull/1103/
409
- 'react/no-unused-state': 'error',
410
- // Enforces consistent naming for boolean props
411
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
412
- 'react/boolean-prop-naming': [
413
- 'off',
414
- {
415
- propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
416
- rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
417
- message: '',
418
- },
419
- ],
420
- // Prevents common casing typos
421
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/73abadb697034b5ccb514d79fb4689836fe61f91/docs/rules/no-typos.md
422
- 'react/no-typos': 'error',
423
- // Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
424
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
425
- 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
426
- // One JSX Element Per Line
427
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
428
- 'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
429
- // Enforce consistent usage of destructuring assignment of props, state, and context
430
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
431
- 'react/destructuring-assignment': ['error', 'always'],
432
- // Prevent using this.state within a this.setState
433
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-access-state-in-setstate.md
434
- 'react/no-access-state-in-setstate': 'error',
435
- // Prevent usage of button elements without an explicit type attribute
436
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
437
- 'react/button-has-type': [
438
- 'error',
439
- {
440
- button: true,
441
- submit: true,
442
- reset: false,
443
- },
444
- ],
445
- // Ensures inline tags are not rendered without spaces between them
446
- 'react/jsx-child-element-spacing': 'off',
447
- // Prevent this from being used in stateless functional components
448
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md
449
- 'react/no-this-in-sfc': 'error',
450
- // Validate JSX maximum depth
451
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
452
- 'react/jsx-max-depth': 'off',
453
- // Disallow multiple spaces between inline JSX props
454
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
455
- 'react/jsx-props-no-multi-spaces': 'error',
456
- // Prevent usage of UNSAFE_ methods
457
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/157cc932be2cfaa56b3f5b45df6f6d4322a2f660/docs/rules/no-unsafe.md
458
- 'react/no-unsafe': 'off',
459
- // Enforce shorthand or standard form for React fragments
460
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/bc976b837abeab1dffd90ac6168b746a83fc83cc/docs/rules/jsx-fragments.md
461
- 'react/jsx-fragments': ['error', 'syntax'],
462
- // Enforce linebreaks in curly braces in JSX attributes and expressions.
463
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
464
- 'react/jsx-curly-newline': [
465
- 'error',
466
- {
467
- multiline: 'consistent',
468
- singleline: 'consistent',
469
- },
470
- ],
587
+ // Enforce defaultProps declarations alphabetical sorting
588
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-default-props.md
589
+ 'react/sort-default-props': 'off',
590
+ // Enforce propTypes declarations alphabetical sorting
591
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
592
+ 'react/sort-prop-types': 'off',
471
593
  // Enforce state initialization style
472
594
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
473
- // TODO: set to "never" once babel-preset-airbnb supports public class fields
474
595
  'react/state-in-constructor': ['error', 'always'],
475
596
  // Enforces where React component static properties should be positioned
476
597
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
477
- // TODO: set to "static public field" once babel-preset-airbnb supports public class fields
478
598
  'react/static-property-placement': ['error', 'property assignment'],
479
- // Disallow JSX props spreading
480
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
481
- 'react/jsx-props-no-spreading': [
482
- 'error',
483
- {
484
- html: 'enforce',
485
- custom: 'enforce',
486
- explicitSpread: 'ignore',
487
- exceptions: [],
488
- },
489
- ],
490
- // Enforce that props are read-only
491
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
492
- 'react/prefer-read-only-props': 'off',
493
- // Prevent usage of `javascript:` URLs
494
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
495
- 'react/jsx-no-script-url': [
496
- 'error',
497
- [
498
- {
499
- name: 'Link',
500
- props: ['to'],
501
- },
502
- ],
503
- ],
504
- // Disallow unnecessary fragments
505
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
506
- 'react/jsx-no-useless-fragment': 'error',
507
- // Prevent adjacent inline elements not separated by whitespace
508
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md
509
- // TODO: enable? semver-major
510
- 'react/no-adjacent-inline-elements': 'off',
511
- // Enforce a specific function type for function components
512
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
513
- 'react/function-component-definition': [
599
+ // Require style prop value be an object or var
600
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
601
+ 'react/style-prop-object': [
514
602
  'error',
515
603
  {
516
- namedComponents: ['function-declaration', 'function-expression'],
517
- unnamedComponents: 'function-expression',
518
- },
519
- ],
520
- // Enforce a new line after jsx elements and expressions
521
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-newline.md
522
- 'react/jsx-newline': 'off',
523
- // Prevent react contexts from taking non-stable values
524
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-no-constructed-context-values.md
525
- 'react/jsx-no-constructed-context-values': 'error',
526
- // Prevent creating unstable components inside components
527
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/c2a790a3472eea0f6de984bdc3ee2a62197417fb/docs/rules/no-unstable-nested-components.md
528
- 'react/no-unstable-nested-components': 'error',
529
- // Enforce that namespaces are not used in React elements
530
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/no-namespace.md
531
- 'react/no-namespace': 'error',
532
- // Prefer exact proptype definitions
533
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/prefer-exact-props.md
534
- 'react/prefer-exact-props': 'error',
535
- // Lifecycle methods should be methods on the prototype, not class fields
536
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-arrow-function-lifecycle.md
537
- 'react/no-arrow-function-lifecycle': 'error',
538
- // Prevent usage of invalid attributes
539
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-invalid-html-attribute.md
540
- 'react/no-invalid-html-attribute': 'error',
541
- // Prevent declaring unused methods of component class
542
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-unused-class-component-methods.md
543
- 'react/no-unused-class-component-methods': 'error',
544
- // Ensure destructuring and symmetric naming of useState hook value and setter variables
545
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/c8833f301314dab3e79ef7ac4cf863e4d5fa0019/docs/rules/hook-use-state.md
546
- // TODO: semver-major, enable
547
- 'react/hook-use-state': 'off',
548
- // Enforce sandbox attribute on iframe elements
549
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/c8833f301314dab3e79ef7ac4cf863e4d5fa0019/docs/rules/iframe-missing-sandbox.md
550
- // TODO: semver-major, enable
551
- 'react/iframe-missing-sandbox': 'off',
552
- // Prevent problematic leaked values from being rendered
553
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/c42b624d0fb9ad647583a775ab9751091eec066f/docs/rules/jsx-no-leaked-render.md
554
- // TODO: semver-major, enable
555
- 'react/jsx-no-leaked-render': 'off',
556
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/66b58dd4864678eb869a7bf434c72ff7ac530eb1/docs/rules/no-object-type-as-default-prop.md
557
- // TODO: semver-major, enable
558
- 'react/no-object-type-as-default-prop': 'off',
559
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/66b58dd4864678eb869a7bf434c72ff7ac530eb1/docs/rules/sort-default-props.md
560
- // TODO: semver-major, enable?
561
- 'react/sort-default-props': [
562
- 'off',
563
- {
564
- ignoreCase: false,
604
+ allow: [],
565
605
  },
566
606
  ],
567
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/9668ee0762acd5c23f53cd3a372e2d8d9563944d/docs/rules/forward-ref-uses-ref.md
568
- // TODO: semver-major, enable
569
- 'react/forward-ref-uses-ref': 'off',
570
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/9668ee0762acd5c23f53cd3a372e2d8d9563944d/docs/rules/jsx-props-no-spread-multi.md
571
- // TODO: semver-major, enable
572
- 'react/jsx-props-no-spread-multi': 'off',
607
+ // Prevent void DOM elements from receiving children
608
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
609
+ 'react/void-dom-elements-no-children': 'error',
573
610
  },
574
611
  };
575
612
  exports.default = reactRules;