@wistia/eslint-config 2.1.1 → 2.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @wistia/eslint-config
2
2
 
3
+ ## 2.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#442](https://github.com/wistia/eslint-config/pull/442) [`adc7fe4`](https://github.com/wistia/eslint-config/commit/adc7fe4e8cc21f8fecaee08d254220a97f3584d5) Thanks [@okize](https://github.com/okize)! - feat: remove jest config & rules
8
+
9
+ ## 2.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#440](https://github.com/wistia/eslint-config/pull/440) [`57cb9e5`](https://github.com/wistia/eslint-config/commit/57cb9e5613d00dbecdcf325072aea6762419d97e) Thanks [@okize](https://github.com/okize)! - feat: add additional vitest rules
14
+
3
15
  ## 2.1.1
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,18 +1,17 @@
1
1
  {
2
2
  "name": "@wistia/eslint-config",
3
- "version": "2.1.1",
3
+ "version": "2.3.0",
4
4
  "description": "Wistia's ESLint configurations",
5
5
  "packageManager": "yarn@4.12.0",
6
6
  "type": "module",
7
7
  "main": "index.mjs",
8
8
  "engines": {
9
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
9
+ "node": "^20.19.0 || ^22.13.0 || >=24"
10
10
  },
11
11
  "exports": {
12
12
  "./package.json": "./package.json",
13
13
  ".": "./src/configs/javascript.mjs",
14
14
  "./javascript": "./src/configs/javascript.mjs",
15
- "./jest": "./src/configs/jest.mjs",
16
15
  "./node": "./src/configs/node.mjs",
17
16
  "./playwright": "./src/configs/playwright.mjs",
18
17
  "./react": "./src/configs/react.mjs",
@@ -50,9 +49,7 @@
50
49
  "eslint-plugin-barrel-files": "^3.0.1",
51
50
  "eslint-plugin-filenames": "^1.3.2",
52
51
  "eslint-plugin-import-x": "^4.16.2",
53
- "eslint-plugin-jest": "^29.15.0",
54
52
  "eslint-plugin-jest-dom": "^5.5.0",
55
- "eslint-plugin-jest-formatting": "^3.1.0",
56
53
  "eslint-plugin-jsx-a11y": "^6.10.2",
57
54
  "eslint-plugin-n": "^17.24.0",
58
55
  "eslint-plugin-no-only-tests": "^3.3.0",
@@ -10,14 +10,26 @@ export default {
10
10
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
11
11
  'vitest/consistent-test-filename': 'error',
12
12
 
13
+ // Enforce consistent usage of each with for...of
14
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-each-for.md
15
+ 'vitest/consistent-each-for': 'error',
16
+
13
17
  // Prefer test or it but not both
14
18
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md
15
19
  'vitest/consistent-test-it': 'error',
16
20
 
21
+ // Enforce consistent usage of vi vs vitest
22
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-vitest-vi.md
23
+ 'vitest/consistent-vitest-vi': 'error',
24
+
17
25
  // Enforce having expectation in test body
18
26
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md
19
27
  'vitest/expect-expect': 'error',
20
28
 
29
+ // Ensure hoisted APIs (vi.mock, vi.hoisted, etc.) are at the top
30
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/hoisted-apis-on-top.md
31
+ 'vitest/hoisted-apis-on-top': 'error',
32
+
21
33
  // Enforce a maximum number of expect per test
22
34
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md
23
35
  'vitest/max-expects': [
@@ -81,6 +93,10 @@ export default {
81
93
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md
82
94
  'vitest/no-import-node-test': 'error',
83
95
 
96
+ // Disallow importing vitest globals when using globals: true
97
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-importing-vitest-globals.md
98
+ 'vitest/no-importing-vitest-globals': 'error',
99
+
84
100
  // Disallow string interpolation in snapshots
85
101
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md
86
102
  'vitest/no-interpolation-in-snapshots': 'error',
@@ -113,6 +129,10 @@ export default {
113
129
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
114
130
  'vitest/no-test-return-statement': 'error',
115
131
 
132
+ // Disallow unnecessary async in expect functions
133
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-unneeded-async-expect-function.md
134
+ 'vitest/no-unneeded-async-expect-function': 'error',
135
+
116
136
  // This rule enforces a line of padding before and after 1 or more `afterAll` statements.
117
137
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-all-blocks.md
118
138
  'vitest/padding-around-after-all-blocks': 'error',
@@ -145,6 +165,18 @@ export default {
145
165
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-all.md
146
166
  'vitest/padding-around-all': 'off',
147
167
 
168
+ // Prefer toHaveBeenCalledExactlyOnceWith over separate assertions
169
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-exactly-once-with.md
170
+ 'vitest/prefer-called-exactly-once-with': 'error',
171
+
172
+ // Prefer toHaveBeenCalledOnce() over toHaveBeenCalledTimes(1)
173
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-once.md
174
+ 'vitest/prefer-called-once': 'error',
175
+
176
+ // Prefer toHaveBeenCalledTimes over multiple assertions
177
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-times.md
178
+ 'vitest/prefer-called-times': 'error',
179
+
148
180
  // Suggest using toBeCalledWith() or toHaveBeenCalledWith()
149
181
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md
150
182
  'vitest/prefer-called-with': 'error',
@@ -153,6 +185,10 @@ export default {
153
185
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-comparison-matcher.md
154
186
  'vitest/prefer-comparison-matcher': 'error',
155
187
 
188
+ // Enforce describe titles to match function names
189
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-describe-function-title.md
190
+ 'vitest/prefer-describe-function-title': 'error',
191
+
156
192
  // Prefer each rather than manual loops
157
193
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md
158
194
  'vitest/prefer-each': 'error',
@@ -169,6 +205,10 @@ export default {
169
205
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md
170
206
  'vitest/prefer-expect-resolves': 'error',
171
207
 
208
+ // Prefer expect.typeOf() usage
209
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-type-of.md
210
+ 'vitest/prefer-expect-type-of': 'error',
211
+
172
212
  // Prefer having hooks in consistent order
173
213
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
174
214
  'vitest/prefer-hooks-in-order': 'error',
@@ -177,6 +217,14 @@ export default {
177
217
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md
178
218
  'vitest/prefer-hooks-on-top': 'error',
179
219
 
220
+ // Prefer vi.importActual/vi.importMock in vi.mock factories
221
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-import-in-mock.md
222
+ 'vitest/prefer-import-in-mock': 'error',
223
+
224
+ // Prefer importing vitest globals instead of using them implicitly
225
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-importing-vitest-globals.md
226
+ 'vitest/prefer-importing-vitest-globals': 'error',
227
+
180
228
  // Enforce lowercase titles
181
229
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-lowercase-title.md
182
230
  'vitest/prefer-lowercase-title': 'off',
@@ -185,6 +233,10 @@ export default {
185
233
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-promise-shorthand.md
186
234
  'vitest/prefer-mock-promise-shorthand': 'error',
187
235
 
236
+ // Prefer mock return shorthands
237
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-return-shorthand.md
238
+ 'vitest/prefer-mock-return-shorthand': 'error',
239
+
188
240
  // Prefer including a hint with external snapshots
189
241
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-snapshot-hint.md
190
242
  'vitest/prefer-snapshot-hint': 'error',
@@ -193,6 +245,10 @@ export default {
193
245
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
194
246
  'vitest/prefer-spy-on': 'error',
195
247
 
248
+ // Prefer strict boolean matchers (toBe(true) over toBeTruthy())
249
+ // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-boolean-matchers.md
250
+ 'vitest/prefer-strict-boolean-matchers': 'error',
251
+
196
252
  // Prefer strict equal over equal
197
253
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-equal.md
198
254
  'vitest/prefer-strict-equal': 'error',
@@ -64,7 +64,7 @@
64
64
  "undefined": false,
65
65
  "unescape": false,
66
66
  },
67
- "parser": "typescript-eslint/parser@8.57.1",
67
+ "parser": "typescript-eslint/parser@8.57.2",
68
68
  "parserOptions": {
69
69
  "requireConfigFile": false,
70
70
  },
@@ -64,7 +64,7 @@
64
64
  "undefined": false,
65
65
  "unescape": false,
66
66
  },
67
- "parser": "typescript-eslint/parser@8.57.1",
67
+ "parser": "typescript-eslint/parser@8.57.2",
68
68
  "parserOptions": {
69
69
  "ecmaVersion": 2024,
70
70
  "project": "./tsconfig.json",
@@ -78,7 +78,7 @@
78
78
  "plugins": [
79
79
  "@",
80
80
  "@stylistic:@stylistic/eslint-plugin@5.10.0",
81
- "@typescript-eslint:@typescript-eslint/eslint-plugin@8.57.1",
81
+ "@typescript-eslint:@typescript-eslint/eslint-plugin@8.57.2",
82
82
  "barrel-files:eslint-plugin-barrel-files@3.0.1",
83
83
  "filenames",
84
84
  "import-x:eslint-plugin-import-x@4.16.2",
@@ -42,6 +42,10 @@
42
42
  "no-only-tests/no-only-tests": [
43
43
  2,
44
44
  ],
45
+ "vitest/consistent-each-for": [
46
+ 2,
47
+ {},
48
+ ],
45
49
  "vitest/consistent-test-filename": [
46
50
  2,
47
51
  {
@@ -53,6 +57,12 @@
53
57
  2,
54
58
  {},
55
59
  ],
60
+ "vitest/consistent-vitest-vi": [
61
+ 2,
62
+ {
63
+ "fn": "vi",
64
+ },
65
+ ],
56
66
  "vitest/expect-expect": [
57
67
  2,
58
68
  {
@@ -63,6 +73,9 @@
63
73
  ],
64
74
  },
65
75
  ],
76
+ "vitest/hoisted-apis-on-top": [
77
+ 2,
78
+ ],
66
79
  "vitest/max-expects": [
67
80
  2,
68
81
  {
@@ -117,6 +130,9 @@
117
130
  "vitest/no-import-node-test": [
118
131
  2,
119
132
  ],
133
+ "vitest/no-importing-vitest-globals": [
134
+ 2,
135
+ ],
120
136
  "vitest/no-interpolation-in-snapshots": [
121
137
  2,
122
138
  ],
@@ -149,6 +165,9 @@
149
165
  "vitest/no-test-return-statement": [
150
166
  2,
151
167
  ],
168
+ "vitest/no-unneeded-async-expect-function": [
169
+ 2,
170
+ ],
152
171
  "vitest/padding-around-after-all-blocks": [
153
172
  2,
154
173
  ],
@@ -173,12 +192,24 @@
173
192
  "vitest/padding-around-test-blocks": [
174
193
  2,
175
194
  ],
195
+ "vitest/prefer-called-exactly-once-with": [
196
+ 2,
197
+ ],
198
+ "vitest/prefer-called-once": [
199
+ 2,
200
+ ],
201
+ "vitest/prefer-called-times": [
202
+ 2,
203
+ ],
176
204
  "vitest/prefer-called-with": [
177
205
  2,
178
206
  ],
179
207
  "vitest/prefer-comparison-matcher": [
180
208
  2,
181
209
  ],
210
+ "vitest/prefer-describe-function-title": [
211
+ 2,
212
+ ],
182
213
  "vitest/prefer-each": [
183
214
  2,
184
215
  ],
@@ -196,12 +227,24 @@
196
227
  "vitest/prefer-expect-resolves": [
197
228
  2,
198
229
  ],
230
+ "vitest/prefer-expect-type-of": [
231
+ 2,
232
+ ],
199
233
  "vitest/prefer-hooks-in-order": [
200
234
  2,
201
235
  ],
202
236
  "vitest/prefer-hooks-on-top": [
203
237
  2,
204
238
  ],
239
+ "vitest/prefer-import-in-mock": [
240
+ 2,
241
+ {
242
+ "fixable": true,
243
+ },
244
+ ],
245
+ "vitest/prefer-importing-vitest-globals": [
246
+ 2,
247
+ ],
205
248
  "vitest/prefer-lowercase-title": [
206
249
  0,
207
250
  {
@@ -214,6 +257,9 @@
214
257
  "vitest/prefer-mock-promise-shorthand": [
215
258
  2,
216
259
  ],
260
+ "vitest/prefer-mock-return-shorthand": [
261
+ 2,
262
+ ],
217
263
  "vitest/prefer-snapshot-hint": [
218
264
  2,
219
265
  "multi",
@@ -221,6 +267,9 @@
221
267
  "vitest/prefer-spy-on": [
222
268
  2,
223
269
  ],
270
+ "vitest/prefer-strict-boolean-matchers": [
271
+ 2,
272
+ ],
224
273
  "vitest/prefer-strict-equal": [
225
274
  2,
226
275
  ],
@@ -1,22 +0,0 @@
1
- import jestPlugin from 'eslint-plugin-jest';
2
- import jestFormattingPlugin from 'eslint-plugin-jest-formatting';
3
- import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
4
- import jestRules from '../rules/jest.mjs';
5
- import jestFormattingRules from '../rules/jest-formatting.mjs';
6
-
7
- export default [
8
- {
9
- languageOptions: {
10
- globals: jestPlugin.environments.globals.globals,
11
- },
12
- plugins: {
13
- jest: jestPlugin,
14
- 'jest-formatting': jestFormattingPlugin,
15
- 'no-only-tests': noOnlyTestsPlugin,
16
- },
17
- rules: {
18
- ...jestRules,
19
- ...jestFormattingRules,
20
- },
21
- },
22
- ];
@@ -1,36 +0,0 @@
1
- // only add jest-formatting rules (plugin works for vitest as well as jest)
2
- // see: https://github.com/dangreenisrael/eslint-plugin-jest-formatting#rule-documentation
3
-
4
- export default {
5
- // This rule enforces a line of padding before and after 1 or more `afterAll` statements.
6
- // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-after-all-blocks.md
7
- 'jest-formatting/padding-around-after-all-blocks': 'error',
8
-
9
- // This rule enforces a line of padding before and after 1 or more `afterEach` statements.
10
- // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-after-each-blocks.md
11
- 'jest-formatting/padding-around-after-each-blocks': 'error',
12
-
13
- // This rule enforces a line of padding before and after `beforeAll` statements.
14
- // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-before-all-blocks.md
15
- 'jest-formatting/padding-around-before-all-blocks': 'error',
16
-
17
- // This rule enforces a line of padding before and after 1 or more `beforeEach` statements
18
- // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-before-each-blocks.md
19
- 'jest-formatting/padding-around-before-each-blocks': 'error',
20
-
21
- // This rule enforces a line of padding before and after 1 or more `expect` statements
22
- // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-expect-groups.md
23
- 'jest-formatting/padding-around-expect-groups': 'error',
24
-
25
- // This rule enforces a line of padding before and after 1 or more `describe` statements
26
- // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-describe-blocks.md
27
- 'jest-formatting/padding-around-describe-blocks': 'error',
28
-
29
- // This rule enforces a line of padding before and after 1 or more `test`/`it` statements
30
- // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-test-blocks.md
31
- 'jest-formatting/padding-around-test-blocks': 'error',
32
-
33
- // This is a meta rule that simply enables all of the previous rules
34
- // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-all.md
35
- 'jest-formatting/padding-around-all': 'off',
36
- };
@@ -1,203 +0,0 @@
1
- // only add jest rules
2
- // see: https://github.com/jest-community/eslint-plugin-jest#rules
3
-
4
- export default {
5
- // Prevent focused tests (.only)
6
- // https://github.com/levibuzolic/eslint-plugin-no-only-tests#usage
7
- 'no-only-tests/no-only-tests': 'error',
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
11
- 'jest/consistent-test-it': 'error',
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
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
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
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
48
- 'jest/no-deprecated-functions': 'error',
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
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
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
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
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
69
- // decision: turned off in favor of the `no-only-tests` rule
70
- 'jest/no-focused-tests': 'off',
71
-
72
- // Disallow setup and teardown hooks
73
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-hooks.md
74
- // decision: hooks are useful even though they *potentially* promote shared state between tests
75
- 'jest/no-hooks': 'off',
76
-
77
- // Disallow identical titles
78
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-identical-title.md
79
- 'jest/no-identical-title': 'error',
80
-
81
- // Disallow string interpolation inside snapshots
82
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-interpolation-in-snapshots.md
83
- 'jest/no-interpolation-in-snapshots': 'error',
84
-
85
- // Disallow Jasmine globals
86
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-jasmine-globals.md
87
- 'jest/no-jasmine-globals': 'error',
88
-
89
- // disallow large snapshots
90
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-large-snapshots.md
91
- // decision: arbitrary but reasonable size limit; although we suggest not writing snapshot tests with the
92
- // `no-snapshot-testing` rule, in cases where we decide to allow them, this rule is beneficial
93
- 'jest/no-large-snapshots': ['error', { maxSize: 500 }],
94
-
95
- // Disallow manually importing from `__mocks__`
96
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-mocks-import.md
97
- 'jest/no-mocks-import': 'error',
98
-
99
- // Disallow specific matchers & modifiers
100
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-restricted-matchers.md
101
- 'jest/no-restricted-matchers': ['error', {}],
102
-
103
- // Disallow using `expect` outside of `it` or `test` blocks
104
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-standalone-expect.md
105
- 'jest/no-standalone-expect': 'error',
106
-
107
- // Use `.only` and `.skip` over `f` and `x`
108
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-test-prefixes.md
109
- 'jest/no-test-prefixes': 'error',
110
-
111
- // Disallow explicitly returning from tests
112
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-test-return-statement.md
113
- 'jest/no-test-return-statement': 'error',
114
-
115
- // Suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()`
116
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-called-with.md
117
- 'jest/prefer-called-with': 'error',
118
-
119
- // Suggest using the built-in comparison matchers
120
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-comparison-matcher.md
121
- 'jest/prefer-comparison-matcher': 'error',
122
-
123
- // Suggest using the built-in equality matchers
124
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-equality-matcher.md
125
- 'jest/prefer-equality-matcher': 'error',
126
-
127
- // Suggest using `expect.assertions()` OR `expect.hasAssertions()`
128
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-expect-assertions.md
129
- 'jest/prefer-expect-assertions': 'off',
130
-
131
- // Prefer `await expect(...).resolves` over `expect(await ...)` syntax
132
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-expect-resolves.md
133
- 'jest/prefer-expect-resolves': 'error',
134
-
135
- // Prefer having hooks in a consistent order
136
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-in-order.md
137
- 'jest/prefer-hooks-in-order': 'error',
138
-
139
- // Suggest having hooks before any test cases
140
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-on-top.md
141
- 'jest/prefer-hooks-on-top': 'error',
142
-
143
- // Enforce lowercase test names
144
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-lowercase-title.md
145
- // decision: descriptions are often named after React components which are capitalized
146
- 'jest/prefer-lowercase-title': 'off',
147
-
148
- // Prefer including a hint with external snapshots
149
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-snapshot-hint.md
150
- 'jest/prefer-snapshot-hint': 'error',
151
-
152
- // Suggest using `jest.spyOn()`
153
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-spy-on.md
154
- 'jest/prefer-spy-on': 'error',
155
-
156
- // Suggest using `toStrictEqual()`
157
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-strict-equal.md
158
- 'jest/prefer-strict-equal': 'error',
159
-
160
- // Suggest using `toBe()` for primitive literals
161
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-be.md
162
- 'jest/prefer-to-be': 'error',
163
-
164
- // Suggest using `toContain()`
165
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-contain.md
166
- 'jest/prefer-to-contain': 'error',
167
-
168
- // Suggest using `toHaveLength()`
169
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-have-length.md
170
- 'jest/prefer-to-have-length': 'error',
171
-
172
- // Suggest using `test.todo`
173
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-todo.md
174
- 'jest/prefer-todo': 'error',
175
-
176
- // Require setup and teardown code to be within a hook
177
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-hook.md
178
- 'jest/require-hook': 'error',
179
-
180
- // Require a message for `toThrow()`
181
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-to-throw-message.md
182
- 'jest/require-to-throw-message': 'error',
183
-
184
- // Require test cases and hooks to be inside a `describe` block
185
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-top-level-describe.md
186
- 'jest/require-top-level-describe': 'error',
187
-
188
- // Enforce valid `describe()` callback
189
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-describe-callback.md
190
- 'jest/valid-describe-callback': 'error',
191
-
192
- // Enforce valid `expect()` usage
193
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-expect.md
194
- 'jest/valid-expect': 'error',
195
-
196
- // Ensure promises that have expectations in their chain are valid
197
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-expect-in-promise.md
198
- 'jest/valid-expect-in-promise': 'error',
199
-
200
- // Enforce valid titles
201
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-title.md
202
- 'jest/valid-title': 'error',
203
- };