@lumelabs/eslint-config 0.1.0 → 0.2.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 CHANGED
@@ -11,13 +11,13 @@ module.exports = {
11
11
 
12
12
  // View link below for react rules documentation
13
13
  // https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules
14
+ //
15
+ // NOTE: Pure JSX *formatting* rules (jsx-indent, jsx-curly-spacing, jsx-tag-spacing,
16
+ // jsx-wrap-multilines, jsx-closing-bracket-location, etc.) have been removed —
17
+ // Prettier owns formatting and eslint-config-prettier turns them off anyway.
14
18
  rules: {
15
19
  "no-underscore-dangle": "off",
16
20
 
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
21
  "class-methods-use-this": "off",
22
22
 
23
23
  // This rule enforces onChange or readonly attribute for checked property of input elements.
@@ -53,18 +53,6 @@ module.exports = {
53
53
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
54
54
  "react/jsx-boolean-value": ["error", "never", { always: [] }],
55
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
56
  // Enforce event handler naming conventions in JSX
69
57
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
70
58
  "react/jsx-handler-names": [
@@ -75,18 +63,9 @@ module.exports = {
75
63
  },
76
64
  ],
77
65
 
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
66
  // Validate JSX has key prop when in array or iterator
83
67
  // 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" }],
68
+ "react/jsx-key": ["error", { warnOnDuplicates: true }],
90
69
 
91
70
  // Prevent usage of .bind() in JSX props
92
71
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
@@ -129,9 +108,6 @@ module.exports = {
129
108
  },
130
109
  ],
131
110
 
132
- // Deprecated in favor of react/jsx-sort-props
133
- "react/jsx-sort-prop-types": "off",
134
-
135
111
  // Enforce props alphabetical sorting
136
112
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
137
113
  "react/jsx-sort-props": [
@@ -284,33 +260,6 @@ module.exports = {
284
260
  },
285
261
  ],
286
262
 
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
263
  // Disallow target="_blank" on links
315
264
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
316
265
  "react/jsx-no-target-blank": ["error", { enforceDynamicLinks: "always" }],
@@ -369,23 +318,6 @@ module.exports = {
369
318
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
370
319
  "react/no-children-prop": "error",
371
320
 
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
321
  // Prevent usage of Array index in keys
390
322
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
391
323
  "react/no-array-index-key": "error",
@@ -435,10 +367,6 @@ module.exports = {
435
367
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
436
368
  "react/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
437
369
 
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
370
  // Enforce consistent usage of destructuring assignment of props, state, and context
443
371
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
444
372
  "react/destructuring-assignment": "off",
@@ -451,9 +379,6 @@ module.exports = {
451
379
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
452
380
  "react/button-has-type": "off",
453
381
 
454
- // Ensures inline tags are not rendered without spaces between them
455
- "react/jsx-child-element-spacing": "off",
456
-
457
382
  // Prevent this from being used in stateless functional components
458
383
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md
459
384
  "react/no-this-in-sfc": "error",
@@ -462,10 +387,6 @@ module.exports = {
462
387
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
463
388
  "react/jsx-max-depth": "off",
464
389
 
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
390
  // Prevent usage of UNSAFE_ methods
470
391
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/157cc932be2cfaa56b3f5b45df6f6d4322a2f660/docs/rules/no-unsafe.md
471
392
  "react/no-unsafe": "off",
@@ -474,24 +395,12 @@ module.exports = {
474
395
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/bc976b837abeab1dffd90ac6168b746a83fc83cc/docs/rules/jsx-fragments.md
475
396
  "react/jsx-fragments": ["error", "syntax"],
476
397
 
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
398
  // Enforce state initialization style
488
399
  // 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
400
  "react/state-in-constructor": ["error", "always"],
491
401
 
492
402
  // Enforces where React component static properties should be positioned
493
403
  // 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
404
  "react/static-property-placement": ["error", "property assignment"],
496
405
 
497
406
  // Disallow JSX props spreading
@@ -534,10 +443,6 @@ module.exports = {
534
443
  // },
535
444
  // ],
536
445
 
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
446
  // Prevent react contexts from taking non-stable values
542
447
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-no-constructed-context-values.md
543
448
  "react/jsx-no-constructed-context-values": "warn",