@wistia/eslint-config 0.7.2 → 0.9.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/README.md CHANGED
@@ -12,7 +12,4 @@ Wistia's ESLint configuration. This repo is "pseudo-public" - private on our org
12
12
  2. should not contradict existing rules
13
13
  3. person/team adding new rules handles upgrading consumers and fixing violations
14
14
  4. rules should always be set to `error`, never `warn` (the latter are never fixed)
15
-
16
- ## Publishing
17
-
18
- TODO!
15
+ 5. add short description of rule & link to rule definition in code comments
@@ -4,17 +4,13 @@ module.exports = {
4
4
  ecmaVersion: 2018,
5
5
  sourceType: 'module',
6
6
  },
7
- plugins: ['eslint-plugin-prettier'],
8
7
  extends: [
9
8
  '../../rules/eslint/best-practices',
10
9
  '../../rules/eslint/errors',
11
10
  '../../rules/eslint/es6',
12
- '../../rules/eslint/globals',
13
11
  '../../rules/eslint/imports',
14
12
  '../../rules/eslint/node',
15
13
  '../../rules/eslint/style',
16
14
  '../../rules/eslint/variables',
17
- '../../rules/eslint/prettier',
18
- 'eslint-config-prettier',
19
15
  ].map(require.resolve),
20
16
  };
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ plugins: ['eslint-plugin-prettier'],
3
+ extends: ['../../rules/eslint/prettier', 'eslint-config-prettier'].map(require.resolve),
4
+ };
@@ -3,22 +3,9 @@ module.exports = {
3
3
  browser: true,
4
4
  },
5
5
  parser: '@babel/eslint-parser',
6
- plugins: ['eslint-plugin-prettier'],
7
6
  extends: [
8
- // base
9
- '../../rules/eslint/best-practices',
10
- '../../rules/eslint/errors',
11
- '../../rules/eslint/es6',
12
- '../../rules/eslint/globals',
13
- '../../rules/eslint/imports',
14
- '../../rules/eslint/node',
15
- '../../rules/eslint/style',
16
- '../../rules/eslint/variables',
17
- // react
18
7
  '../../rules/eslint/react',
19
8
  '../../rules/eslint/react-a11y',
20
9
  '../../rules/eslint/react-hooks.js',
21
- '../../rules/eslint/prettier',
22
- 'eslint-config-prettier',
23
10
  ].map(require.resolve),
24
11
  };
