@wistia/eslint-config 0.9.0 → 0.9.2
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/configs/eslint/cypress.js +2 -0
- package/configs/eslint/default.js +2 -0
- package/configs/eslint/jest.js +2 -0
- package/configs/eslint/prettier.js +2 -0
- package/configs/eslint/react.js +2 -0
- package/configs/eslint/strict.js +2 -0
- package/configs/eslint/styled-components.js +2 -0
- package/configs/eslint/testing-library.js +2 -0
- package/package.json +13 -5
- package/rules/eslint/errors.js +1 -0
- package/rules/eslint/react.js +34 -34
package/configs/eslint/jest.js
CHANGED
package/configs/eslint/react.js
CHANGED
package/configs/eslint/strict.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Wistia's ESLint configurations",
|
|
5
5
|
"main": "react.js",
|
|
6
6
|
"exports": {
|
|
@@ -18,16 +18,17 @@
|
|
|
18
18
|
"./testing-library": "./configs/eslint/testing-library.js"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"lint": "eslint --fix
|
|
21
|
+
"lint": "eslint --fix .",
|
|
22
22
|
"prepare": "husky install",
|
|
23
|
-
"test": "
|
|
24
|
-
"test:
|
|
23
|
+
"test": "jest",
|
|
24
|
+
"test:export": "check-export-map",
|
|
25
25
|
"test:stylelint": "stylelint --print-config ./test/index.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@babel/core": "^7.18.9",
|
|
29
29
|
"@babel/eslint-parser": "^7.18.9",
|
|
30
30
|
"@babel/preset-react": "^7.18.6",
|
|
31
|
+
"@rushstack/eslint-patch": "^1.1.4",
|
|
31
32
|
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
|
32
33
|
"@typescript-eslint/parser": "^5.30.7",
|
|
33
34
|
"confusing-browser-globals": "^1.0.11",
|
|
@@ -63,11 +64,18 @@
|
|
|
63
64
|
"@commitlint/cli": "^17.0.3",
|
|
64
65
|
"@commitlint/config-conventional": "^17.0.3",
|
|
65
66
|
"check-export-map": "^1.3.0",
|
|
66
|
-
"husky": "^8.0.1"
|
|
67
|
+
"husky": "^8.0.1",
|
|
68
|
+
"jest": "^28.1.3",
|
|
69
|
+
"jest-specific-snapshot": "^5.0.0"
|
|
67
70
|
},
|
|
68
71
|
"engines": {
|
|
69
72
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
|
70
73
|
},
|
|
74
|
+
"jest": {
|
|
75
|
+
"setupFiles": [
|
|
76
|
+
"<rootDir>/test/setupFiles.js"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
71
79
|
"repository": {
|
|
72
80
|
"type": "git",
|
|
73
81
|
"url": "git+https://github.com/wistia/eslint-config.git"
|
package/rules/eslint/errors.js
CHANGED
|
@@ -202,6 +202,7 @@ module.exports = {
|
|
|
202
202
|
|
|
203
203
|
// ensure JSDoc comments are valid
|
|
204
204
|
// https://eslint.org/docs/rules/valid-jsdoc
|
|
205
|
+
// deprecated in favor of https://github.com/gajus/eslint-plugin-jsdoc
|
|
205
206
|
'valid-jsdoc': 'off',
|
|
206
207
|
|
|
207
208
|
// ensure that the results of typeof are compared against a valid string
|
package/rules/eslint/react.js
CHANGED
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
|
18
18
|
// Enforce that class methods utilize this
|
|
19
19
|
// https://eslint.org/docs/rules/class-methods-use-this
|
|
20
20
|
'class-methods-use-this': [
|
|
21
|
-
'
|
|
21
|
+
'error',
|
|
22
22
|
{
|
|
23
23
|
exceptMethods: [
|
|
24
24
|
'render',
|
|
@@ -46,7 +46,7 @@ module.exports = {
|
|
|
46
46
|
'react/display-name': ['off', { ignoreTranspilerName: false }],
|
|
47
47
|
|
|
48
48
|
// Forbid certain propTypes (any, array, object)
|
|
49
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
49
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
|
|
50
50
|
'react/forbid-prop-types': [
|
|
51
51
|
'error',
|
|
52
52
|
{
|
|
@@ -57,7 +57,7 @@ module.exports = {
|
|
|
57
57
|
],
|
|
58
58
|
|
|
59
59
|
// Forbid certain props on DOM Nodes
|
|
60
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
60
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-dom-props.md
|
|
61
61
|
'react/forbid-dom-props': ['off', { forbid: [] }],
|
|
62
62
|
|
|
63
63
|
// Enforce boolean attributes notation in JSX; enable for consistency
|
|
@@ -84,7 +84,7 @@ module.exports = {
|
|
|
84
84
|
eventHandlerPrefix: 'handle',
|
|
85
85
|
eventHandlerPropPrefix: 'on',
|
|
86
86
|
checkLocalVariables: true,
|
|
87
|
-
checkInlineFunction:
|
|
87
|
+
checkInlineFunction: false,
|
|
88
88
|
},
|
|
89
89
|
],
|
|
90
90
|
|
|
@@ -166,7 +166,7 @@ module.exports = {
|
|
|
166
166
|
],
|
|
167
167
|
|
|
168
168
|
// Enforce defaultProps declarations alphabetical sorting
|
|
169
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
169
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-default-props.md
|
|
170
170
|
'react/jsx-sort-default-props': [
|
|
171
171
|
'error',
|
|
172
172
|
{
|
|
@@ -262,7 +262,7 @@ module.exports = {
|
|
|
262
262
|
'react/self-closing-comp': 'error',
|
|
263
263
|
|
|
264
264
|
// Enforce component methods order
|
|
265
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
265
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
|
|
266
266
|
'react/sort-comp': [
|
|
267
267
|
'error',
|
|
268
268
|
{
|
|
@@ -314,7 +314,7 @@ module.exports = {
|
|
|
314
314
|
],
|
|
315
315
|
|
|
316
316
|
// Prevent missing parentheses around multilines JSX
|
|
317
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
317
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
|
|
318
318
|
'react/jsx-wrap-multilines': [
|
|
319
319
|
'error',
|
|
320
320
|
{
|
|
@@ -341,7 +341,7 @@ module.exports = {
|
|
|
341
341
|
'react/jsx-indent': ['error', 2],
|
|
342
342
|
|
|
343
343
|
// Disallow target="_blank" on links
|
|
344
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
344
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
|
|
345
345
|
'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
|
|
346
346
|
|
|
347
347
|
// only .jsx files may have JSX
|
|
@@ -399,7 +399,7 @@ module.exports = {
|
|
|
399
399
|
'react/no-children-prop': 'error',
|
|
400
400
|
|
|
401
401
|
// Validate whitespace in and around the JSX opening and closing brackets
|
|
402
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
402
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
|
|
403
403
|
'react/jsx-tag-spacing': [
|
|
404
404
|
'error',
|
|
405
405
|
{
|
|
@@ -420,7 +420,7 @@ module.exports = {
|
|
|
420
420
|
'react/no-array-index-key': 'error',
|
|
421
421
|
|
|
422
422
|
// Enforce a defaultProps definition for every prop that is not a required prop
|
|
423
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
423
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
|
|
424
424
|
'react/require-default-props': [
|
|
425
425
|
'error',
|
|
426
426
|
{
|
|
@@ -437,11 +437,11 @@ module.exports = {
|
|
|
437
437
|
'react/void-dom-elements-no-children': 'error',
|
|
438
438
|
|
|
439
439
|
// Enforce all defaultProps have a corresponding non-required PropType
|
|
440
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
440
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md
|
|
441
441
|
'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: false }],
|
|
442
442
|
|
|
443
443
|
// Prevent usage of shouldComponentUpdate when extending React.PureComponent
|
|
444
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
444
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md
|
|
445
445
|
'react/no-redundant-should-component-update': 'error',
|
|
446
446
|
|
|
447
447
|
// Prevent unused state values
|
|
@@ -449,7 +449,7 @@ module.exports = {
|
|
|
449
449
|
'react/no-unused-state': 'error',
|
|
450
450
|
|
|
451
451
|
// Enforces consistent naming for boolean props
|
|
452
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
452
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
|
|
453
453
|
'react/boolean-prop-naming': [
|
|
454
454
|
'off',
|
|
455
455
|
{
|
|
@@ -460,7 +460,7 @@ module.exports = {
|
|
|
460
460
|
],
|
|
461
461
|
|
|
462
462
|
// Prevents common casing typos
|
|
463
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
463
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-typos.md
|
|
464
464
|
'react/no-typos': 'error',
|
|
465
465
|
|
|
466
466
|
// Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
|
|
@@ -469,20 +469,20 @@ module.exports = {
|
|
|
469
469
|
|
|
470
470
|
// One JSX Element Per Line
|
|
471
471
|
// disabled because it is overreaching in it's prescriptiveness
|
|
472
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
472
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md
|
|
473
473
|
'react/jsx-one-expression-per-line': ['off', { allow: 'single-child' }],
|
|
474
474
|
|
|
475
475
|
// Enforce consistent usage of destructuring assignment of props, state, and context
|
|
476
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
|
|
476
477
|
// decision: it's acceptable to mix these even at the expense of consistency
|
|
477
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
|
|
478
478
|
'react/destructuring-assignment': ['off', 'always'],
|
|
479
479
|
|
|
480
480
|
// Prevent using this.state within a this.setState
|
|
481
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
481
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md
|
|
482
482
|
'react/no-access-state-in-setstate': 'error',
|
|
483
483
|
|
|
484
484
|
// Prevent usage of button elements without an explicit type attribute
|
|
485
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
485
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
|
|
486
486
|
'react/button-has-type': [
|
|
487
487
|
'error',
|
|
488
488
|
{
|
|
@@ -496,23 +496,23 @@ module.exports = {
|
|
|
496
496
|
'react/jsx-child-element-spacing': 'off',
|
|
497
497
|
|
|
498
498
|
// Prevent this from being used in stateless functional components
|
|
499
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
499
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
|
|
500
500
|
'react/no-this-in-sfc': 'error',
|
|
501
501
|
|
|
502
502
|
// Validate JSX maximum depth
|
|
503
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
503
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-depth.md
|
|
504
504
|
'react/jsx-max-depth': 'off',
|
|
505
505
|
|
|
506
506
|
// Disallow multiple spaces between inline JSX props
|
|
507
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
507
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md
|
|
508
508
|
'react/jsx-props-no-multi-spaces': 'error',
|
|
509
509
|
|
|
510
510
|
// Prevent usage of UNSAFE_ methods
|
|
511
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
511
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md
|
|
512
512
|
'react/no-unsafe': 'off',
|
|
513
513
|
|
|
514
514
|
// Enforce shorthand or standard form for React fragments
|
|
515
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
515
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
516
516
|
'react/jsx-fragments': ['error', 'syntax'],
|
|
517
517
|
|
|
518
518
|
// Enforce linebreaks in curly braces in JSX attributes and expressions.
|
|
@@ -580,48 +580,48 @@ module.exports = {
|
|
|
580
580
|
],
|
|
581
581
|
|
|
582
582
|
// Enforce a new line after jsx elements and expressions
|
|
583
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
583
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-newline.md
|
|
584
584
|
'react/jsx-newline': 'off',
|
|
585
585
|
|
|
586
586
|
// Prevent react contexts from taking non-stable values
|
|
587
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
587
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-constructed-context-values.md
|
|
588
588
|
'react/jsx-no-constructed-context-values': 'error',
|
|
589
589
|
|
|
590
590
|
// Prevent creating unstable components inside components
|
|
591
591
|
// decision: adjusted to allow for render props
|
|
592
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
592
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
|
|
593
593
|
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
|
|
594
594
|
|
|
595
595
|
// Enforce that namespaces are not used in React elements
|
|
596
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
596
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-namespace.md
|
|
597
597
|
'react/no-namespace': 'error',
|
|
598
598
|
|
|
599
599
|
// Prefer exact proptype definitions
|
|
600
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
600
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-exact-props.md
|
|
601
601
|
'react/prefer-exact-props': 'error',
|
|
602
602
|
|
|
603
603
|
// Lifecycle methods should be methods on the prototype, not class fields
|
|
604
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
604
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-arrow-function-lifecycle.md
|
|
605
605
|
'react/no-arrow-function-lifecycle': 'error',
|
|
606
606
|
|
|
607
607
|
// Prevent usage of invalid attributes
|
|
608
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
608
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md
|
|
609
609
|
'react/no-invalid-html-attribute': 'error',
|
|
610
610
|
|
|
611
611
|
// Prevent declaring unused methods of component class
|
|
612
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
612
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md
|
|
613
613
|
'react/no-unused-class-component-methods': 'error',
|
|
614
614
|
|
|
615
615
|
// Ensure destructuring and symmetric naming of useState hook value and setter variables
|
|
616
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
616
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
617
617
|
'react/hook-use-state': 'error',
|
|
618
618
|
|
|
619
619
|
// Enforce sandbox attribute on iframe elements
|
|
620
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
620
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md
|
|
621
621
|
'react/iframe-missing-sandbox': 'error',
|
|
622
622
|
|
|
623
623
|
// Prevent problematic leaked values from being rendered
|
|
624
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/
|
|
624
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
|
|
625
625
|
'react/jsx-no-leaked-render': 'error',
|
|
626
626
|
},
|
|
627
627
|
|