@lumelabs/eslint-config 0.1.0

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