File without changes
package/package.json CHANGED
@@ -1,25 +1,28 @@
1
1
  {
2
2
  "name": "@wistia/eslint-config",
3
- "version": "0.7.2",
3
+ "version": "0.9.0",
4
4
  "description": "Wistia's ESLint configurations",
5
5
  "main": "react.js",
6
6
  "exports": {
7
7
  "./package.json": "./package.json",
8
8
  ".": "./configs/eslint/default.js",
9
- "./react": "./configs/eslint/react.js",
10
9
  "./cypress": "./configs/eslint/cypress.js",
11
10
  "./jest": "./configs/eslint/jest.js",
12
- "./sonar": "./configs/eslint/sonar.js",
11
+ "./prettier": "./configs/eslint/prettier.js",
12
+ "./react": "./configs/eslint/react.js",
13
+ "./strict": "./configs/eslint/strict.js",
13
14
  "./styled-components": "./configs/eslint/styled-components.js",
14
- "./testing-library": "./configs/eslint/testing-library.js",
15
15
  "./stylelint": "./configs/stylelint/default.js",
16
16
  "./stylelint/scss": "./configs/stylelint/scss.js",
17
- "./stylelint/styled-components": "./configs/stylelint/styled-components.js"
17
+ "./stylelint/styled-components": "./configs/stylelint/styled-components.js",
18
+ "./testing-library": "./configs/eslint/testing-library.js"
18
19
  },
19
20
  "scripts": {
20
21
  "lint": "eslint --fix --ignore-path test/.eslintignore .",
21
22
  "prepare": "husky install",
22
- "test": "check-export-map && eslint --print-config ./test/index.js"
23
+ "test": "check-export-map && yarn run test:eslint && yarn run test:stylelint",
24
+ "test:eslint": "eslint --print-config ./test/index.js",
25
+ "test:stylelint": "stylelint --print-config ./test/index.js"
23
26
  },
24
27
  "dependencies": {
25
28
  "@babel/core": "^7.18.9",
@@ -1,3 +1,5 @@
1
+ const confusingBrowserGlobals = require('confusing-browser-globals');
2
+
1
3
  module.exports = {
2
4
  rules: {
3
5
  // enforces getter/setter pairs in objects
@@ -262,6 +264,23 @@ module.exports = {
262
264
  // https://eslint.org/docs/rules/no-redeclare
263
265
  'no-redeclare': 'error',
264
266
 
267
+ // browser globals that commonly cause confusion and are not recommended
268
+ // to use without an explicit `window`.` qualifier
269
+ // https://eslint.org/docs/rules/no-restricted-globals
270
+ 'no-restricted-globals': [
271
+ 'error',
272
+ {
273
+ name: 'isFinite',
274
+ message:
275
+ 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
276
+ },
277
+ {
278
+ name: 'isNaN',
279
+ message:
280
+ 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
281
+ },
282
+ ].concat(confusingBrowserGlobals),
283
+
265
284
  // disallow certain object properties
266
285
  // https://eslint.org/docs/rules/no-restricted-properties
267
286
  'no-restricted-properties': [
@@ -3,12 +3,32 @@
3
3
 
4
4
  module.exports = {
5
5
  rules: {
6
+ // Prevent assigning return values of cy calls
7
+ // https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-assigning-return-values.md
6
8
  'cypress/no-assigning-return-values': 'error',
9
+
10
+ // Prevent waiting for arbitrary time periods
11
+ // https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-unnecessary-waiting.md
7
12
  'cypress/no-unnecessary-waiting': 'error',
13
+
14
+ // Prevent using async/await in Cypress test case
15
+ // https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-async-tests.md
8
16
  'cypress/no-async-tests': 'error',
17
+
18
+ // Disallow using `force: true` with action commands
19
+ // https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-force.md
9
20
  'cypress/no-force': 'error',
21
+
22
+ // Ensure screenshots are preceded by an assertion
23
+ // https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/assertion-before-screenshot.md
10
24
  'cypress/assertion-before-screenshot': 'error',
25
+
26
+ // Only allow data-\* attribute selectors (require-data-selectors)
27
+ // https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/require-data-selectors.md
11
28
  'cypress/require-data-selectors': 'error',
29
+
30
+ // Disallow `cy.pause()` parent command
31
+ // https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-pause.md
12
32
  'cypress/no-pause': 'error',
13
33
  },
14
34
  };
@@ -21,9 +21,11 @@ module.exports = {
21
21
  'no-compare-neg-zero': 'error',
22
22
 
23
23
  // disallow assignment in conditional expressions
24
+ // https://eslint.org/docs/rules/no-cond-assign
24
25
  'no-cond-assign': ['error', 'always'],
25
26
 
26
27
  // disallow use of console
28
+ // https://eslint.org/docs/rules/no-console
27
29
  'no-console': 'error',
28
30
 
29
31
  // Disallows expressions where the operation doesn't affect the value
@@ -31,15 +33,19 @@ module.exports = {
31
33
  'no-constant-binary-expression': 'error',
32
34
 
33
35
  // disallow use of constant expressions in conditions
36
+ // https://eslint.org/docs/rules/no-constant-condition
34
37
  'no-constant-condition': 'error',
35
38
 
36
39
  // disallow control characters in regular expressions
40
+ // https://eslint.org/docs/rules/no-control-regex
37
41
  'no-control-regex': 'error',
38
42
 
39
43
  // disallow use of debugger
44
+ // https://eslint.org/docs/rules/no-debugger
40
45
  'no-debugger': 'error',
41
46
 
42
47
  // disallow duplicate arguments in functions
48
+ // https://eslint.org/docs/rules/no-dupe-args
43
49
  'no-dupe-args': 'error',
44
50
 
45
51
  // Disallow duplicate conditions in if-else-if chains
@@ -47,18 +53,23 @@ module.exports = {
47
53
  'no-dupe-else-if': 'error',
48
54
 
49
55
  // disallow duplicate keys when creating object literals
56
+ // https://eslint.org/docs/rules/no-dupe-keys
50
57
  'no-dupe-keys': 'error',
51
58
 
52
59
  // disallow a duplicate case label.
60
+ // https://eslint.org/docs/rules/no-duplicate-case
53
61
  'no-duplicate-case': 'error',
54
62
 
55
63
  // disallow empty statements
64
+ // https://eslint.org/docs/rules/no-empty
56
65
  'no-empty': 'error',
57
66
 
58
67
  // disallow the use of empty character classes in regular expressions
68
+ // https://eslint.org/docs/rules/no-empty-character-class
59
69
  'no-empty-character-class': 'error',
60
70
 
61
71
  // disallow assigning to the exception in a catch block
72
+ // https://eslint.org/docs/rules/no-ex-assign
62
73
  'no-ex-assign': 'error',
63
74
 
64
75
  // disallow double-negation boolean casts in a boolean context
@@ -80,21 +91,26 @@ module.exports = {
80
91
  ],
81
92
 
82
93
  // disallow unnecessary semicolons
94
+ // https://eslint.org/docs/rules/no-extra-semi
83
95
  'no-extra-semi': 'error',
84
96
 
85
97
  // disallow overwriting functions written as function declarations
98
+ // https://eslint.org/docs/rules/no-func-assign
86
99
  'no-func-assign': 'error',
87
100
 
88
101
  // https://eslint.org/docs/rules/no-import-assign
89
102
  'no-import-assign': 'error',
90
103
 
91
104
  // disallow function or variable declarations in nested blocks
105
+ // https://eslint.org/docs/rules/no-inner-declarations
92
106
  'no-inner-declarations': 'error',
93
107
 
94
108
  // disallow invalid regular expression strings in the RegExp constructor
109
+ // https://eslint.org/docs/rules/no-invalid-regexp
95
110
  'no-invalid-regexp': 'error',
96
111
 
97
112
  // disallow irregular whitespace outside of strings and comments
113
+ // https://eslint.org/docs/rules/no-irregular-whitespace
98
114
  'no-irregular-whitespace': 'error',
99
115
 
100
116
  // Disallow Number Literals That Lose Precision
@@ -106,6 +122,7 @@ module.exports = {
106
122
  'no-misleading-character-class': 'error',
107
123
 
108
124
  // disallow the use of object properties of the global object (Math and JSON) as functions
125
+ // https://eslint.org/docs/rules/no-obj-calls
109
126
  'no-obj-calls': 'error',
110
127
 
111
128
  // Disallow returning values from Promise executor functions
@@ -117,6 +134,7 @@ module.exports = {
117
134
  'no-prototype-builtins': 'error',
118
135
 
119
136
  // disallow multiple spaces in a regular expression literal
137
+ // https://eslint.org/docs/rules/no-regex-spaces
120
138
  'no-regex-spaces': 'error',
121
139
 
122
140
  // Disallow returning values from setters
@@ -124,6 +142,7 @@ module.exports = {
124
142
  'no-setter-return': 'error',
125
143
 
126
144
  // disallow sparse arrays
145
+ // https://eslint.org/docs/rules/no-sparse-arrays
127
146
  'no-sparse-arrays': 'error',
128
147
 
129
148
  // Disallow template literal placeholder syntax in regular strings
@@ -135,6 +154,7 @@ module.exports = {
135
154
  'no-unexpected-multiline': 'error',
136
155
 
137
156
  // disallow unreachable statements after a return, throw, continue, or break statement
157
+ // https://eslint.org/docs/rules/no-unreachable
138
158
  'no-unreachable': 'error',
139
159
 
140
160
  // Disallow loops with a body that allows only one iteration
@@ -168,6 +188,7 @@ module.exports = {
168
188
 
169
189
  // disallow negation of the left operand of an in expression
170
190
  // deprecated in favor of no-unsafe-negation
191
+ // https://eslint.org/docs/rules/no-negated-in-lhs
171
192
  'no-negated-in-lhs': 'off',
172
193
 
173
194
  // Disallow assignments that can lead to race conditions due to usage of await or yield
@@ -176,6 +197,7 @@ module.exports = {
176
197
  'require-atomic-updates': 'off',
177
198
 
178
199
  // disallow comparisons with the value NaN
200
+ // https://eslint.org/docs/rules/use-isnan
179
201
  'use-isnan': 'error',
180
202
 
181
203
  // ensure JSDoc comments are valid
@@ -32,6 +32,7 @@ module.exports = {
32
32
  'arrow-spacing': ['error', { before: true, after: true }],
33
33
 
34
34
  // verify super() callings in constructors
35
+ // https://eslint.org/docs/rules/constructor-super
35
36
  'constructor-super': 'error',
36
37
 
37
38
  // enforce the spacing around the * in generator functions
@@ -52,6 +53,7 @@ module.exports = {
52
53
  ],
53
54
 
54
55
  // disallow modifying variables that are declared using const
56
+ // https://eslint.org/docs/rules/no-const-assign
55
57
  'no-const-assign': 'error',
56
58
 
57
59
  // disallow duplicate class members
@@ -113,6 +115,7 @@ module.exports = {
113
115
  ],
114
116
 
115
117
  // require let or const instead of var
118
+ // https://eslint.org/docs/rules/no-var
116
119
  'no-var': 'error',
117
120
 
118
121
  // require method and property shorthand syntax for object literals
@@ -127,6 +130,7 @@ module.exports = {
127
130
  ],
128
131
 
129
132
  // suggest using arrow functions as callbacks
133
+ // https://eslint.org/docs/rules/prefer-arrow-callback
130
134
  'prefer-arrow-callback': [
131
135
  'error',
132
136
  {
@@ -136,6 +140,7 @@ module.exports = {
136
140
  ],
137
141
 
138
142
  // suggest using of const declaration for variables that are never modified after declared
143
+ // https://eslint.org/docs/rules/prefer-const
139
144
  'prefer-const': [
140
145
  'error',
141
146
  {
@@ -4,59 +4,229 @@
4
4
 
5
5
  module.exports = {
6
6
  rules: {
7
- // authoring rules for tests
7
+ // Authoring rules for tests:
8
+
9
+ // Have control over `test` and `it` usages
10
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/consistent-test-it.md
8
11
  'jest/consistent-test-it': 'error',
9
- 'jest/expect-expect': 'off',
12
+
13
+ // Enforce assertion to be made in a test body
14
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/expect-expect.md
15
+ 'jest/expect-expect': 'error',
16
+
17
+ // Enforces a maximum number assertion calls in a test body
18
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/max-expects.md
19
+ 'jest/max-expects': [
20
+ 'error',
21
+ {
22
+ max: 15,
23
+ },
24
+ ],
25
+
26
+ // Enforces a maximum depth to nested describe calls
27
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/max-nested-describe.md
28
+ 'jest/max-nested-describe': 'error',
29
+
30
+ // Disallow alias methods
31
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-alias-methods.md
10
32
  'jest/no-alias-methods': 'error',
33
+
34
+ // Disallow commented out tests
35
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-commented-out-tests.md
11
36
  'jest/no-commented-out-tests': 'error',
37
+
38
+ // Prevent calling `expect` conditionally
39
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-conditional-expect.md
12
40
  'jest/no-conditional-expect': 'error',
41
+
42
+ // Disallow conditional logic in tests
43
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-conditional-in-test.md
44
+ 'jest/no-conditional-in-test': 'error',
45
+
46
+ // Disallow use of deprecated functions
47
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-deprecated-functions.md
13
48
  'jest/no-deprecated-functions': 'error',
14
- // it is often useful to be allowed to add a .skip
49
+
50
+ // Disallow disabled tests
51
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-disabled-tests.md
52
+ // decision: it is often useful to be allowed to add a .skip
15
53
  'jest/no-disabled-tests': 'off',
54
+
55
+ // Avoid using a callback in asynchronous tests and hooks
56
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-done-callback.md
16
57
  'jest/no-done-callback': 'error',
58
+
59
+ // Disallow duplicate setup and teardown hooks
60
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-duplicate-hooks.md
17
61
  'jest/no-duplicate-hooks': 'error',
62
+
63
+ // Disallow using `exports` in files containing tests
64
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-export.md
18
65
  'jest/no-export': 'error',
66
+
67
+ // Disallow focused tests
68
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-focused-tests.md
19
69
  'jest/no-focused-tests': 'error',
20
- // hooks are useful even though they *potentially* promote shared state between tests
70
+
71
+ // Disallow setup and teardown hooks
72
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-hooks.md
73
+ // decision: hooks are useful even though they *potentially* promote shared state between tests
21
74
  'jest/no-hooks': 'off',
75
+
76
+ // Disallow identical titles
77
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-identical-title.md
22
78
  'jest/no-identical-title': 'error',
23
- 'jest/no-if': 'error',
79
+
80
+ // Disallow string interpolation inside snapshots
81
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-interpolation-in-snapshots.md
24
82
  'jest/no-interpolation-in-snapshots': 'error',
83
+
84
+ // Disallow Jasmine globals
85
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-jasmine-globals.md
25
86
  'jest/no-jasmine-globals': 'error',
87
+
88
+ // Disallow importing Jest
89
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-jest-import.md
26
90
  'jest/no-jest-import': 'error',
27
- // reasonable but arbitrary size limit
91
+
92
+ // disallow large snapshots
93
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-large-snapshots.md
94
+ // decision: arbitrary but reasonable size limit
28
95
  'jest/no-large-snapshots': ['error', { maxSize: 500 }],
96
+
97
+ // Disallow manually importing from `__mocks__`
98
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-mocks-import.md
29
99
  'jest/no-mocks-import': 'error',
100
+
101
+ // Disallow specific matchers & modifiers
102
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-restricted-matchers.md
30
103
  'jest/no-restricted-matchers': 'error',
104
+
105
+ // Disallow using `expect` outside of `it` or `test` blocks
106
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-standalone-expect.md
31
107
  'jest/no-standalone-expect': 'error',
108
+
109
+ // Use `.only` and `.skip` over `f` and `x`
110
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-test-prefixes.md
32
111
  'jest/no-test-prefixes': 'error',
112
+
113
+ // Disallow explicitly returning from tests
114
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-test-return-statement.md
33
115
  'jest/no-test-return-statement': 'error',
116
+
117
+ // Suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()`
118
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-called-with.md
34
119
  'jest/prefer-called-with': 'error',
120
+
121
+ // Suggest using the built-in comparison matchers
122
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-comparison-matcher.md
123
+ 'jest/prefer-comparison-matcher': 'error',
124
+
125
+ // Suggest using the built-in equality matchers
126
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-equality-matcher.md
127
+ 'jest/prefer-equality-matcher': 'error',
128
+
129
+ // Suggest using `expect.assertions()` OR `expect.hasAssertions()`
130
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-expect-assertions.md
35
131
  'jest/prefer-expect-assertions': 'error',
132
+
133
+ // Prefer `await expect(...).resolves` over `expect(await ...)` syntax
134
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-expect-resolves.md
135
+ 'jest/prefer-expect-resolves': 'error',
136
+
137
+ // Prefer having hooks in a consistent order
138
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-in-order.md
139
+ 'jest/prefer-hooks-in-order': 'error',
140
+
141
+ // Suggest having hooks before any test cases
142
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-on-top.md
36
143
  'jest/prefer-hooks-on-top': 'error',
37
- // descriptions are often named after React components which are capitalized
144
+
145
+ // Enforce lowercase test names
146
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-lowercase-title.md
147
+ // decision: descriptions are often named after React components which are capitalized
38
148
  'jest/prefer-lowercase-title': 'off',
149
+
150
+ // Prefer including a hint with external snapshots
151
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-snapshot-hint.md
152
+ 'jest/prefer-snapshot-hint': 'error',
153
+
154
+ // Suggest using `jest.spyOn()`
155
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-spy-on.md
39
156
  'jest/prefer-spy-on': 'error',
157
+
158
+ // Suggest using `toStrictEqual()`
159
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-strict-equal.md
40
160
  'jest/prefer-strict-equal': 'error',
161
+
162
+ // Suggest using `toBe()` for primitive literals
163
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-be.md
41
164
  'jest/prefer-to-be': 'error',
165
+
166
+ // Suggest using `toContain()`
167
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-contain.md
42
168
  'jest/prefer-to-contain': 'error',
169
+
170
+ // Suggest using `toHaveLength()`
171
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-have-length.md
43
172
  'jest/prefer-to-have-length': 'error',
173
+
174
+ // Suggest using `test.todo`
175
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-todo.md
44
176
  'jest/prefer-todo': 'error',
177
+
178
+ // Require setup and teardown code to be within a hook
179
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-hook.md
180
+ 'jest/require-hook': 'error',
181
+
182
+ // Require a message for `toThrow()`
183
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-to-throw-message.md
45
184
  'jest/require-to-throw-message': 'error',
185
+
186
+ // Require test cases and hooks to be inside a `describe` block
187
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-top-level-describe.md
46
188
  'jest/require-top-level-describe': 'error',
189
+
190
+ // Enforce valid `describe()` callback
191
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-describe-callback.md
47
192
  'jest/valid-describe-callback': 'error',
193
+
194
+ // Enforce valid `expect()` usage
195
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-expect.md
48
196
  'jest/valid-expect': 'error',
197
+
198
+ // Ensure promises that have expectations in their chain are valid
199
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-expect-in-promise.md
49
200
  'jest/valid-expect-in-promise': 'error',
201
+
202
+ // Enforce valid titles
203
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-title.md
50
204
  'jest/valid-title': 'error',
51
205
 
52
- // formatting rules for tests
206
+ // Formatting rules for tests:
207
+
208
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-after-all-blocks.md
53
209
  'jest-formatting/padding-around-after-all-blocks': 'error',
210
+
211
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-after-each-blocks.md
54
212
  'jest-formatting/padding-around-after-each-blocks': 'error',
213
+
214
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-before-all-blocks.md
55
215
  'jest-formatting/padding-around-before-all-blocks': 'error',
216
+
217
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-before-each-blocks.md
56
218
  'jest-formatting/padding-around-before-each-blocks': 'error',
219
+
220
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-expect-groups.md
57
221
  'jest-formatting/padding-around-expect-groups': 'error',
222
+
223
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-describe-blocks.md
58
224
  'jest-formatting/padding-around-describe-blocks': 'error',
225
+
226
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-test-blocks.md
59
227
  'jest-formatting/padding-around-test-blocks': 'error',
228
+
229
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-all.md
60
230
  'jest-formatting/padding-around-all': 'error',
61
231
  },
62
232
  };
@@ -5,6 +5,7 @@ module.exports = {
5
5
 
6
6
  rules: {
7
7
  // enforce return after a callback
8
+ // https://eslint.org/docs/rules/callback-return
8
9
  'callback-return': 'off',
9
10
 
10
11
  // require all requires be top-level
@@ -12,6 +13,7 @@ module.exports = {
12
13
  'global-require': 'error',
13
14
 
14
15
  // enforces error handling in callbacks (node environment)
16
+ // https://eslint.org/docs/rules/handle-callback-err
15
17
  'handle-callback-err': 'off',
16
18
 
17
19
  // disallow use of the Buffer() constructor
@@ -19,9 +21,11 @@ module.exports = {
19
21
  'no-buffer-constructor': 'error',
20
22
 
21
23
  // disallow mixing regular variable and require declarations
24
+ // https://eslint.org/docs/rules/no-mixed-requires
22
25
  'no-mixed-requires': ['off', false],
23
26
 
24
27
  // disallow use of new operator with the require function
28
+ // https://eslint.org/docs/rules/no-new-require
25
29
  'no-new-require': 'error',
26
30
 
27
31
  // disallow string concatenation with __dirname and __filename
@@ -29,15 +33,19 @@ module.exports = {
29
33
  'no-path-concat': 'error',
30
34
 
31
35
  // disallow use of process.env
36
+ // https://eslint.org/docs/rules/no-process-env
32
37
  'no-process-env': 'off',
33
38
 
34
39
  // disallow process.exit()
40
+ // https://eslint.org/docs/rules/no-process-exit
35
41
  'no-process-exit': 'off',
36
42
 
37
43
  // restrict usage of specified node modules
44
+ // https://eslint.org/docs/rules/no-restricted-modules
38
45
  'no-restricted-modules': 'off',
39
46
 
40
- // disallow use of synchronous methods (off by default)
47
+ // disallow use of synchronous methods
48
+ // https://eslint.org/docs/rules/no-sync
41
49
  'no-sync': 'off',
42
50
  },
43
51
  };
@@ -3,6 +3,7 @@
3
3
  module.exports = {
4
4
  rules: {
5
5
  // prettier configuration
6
+ // https://github.com/prettier/eslint-plugin-prettier#options
6
7
  'prettier/prettier': 'error',
7
8
  },
8
9
  };
@@ -15,6 +15,8 @@ module.exports = {
15
15
  // https://eslint.org/docs/rules/jsx-quotes
16
16
  'jsx-quotes': ['error', 'prefer-double'],
17
17
 
18
+ // Enforce that class methods utilize this
19
+ // https://eslint.org/docs/rules/class-methods-use-this
18
20
  'class-methods-use-this': [
19
21
  'off',
20
22
  {
@@ -146,6 +148,7 @@ module.exports = {
146
148
  ],
147
149
 
148
150
  // Deprecated in favor of react/jsx-sort-props
151
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md
149
152
  'react/jsx-sort-prop-types': 'off',
150
153
 
151
154
  // Enforce props alphabetical sorting