@prowise/eslint-config-linting-rules 0.0.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.
@@ -0,0 +1,765 @@
1
+ const assign = require("object.assign");
2
+ const { rules: baseRules } = require("./base-rules");
3
+
4
+ const dangleRules = baseRules["no-underscore-dangle"];
5
+
6
+ module.exports = {
7
+ /*
8
+ * ✅ recommended
9
+ * 🔧 fixable
10
+ * 💡 has suggestion
11
+ */
12
+
13
+ plugins: ["react"],
14
+ parser: { ecmaFeatures: { jsx: true } },
15
+ rules: {
16
+ // override baseRules
17
+ "no-underscore-dangle": [
18
+ dangleRules[0],
19
+ assign({}, dangleRules[1], {
20
+ allow: dangleRules[1].allow.concat(["__REDUX_DEVTOOLS_EXTENSION_COMPOSE__"]),
21
+ }),
22
+ ],
23
+
24
+ "jsx-quotes": ["error", "prefer-double"],
25
+
26
+ "class-methods-use-this": [
27
+ "error",
28
+ {
29
+ exceptMethods: [
30
+ "render",
31
+ "getInitialState",
32
+ "getDefaultProps",
33
+ "getChildContext",
34
+ "componentWillMount",
35
+ "UNSAFE_componentWillMount",
36
+ "componentDidMount",
37
+ "componentWillReceiveProps",
38
+ "UNSAFE_componentWillReceiveProps",
39
+ "shouldComponentUpdate",
40
+ "componentWillUpdate",
41
+ "UNSAFE_componentWillUpdate",
42
+ "componentDidUpdate",
43
+ "componentWillUnmount",
44
+ "componentDidCatch",
45
+ "getSnapshotBeforeUpdate",
46
+ ],
47
+ },
48
+ ],
49
+
50
+ /**
51
+ * Enforces consistent naming for boolean props
52
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md.
53
+ */
54
+ "react/boolean-prop-naming": [
55
+ "off",
56
+ {
57
+ propTypeNames: ["bool", "mutuallyExclusiveTrueProps"],
58
+ rule: "^(is|has)[A-Z]([A-Za-z0-9]?)+",
59
+ message: "",
60
+ },
61
+ ],
62
+
63
+ /**
64
+ * Disallow usage of button elements without an explicit type attribute
65
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md.
66
+ */
67
+ "react/button-has-type": ["error", { button: true, submit: true, reset: false }],
68
+
69
+ /**
70
+ * Enforce all defaultProps have a corresponding non-required PropType
71
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md.
72
+ */
73
+ "react/default-props-match-prop-types": ["error", { allowRequiredDefaults: false }],
74
+
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
+ */
79
+ "react/destructuring-assignment": ["error", "always"],
80
+
81
+ /**
82
+ * Disallow missing displayName in a React component definition ✅
83
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md.
84
+ */
85
+ "react/display-name": ["off", { ignoreTranspilerName: false }],
86
+
87
+ /**
88
+ * Forbid certain props on Components
89
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md.
90
+ */
91
+ "react/forbid-component-props": ["off", { forbid: [] }],
92
+
93
+ /**
94
+ * Disallow certain props on DOM Nodes
95
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-dom-props.md.
96
+ */
97
+ "react/forbid-dom-props": ["off", { forbid: [] }],
98
+
99
+ /**
100
+ * Disallow certain elements
101
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md.
102
+ */
103
+ "react/forbid-elements": ["off", { forbid: [] }],
104
+
105
+ /**
106
+ * Disallow using another component"s propTypes
107
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
108
+ * this is intentionally set to "warn". It would be "error",
109
+ * but it"s only critical if you"re stripping propTypes in production.
110
+ */
111
+ "react/forbid-foreign-prop-types": ["warn", { allowInPropTypes: true }],
112
+
113
+ /**
114
+ * Disallow certain propTypes
115
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react/forbid-prop-types.md.
116
+ */
117
+ "react/forbid-prop-types": [
118
+ "error",
119
+ {
120
+ forbid: ["any", "array", "object"],
121
+ checkContextTypes: true,
122
+ checkChildContextTypes: true,
123
+ },
124
+ ],
125
+
126
+ /**
127
+ * Enforce a specific function type for function components 🔧
128
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md.
129
+ */
130
+ "react/function-component-definition": [
131
+ "error",
132
+ {
133
+ namedComponents: ["function-declaration", "function-expression"],
134
+ unnamedComponents: "function-expression",
135
+ },
136
+ ],
137
+
138
+ /**
139
+ * Ensure destructuring and symmetric naming of useState hook value and setter variables 💡
140
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md.
141
+ */
142
+ "react/hook-use-state": "error",
143
+
144
+ /**
145
+ * Enforce sandbox attribute on iframe elements
146
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md.
147
+ */
148
+ "react/iframe-missing-sandbox": "off",
149
+
150
+ /**
151
+ * Disallow when this.state is accessed within setState
152
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md.
153
+ */
154
+ "react/no-access-state-in-setstate": "error",
155
+
156
+ /**
157
+ * Disallow adjacent inline elements not separated by whitespace.
158
+ * Https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md.
159
+ */
160
+ "react/no-adjacent-inline-elements": "error",
161
+
162
+ /**
163
+ * Disallow usage of Array index in keys
164
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md.
165
+ */
166
+ "react/no-array-index-key": "error",
167
+
168
+ /**
169
+ * Lifecycle methods should be methods on the prototype, not class fields 🔧
170
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-arrow-function-lifecycle.md.
171
+ */
172
+ "react/no-arrow-function-lifecycle": "error",
173
+
174
+ /**
175
+ * Disallow passing of children as props ✅
176
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md.
177
+ */
178
+ "react/no-children-prop": "error",
179
+
180
+ /**
181
+ * Disallow usage of dangerous JSX properties
182
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md.
183
+ */
184
+ "react/no-danger": "warn",
185
+
186
+ /**
187
+ * Disallow when a DOM element is using both children and dangerouslySetInnerHTML ✅
188
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md.
189
+ */
190
+ "react/no-danger-with-children": "error",
191
+
192
+ /**
193
+ * Disallow usage of deprecated methods ✅
194
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md.
195
+ */
196
+ "react/no-deprecated": "error",
197
+
198
+ /**
199
+ * Disallow usage of setState in componentDidMount
200
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md.
201
+ */
202
+ "react/no-did-mount-set-state": "off",
203
+
204
+ /**
205
+ * Disallow usage of setState in componentDidUpdate
206
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md.
207
+ */
208
+ "react/no-did-update-set-state": "error",
209
+
210
+ /**
211
+ * Disallow direct mutation of this.state ✅
212
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md.
213
+ */
214
+ "react/no-direct-mutation-state": "off",
215
+
216
+ /**
217
+ * Disallow usage of findDOMNode no-find-dom-node ✅
218
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md.
219
+ */
220
+ "react/no-find-dom-node": "error",
221
+
222
+ /**
223
+ * Disallow usage of invalid attributes
224
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md.
225
+ */
226
+ "react/no-invalid-html-attribute": "error",
227
+
228
+ /**
229
+ * Disallow usage of isMounted ✅
230
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md.
231
+ */
232
+ "react/no-is-mounted": "error",
233
+
234
+ /**
235
+ * Disallow multiple component definition per file
236
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md.
237
+ */
238
+ "react/no-multi-comp": "off",
239
+
240
+ /**
241
+ * Enforce that namespaces are not used in React elements
242
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-namespace.md.
243
+ */
244
+ "react/no-namespace": "error",
245
+
246
+ /**
247
+ * Disallow usage of shouldComponentUpdate when extending React.PureComponent
248
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md.
249
+ */
250
+ "react/no-redundant-should-component-update": "error",
251
+
252
+ /**
253
+ * Disallow usage of the return value of ReactDOM.render ✅
254
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md.
255
+ */
256
+ "react/no-render-return-value": "error",
257
+
258
+ /**
259
+ * Disallow usage of setState
260
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-set-state.md.
261
+ */
262
+ "react/no-set-state": "off",
263
+
264
+ /**
265
+ * Disallow using string references ✅
266
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md.
267
+ */
268
+ "react/no-string-refs": "error",
269
+
270
+ /**
271
+ * Disallow this from being used in stateless functional components
272
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md.
273
+ */
274
+ "react/no-this-in-sfc": "error",
275
+
276
+ /**
277
+ * Disallow common typos
278
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-typos.md.
279
+ */
280
+ "react/no-typos": "error",
281
+
282
+ /**
283
+ * Disallow unescaped HTML entities from appearing in markup ✅
284
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md.
285
+ */
286
+ "react/no-unescaped-entities": "error",
287
+
288
+ /**
289
+ * Disallow usage of unknown DOM property ✅ 🔧
290
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md.
291
+ */
292
+ "react/no-unknown-property": "error",
293
+
294
+ /**
295
+ * Disallow usage of unsafe lifecycle methods
296
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md.
297
+ */
298
+ "react/no-unsafe": "off",
299
+
300
+ /**
301
+ * Disallow creating unstable components inside components
302
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md.
303
+ */
304
+ "react/no-unstable-nested-components": "error",
305
+
306
+ /**
307
+ * Disallow declaring unused methods of component class
308
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md.
309
+ */
310
+ "react/no-unused-class-component-methods": "error",
311
+
312
+ /**
313
+ * Disallow definitions of unused propTypes
314
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md.
315
+ */
316
+ "react/no-unused-prop-types": ["error", { customValidators: [], skipShapeProps: true }],
317
+
318
+ /**
319
+ * Disallow definitions of unused state
320
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-state.md.
321
+ */
322
+ "react/no-unused-state": "error",
323
+
324
+ /**
325
+ * Disallow usage of setState in componentWillUpdate
326
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md.
327
+ */
328
+ "react/no-will-update-set-state": "error",
329
+
330
+ /**
331
+ * Enforce ES5 or ES6 class for React Components
332
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md.
333
+ */
334
+ "react/prefer-es6-class": ["error", "always"],
335
+
336
+ /**
337
+ * Prefer exact proptype definitions
338
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-exact-props.md.
339
+ */
340
+ "react/prefer-exact-props": "error",
341
+
342
+ /**
343
+ * Enforce that props are read-only 🔧
344
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md.
345
+ */
346
+ "react/prefer-read-only-props": "off",
347
+
348
+ /**
349
+ * Enforce stateless components to be written as a pure function
350
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md.
351
+ */
352
+ "react/prefer-stateless-function": ["error", { ignorePureComponents: true }],
353
+
354
+ /**
355
+ * Disallow missing props validation in a React component definition ✅
356
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prop-types.md.
357
+ */
358
+ "react/prop-types": [
359
+ "error",
360
+ {
361
+ ignore: [],
362
+ customValidators: [],
363
+ skipUndeclared: false,
364
+ },
365
+ ],
366
+
367
+ /**
368
+ * Disallow missing React when using JSX ✅
369
+ * Off: React is defined as a global variable and doesn't need to be in scope
370
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md.
371
+ */
372
+ "react/react-in-jsx-scope": "off",
373
+
374
+ /**
375
+ * Enforce a defaultProps definition for every prop that is not a required prop
376
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md.
377
+ */
378
+ "react/require-default-props": ["error", { forbidDefaultForRequired: true }],
379
+
380
+ /**
381
+ * Enforce React components to have a shouldComponentUpdate method
382
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-optimization.md.
383
+ */
384
+ "react/require-optimization": ["off", { allowDecorators: [] }],
385
+
386
+ /**
387
+ * Enforce ES5 or ES6 class for returning value in render function ✅
388
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md.
389
+ */
390
+ "react/require-render-return": "error",
391
+
392
+ /**
393
+ * Disallow extra closing tags for components without children 🔧
394
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md.
395
+ */
396
+ "react/self-closing-comp": "error",
397
+
398
+ /**
399
+ * Enforce component methods order
400
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-comp.md.
401
+ */
402
+ "react/sort-comp": [
403
+ "error",
404
+ {
405
+ order: [
406
+ "static-variables",
407
+ "static-methods",
408
+ "instance-variables",
409
+ "lifecycle",
410
+ "/^handle.+$/",
411
+ "/^on.+$/",
412
+ "getters",
413
+ "setters",
414
+ "/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
415
+ "instance-methods",
416
+ "everything-else",
417
+ "rendering",
418
+ ],
419
+ groups: {
420
+ lifecycle: [
421
+ "displayName",
422
+ "propTypes",
423
+ "contextTypes",
424
+ "childContextTypes",
425
+ "mixins",
426
+ "statics",
427
+ "defaultProps",
428
+ "constructor",
429
+ "getDefaultProps",
430
+ "getInitialState",
431
+ "state",
432
+ "getChildContext",
433
+ "getDerivedStateFromProps",
434
+ "componentWillMount",
435
+ "UNSAFE_componentWillMount",
436
+ "componentDidMount",
437
+ "componentWillReceiveProps",
438
+ "UNSAFE_componentWillReceiveProps",
439
+ "shouldComponentUpdate",
440
+ "componentWillUpdate",
441
+ "UNSAFE_componentWillUpdate",
442
+ "getSnapshotBeforeUpdate",
443
+ "componentDidUpdate",
444
+ "componentDidCatch",
445
+ "componentWillUnmount",
446
+ ],
447
+ rendering: ["/^render.+$/", "render"],
448
+ },
449
+ },
450
+ ],
451
+
452
+ /**
453
+ * Enforce propTypes declarations alphabetical sorting
454
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md.
455
+ */
456
+ "react/sort-prop-types": [
457
+ "off",
458
+ {
459
+ ignoreCase: true,
460
+ callbacksLast: false,
461
+ requiredFirst: false,
462
+ sortShapeProp: true,
463
+ },
464
+ ],
465
+
466
+ /**
467
+ * Enforce class component state initialization style
468
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md.
469
+ */
470
+ "react/state-in-constructor": ["error", "always"],
471
+
472
+ /**
473
+ * Enforces where React component static properties should be positioned.
474
+ * Https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md.
475
+ */
476
+ "react/static-property-placement": ["error", "property assignment"],
477
+
478
+ /**
479
+ * Enforce style prop value is an object
480
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md.
481
+ */
482
+ "react/style-prop-object": "error",
483
+
484
+ /**
485
+ * Disallow void DOM elements (e.g. <img />, <br />) from receiving children
486
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md.
487
+ */
488
+ "react/void-dom-elements-no-children": "error",
489
+
490
+ /**
491
+ * Enforce boolean attributes notation in JSX 🔧
492
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md.
493
+ */
494
+ "react/jsx-boolean-value": ["error", "never", { always: [] }],
495
+
496
+ /**
497
+ * Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
498
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-child-element-spacing.md.
499
+ */
500
+ "react/jsx-child-element-spacing": "off",
501
+
502
+ /**
503
+ * Enforce closing bracket location in JSX 🔧
504
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md.
505
+ */
506
+ "react/jsx-closing-bracket-location": ["error", "line-aligned"],
507
+
508
+ /**
509
+ * Enforce closing tag location for multiline JSX 🔧
510
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md.
511
+ */
512
+ "react/jsx-closing-tag-location": "error",
513
+
514
+ /**
515
+ * Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions
516
+ * on literals in JSX children or attributes 🔧
517
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md.
518
+ */
519
+ "react/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
520
+
521
+ /**
522
+ * Enforce consistent linebreaks in curly braces in JSX attributes and expressions
523
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md.
524
+ */
525
+ "react/jsx-curly-newline": ["error", { multiline: "consistent", singleline: "consistent" }],
526
+
527
+ /**
528
+ * Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
529
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md.
530
+ */
531
+ "react/jsx-curly-spacing": ["error", "never", { allowMultiline: true }],
532
+
533
+ /**
534
+ * Enforce or disallow spaces around equal signs in JSX attributes
535
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md.
536
+ */
537
+ "react/jsx-equals-spacing": ["error", "never"],
538
+
539
+ /**
540
+ * Disallow file extensions that may contain JSX
541
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md.
542
+ */
543
+ "react/jsx-filename-extension": ["error", { extensions: [".jsx"] }],
544
+
545
+ /**
546
+ * Enforce proper position of the first property in JSX
547
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md.
548
+ */
549
+ "react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
550
+
551
+ /**
552
+ * Enforce shorthand or standard form for React fragments
553
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md.
554
+ */
555
+ "react/jsx-fragments": ["error", "syntax"],
556
+
557
+ /**
558
+ * Enforce event handler naming conventions in JSX
559
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md.
560
+ */
561
+ "react/jsx-handler-names": ["off", { eventHandlerPrefix: "handle", eventHandlerPropPrefix: "on" }],
562
+
563
+ /**
564
+ * Enforce JSX indentation 🔧
565
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md.
566
+ */
567
+ "react/jsx-indent": ["error", 4],
568
+
569
+ /**
570
+ * Enforce props indentation in JSX 🔧
571
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md.
572
+ */
573
+ "react/jsx-indent-props": ["error", 4],
574
+
575
+ /**
576
+ * Disallow missing key props in iterators/collection literals ✅
577
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md.
578
+ */
579
+ "react/jsx-key": "off",
580
+
581
+ /**
582
+ * Enforce JSX maximum depth
583
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-depth.md.
584
+ */
585
+ "react/jsx-max-depth": "off",
586
+
587
+ /**
588
+ * Enforce maximum of props on a single line in JSX 🔧
589
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md.
590
+ */
591
+ "react/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
592
+
593
+ /**
594
+ * Require or prevent a new line after jsx elements and expressions. 🔧
595
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-newline.md.
596
+ */
597
+ "react/jsx-newline": "off",
598
+
599
+ /**
600
+ * Disallow .bind() or arrow functions in JSX props
601
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md.
602
+ */
603
+ "react/jsx-no-bind": [
604
+ "error",
605
+ {
606
+ ignoreRefs: true,
607
+ allowArrowFunctions: true,
608
+ allowFunctions: false,
609
+ allowBind: false,
610
+ ignoreDOMComponents: true,
611
+ },
612
+ ],
613
+
614
+ /**
615
+ * Disallow comments from being inserted as text nodes ✅
616
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md.
617
+ */
618
+ "react/jsx-no-comment-textnodes": "error",
619
+
620
+ /**
621
+ * Disallows JSX context provider values from taking values that will cause needless rerenders
622
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-constructed-context-values.md.
623
+ */
624
+ "react/jsx-no-constructed-context-values": "error",
625
+
626
+ /**
627
+ * Disallow duplicate properties in JSX ✅
628
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md.
629
+ */
630
+ "react/jsx-no-duplicate-props": ["error", { ignoreCase: true }],
631
+
632
+ /**
633
+ * Disallow problematic leaked values from being rendered 🔧
634
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md.
635
+ */
636
+ "react/jsx-no-leaked-render": "warn",
637
+
638
+ /**
639
+ * Disallow usage of string literals in JSX
640
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md.
641
+ */
642
+ "react/jsx-no-literals": ["off", { noStrings: true }],
643
+
644
+ /**
645
+ * Disallow usage of javascript: URLs 🔧
646
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md.
647
+ */
648
+ "react/jsx-no-script-url": ["error", [{ name: "Link", props: ["to"] }]],
649
+
650
+ /**
651
+ * Disallow target="_blank" attribute without rel="noreferrer" ✅ 🔧
652
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md.
653
+ */
654
+ "react/jsx-no-target-blank": ["error", { enforceDynamicLinks: "always" }],
655
+
656
+ /**
657
+ * Disallow undeclared variables in JSX ✅
658
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md.
659
+ */
660
+ "react/jsx-no-undef": "error",
661
+
662
+ /**
663
+ * Disallow unnecessary fragments 🔧
664
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md.
665
+ */
666
+ "react/jsx-no-useless-fragment": "error",
667
+
668
+ /**
669
+ * Require one JSX element per line 🔧
670
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md.
671
+ */
672
+ "react/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
673
+
674
+ /**
675
+ * Enforce PascalCase for user-defined JSX components
676
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md.
677
+ */
678
+ "react/jsx-pascal-case": ["error", { allowAllCaps: true, ignore: [] }],
679
+
680
+ /**
681
+ * Disallow multiple spaces between inline JSX props 🔧
682
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md.
683
+ */
684
+ "react/jsx-props-no-multi-spaces": "error",
685
+
686
+ /**
687
+ * Disallow JSX prop spreading
688
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md.
689
+ */
690
+ "react/jsx-props-no-spreading": [
691
+ "error",
692
+ {
693
+ html: "enforce",
694
+ custom: "enforce",
695
+ explicitSpread: "ignore",
696
+ exceptions: [],
697
+ },
698
+ ],
699
+
700
+ /**
701
+ * Enforce all defaultProps have a corresponding non-required PropType
702
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md.
703
+ */
704
+ "react/jsx-sort-default-props": ["off", { ignoreCase: true }],
705
+
706
+ /**
707
+ * Enforce props alphabetical sorting
708
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md.
709
+ */
710
+ "react/jsx-sort-props": [
711
+ "off",
712
+ {
713
+ ignoreCase: true,
714
+ callbacksLast: false,
715
+ shorthandFirst: false,
716
+ shorthandLast: false,
717
+ noSortAlphabetically: false,
718
+ reservedFirst: true,
719
+ },
720
+ ],
721
+
722
+ /**
723
+ * Enforce whitespace in and around the JSX opening and closing brackets 🔧
724
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md.
725
+ */
726
+ "react/jsx-tag-spacing": [
727
+ "error",
728
+ {
729
+ closingSlash: "never",
730
+ beforeSelfClosing: "always",
731
+ afterOpening: "never",
732
+ beforeClosing: "never",
733
+ },
734
+ ],
735
+
736
+ /**
737
+ * Disallow React to be incorrectly marked as unused ✅
738
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md.
739
+ */
740
+ "react/jsx-uses-react": "error",
741
+
742
+ /**
743
+ * Disallow variables used in JSX to be incorrectly marked as unused ✅
744
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md.
745
+ */
746
+ "react/jsx-uses-vars": "error",
747
+
748
+ /**
749
+ * Disallow missing parentheses around multiline JSX 🔧
750
+ * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md.
751
+ */
752
+ "react/jsx-wrap-multilines": [
753
+ "error",
754
+ {
755
+ declaration: "parens-new-line",
756
+ assignment: "parens-new-line",
757
+ return: "parens-new-line",
758
+ arrow: "parens-new-line",
759
+ condition: "parens-new-line",
760
+ logical: "parens-new-line",
761
+ prop: "parens-new-line",
762
+ },
763
+ ],
764
+ },
765
+ };