@wistia/eslint-config 2.1.1 → 2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @wistia/eslint-config
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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
8
+
3
9
  ## 2.1.1
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/eslint-config",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Wistia's ESLint configurations",
5
5
  "packageManager": "yarn@4.12.0",
6
6
  "type": "module",
@@ -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',
@@ -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
  ],