@wistia/oxlint-config 0.5.0 → 0.6.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/package.json +2 -1
- package/rules/base.mjs +166 -145
- package/rules/import.mjs +18 -18
- package/rules/node.mjs +4 -4
- package/rules/promise.mjs +16 -16
- package/rules/react-a11y.mjs +31 -31
- package/rules/react.mjs +51 -51
- package/rules/typescript.mjs +100 -100
- package/rules/vitest.mjs +63 -63
package/rules/vitest.mjs
CHANGED
|
@@ -11,101 +11,101 @@ export const vitestRules = {
|
|
|
11
11
|
],
|
|
12
12
|
rules: {
|
|
13
13
|
// Require .test test file pattern
|
|
14
|
-
// https://
|
|
14
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/consistent-test-filename.html
|
|
15
15
|
'vitest/consistent-test-filename': 'error',
|
|
16
16
|
|
|
17
17
|
// Enforce consistent usage of each with for...of
|
|
18
|
-
// https://
|
|
18
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/consistent-each-for.html
|
|
19
19
|
'vitest/consistent-each-for': 'error',
|
|
20
20
|
|
|
21
21
|
// Enforce consistent usage of vi vs vitest
|
|
22
|
-
// https://
|
|
22
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/consistent-vitest-vi.html
|
|
23
23
|
'vitest/consistent-vitest-vi': 'error',
|
|
24
24
|
|
|
25
25
|
// Ensure hoisted APIs (vi.mock, vi.hoisted, etc.) are at the top
|
|
26
|
-
// https://
|
|
26
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/hoisted-apis-on-top.html
|
|
27
27
|
'vitest/hoisted-apis-on-top': 'error',
|
|
28
28
|
|
|
29
29
|
// Disallow conditional tests
|
|
30
|
-
// https://
|
|
30
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-conditional-tests.html
|
|
31
31
|
'vitest/no-conditional-tests': 'error',
|
|
32
32
|
|
|
33
33
|
// Disallow importing node:test
|
|
34
|
-
// https://
|
|
34
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-import-node-test.html
|
|
35
35
|
'vitest/no-import-node-test': 'error',
|
|
36
36
|
|
|
37
37
|
// Disallow conditional tests
|
|
38
|
-
// https://
|
|
38
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-conditional-in-test.html
|
|
39
39
|
'vitest/no-conditional-in-test': 'error',
|
|
40
40
|
|
|
41
41
|
// Prefer toHaveBeenCalledOnce() over toHaveBeenCalledTimes(1)
|
|
42
|
-
// https://
|
|
42
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-called-once.html
|
|
43
43
|
// decision: conflicts with prefer-called-times (jest plugin), which is enabled
|
|
44
44
|
'vitest/prefer-called-once': 'off',
|
|
45
45
|
|
|
46
46
|
// Prefer toHaveBeenCalledTimes over multiple assertions
|
|
47
|
-
// https://
|
|
47
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-called-times.html
|
|
48
48
|
'vitest/prefer-called-times': 'error',
|
|
49
49
|
|
|
50
50
|
// Enforce describe titles to match function names
|
|
51
|
-
// https://
|
|
51
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-describe-function-title.html
|
|
52
52
|
'vitest/prefer-describe-function-title': 'error',
|
|
53
53
|
|
|
54
54
|
// Prefer expect.typeOf() usage
|
|
55
|
-
// https://
|
|
55
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-expect-type-of.html
|
|
56
56
|
'vitest/prefer-expect-type-of': 'error',
|
|
57
57
|
|
|
58
58
|
// Prefer vi.importActual/vi.importMock in vi.mock factories
|
|
59
|
-
// https://
|
|
59
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-import-in-mock.html
|
|
60
60
|
// decision: potentially helpful but causes too many type errors
|
|
61
61
|
'vitest/prefer-import-in-mock': 'off',
|
|
62
62
|
|
|
63
63
|
// Prefer strict boolean matchers (toBe(true) over toBeTruthy())
|
|
64
|
-
// https://
|
|
64
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-strict-boolean-matchers.html
|
|
65
65
|
'vitest/prefer-strict-boolean-matchers': 'error',
|
|
66
66
|
|
|
67
67
|
// Suggest using toBeFalsy()
|
|
68
|
-
// https://
|
|
68
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-to-be-falsy.html
|
|
69
69
|
// decision: not necessary to be prescriptive here
|
|
70
70
|
'vitest/prefer-to-be-falsy': 'off',
|
|
71
71
|
|
|
72
72
|
// Prefer toBeObject()
|
|
73
|
-
// https://
|
|
73
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-to-be-object.html
|
|
74
74
|
'vitest/prefer-to-be-object': 'error',
|
|
75
75
|
|
|
76
76
|
// Suggest using toBeTruthy
|
|
77
|
-
// https://
|
|
77
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-to-be-truthy.html
|
|
78
78
|
// decision: not necessary to be prescriptive here
|
|
79
79
|
'vitest/prefer-to-be-truthy': 'off',
|
|
80
80
|
|
|
81
81
|
// Require type parameters on mock function calls
|
|
82
|
-
// https://
|
|
82
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-mock-type-parameters.html
|
|
83
83
|
'vitest/require-mock-type-parameters': 'error',
|
|
84
84
|
|
|
85
85
|
// Require awaited expect.poll() calls
|
|
86
|
-
// https://
|
|
86
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-awaited-expect-poll.html
|
|
87
87
|
'vitest/require-awaited-expect-poll': 'error',
|
|
88
88
|
|
|
89
89
|
// Require local Test Context for concurrent snapshot tests
|
|
90
|
-
// https://
|
|
90
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-local-test-context-for-concurrent-snapshots.html
|
|
91
91
|
'vitest/require-local-test-context-for-concurrent-snapshots': 'error',
|
|
92
92
|
|
|
93
93
|
// Warn on test.todo() usage
|
|
94
|
-
// https://
|
|
94
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/warn-todo.html
|
|
95
95
|
'vitest/warn-todo': 'error',
|
|
96
96
|
|
|
97
97
|
//oxlint uses the "jest/" prefix for these unfortunately
|
|
98
98
|
|
|
99
99
|
// Prefer test or it but not both
|
|
100
|
-
// https://
|
|
100
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/consistent-test-it.html
|
|
101
101
|
'jest/consistent-test-it': 'error',
|
|
102
102
|
|
|
103
103
|
// Enforce having expectation in test body
|
|
104
|
-
// https://
|
|
104
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/expect-expect.html
|
|
105
105
|
'jest/expect-expect': 'error',
|
|
106
106
|
|
|
107
107
|
// Enforce a maximum number of expect per test
|
|
108
|
-
// https://
|
|
108
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/max-expects.html
|
|
109
109
|
'jest/max-expects': [
|
|
110
110
|
'error',
|
|
111
111
|
{
|
|
@@ -114,48 +114,48 @@ export const vitestRules = {
|
|
|
114
114
|
],
|
|
115
115
|
|
|
116
116
|
// Nested describe block should be less than set max value or default value
|
|
117
|
-
// https://
|
|
117
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/max-nested-describe.html
|
|
118
118
|
'jest/max-nested-describe': 'error',
|
|
119
119
|
|
|
120
120
|
// Disallow alias methods
|
|
121
|
-
// https://
|
|
121
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-alias-methods.html
|
|
122
122
|
'jest/no-alias-methods': 'error',
|
|
123
123
|
|
|
124
124
|
// Disallow commented out tests
|
|
125
|
-
// https://
|
|
125
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-commented-out-tests.html
|
|
126
126
|
'jest/no-commented-out-tests': 'error',
|
|
127
127
|
|
|
128
128
|
// Disallow conditional expects
|
|
129
|
-
// https://
|
|
129
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-conditional-expect.html
|
|
130
130
|
'jest/no-conditional-expect': 'error',
|
|
131
131
|
|
|
132
132
|
// Disallow disabled tests
|
|
133
|
-
// https://
|
|
133
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-disabled-tests.html
|
|
134
134
|
// decision: it is often useful to be allowed to add a .skip
|
|
135
135
|
'jest/no-disabled-tests': 'off',
|
|
136
136
|
|
|
137
137
|
// Disallow duplicate hooks and teardown hooks
|
|
138
|
-
// https://
|
|
138
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-duplicate-hooks.html
|
|
139
139
|
'jest/no-duplicate-hooks': 'error',
|
|
140
140
|
|
|
141
141
|
// Disallow focused tests
|
|
142
|
-
// https://
|
|
142
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-focused-tests.html
|
|
143
143
|
'jest/no-focused-tests': 'error',
|
|
144
144
|
|
|
145
145
|
// Disallow setup and teardown hooks
|
|
146
|
-
// https://
|
|
146
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-hooks.html
|
|
147
147
|
'jest/no-hooks': 'off',
|
|
148
148
|
|
|
149
149
|
// Disallow identical titles
|
|
150
|
-
// https://
|
|
150
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-identical-title.html
|
|
151
151
|
'jest/no-identical-title': 'error',
|
|
152
152
|
|
|
153
153
|
// Disallow string interpolation in snapshots
|
|
154
|
-
// https://
|
|
154
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-interpolation-in-snapshots.html
|
|
155
155
|
'jest/no-interpolation-in-snapshots': 'error',
|
|
156
156
|
|
|
157
157
|
// Disallow large snapshots
|
|
158
|
-
// https://
|
|
158
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-large-snapshots.html
|
|
159
159
|
'jest/no-large-snapshots': [
|
|
160
160
|
'error',
|
|
161
161
|
{
|
|
@@ -164,119 +164,119 @@ export const vitestRules = {
|
|
|
164
164
|
],
|
|
165
165
|
|
|
166
166
|
// Disallow importing from mocks directory
|
|
167
|
-
// https://
|
|
167
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-mocks-import.html
|
|
168
168
|
'jest/no-mocks-import': 'error',
|
|
169
169
|
|
|
170
170
|
// Disallow the use of certain matchers
|
|
171
|
-
// https://
|
|
171
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-restricted-matchers.html
|
|
172
172
|
'jest/no-restricted-matchers': 'error',
|
|
173
173
|
|
|
174
174
|
// Disallow using expect outside of it or test blocks
|
|
175
|
-
// https://
|
|
175
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-standalone-expect.html
|
|
176
176
|
'jest/no-standalone-expect': 'error',
|
|
177
177
|
|
|
178
178
|
// Disallow using test as a prefix
|
|
179
|
-
// https://
|
|
179
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-test-prefixes.html
|
|
180
180
|
'jest/no-test-prefixes': 'error',
|
|
181
181
|
|
|
182
182
|
// Disallow return statements in tests
|
|
183
|
-
// https://
|
|
183
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-test-return-statement.html
|
|
184
184
|
'jest/no-test-return-statement': 'error',
|
|
185
185
|
|
|
186
186
|
// Disallow unnecessary async in expect functions
|
|
187
|
-
// https://
|
|
187
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/no-unneeded-async-expect-function.html
|
|
188
188
|
'jest/no-unneeded-async-expect-function': 'error',
|
|
189
189
|
|
|
190
190
|
// Enforce padding around test blocks
|
|
191
|
-
// https://
|
|
191
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/padding-around-test-blocks.html
|
|
192
192
|
'jest/padding-around-test-blocks': 'error',
|
|
193
193
|
|
|
194
194
|
// Suggest using toBeCalledWith() or toHaveBeenCalledWith()
|
|
195
|
-
// https://
|
|
195
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-called-with.html
|
|
196
196
|
'jest/prefer-called-with': 'error',
|
|
197
197
|
|
|
198
198
|
// Suggest using the built-in comparison matchers
|
|
199
|
-
// https://
|
|
199
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-comparison-matcher.html
|
|
200
200
|
'jest/prefer-comparison-matcher': 'error',
|
|
201
201
|
|
|
202
202
|
// Prefer each rather than manual loops
|
|
203
|
-
// https://
|
|
203
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-each.html
|
|
204
204
|
'jest/prefer-each': 'error',
|
|
205
205
|
|
|
206
206
|
// Suggest using the built-in equality matchers
|
|
207
|
-
// https://
|
|
207
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-equality-matcher.html
|
|
208
208
|
'jest/prefer-equality-matcher': 'error',
|
|
209
209
|
|
|
210
210
|
// Suggest using expect().resolves over expect(await ...) syntax
|
|
211
|
-
// https://
|
|
211
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-expect-resolves.html
|
|
212
212
|
'jest/prefer-expect-resolves': 'error',
|
|
213
213
|
|
|
214
214
|
// Prefer having hooks in consistent order
|
|
215
|
-
// https://
|
|
215
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-hooks-in-order.html
|
|
216
216
|
'jest/prefer-hooks-in-order': 'error',
|
|
217
217
|
|
|
218
218
|
// Suggest having hooks before any test cases
|
|
219
|
-
// https://
|
|
219
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-hooks-on-top.html
|
|
220
220
|
'jest/prefer-hooks-on-top': 'error',
|
|
221
221
|
|
|
222
222
|
// Enforce lowercase titles
|
|
223
|
-
// https://
|
|
223
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-lowercase-title.html
|
|
224
224
|
'vitest/prefer-lowercase-title': 'off',
|
|
225
225
|
|
|
226
226
|
// Prefer mock resolved/rejected shorthands for promises
|
|
227
|
-
// https://
|
|
227
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-mock-promise-shorthand.html
|
|
228
228
|
'jest/prefer-mock-promise-shorthand': 'error',
|
|
229
229
|
|
|
230
230
|
// Prefer mock return shorthands
|
|
231
|
-
// https://
|
|
231
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-mock-return-shorthand.html
|
|
232
232
|
'jest/prefer-mock-return-shorthand': 'error',
|
|
233
233
|
|
|
234
234
|
// Suggest using vi.spyOn
|
|
235
|
-
// https://
|
|
235
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-spy-on.html
|
|
236
236
|
'jest/prefer-spy-on': 'error',
|
|
237
237
|
|
|
238
238
|
// Prefer strict equal over equal
|
|
239
|
-
// https://
|
|
239
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-strict-equal.html
|
|
240
240
|
'jest/prefer-strict-equal': 'error',
|
|
241
241
|
|
|
242
242
|
// Suggest using toBe()
|
|
243
|
-
// https://
|
|
243
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-to-be.html
|
|
244
244
|
'jest/prefer-to-be': 'error',
|
|
245
245
|
|
|
246
246
|
// Prefer using toContain()
|
|
247
|
-
// https://
|
|
247
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-to-contain.html
|
|
248
248
|
'jest/prefer-to-contain': 'error',
|
|
249
249
|
|
|
250
250
|
// Suggest using toHaveLength()
|
|
251
|
-
// https://
|
|
251
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-to-have-length.html
|
|
252
252
|
'jest/prefer-to-have-length': 'error',
|
|
253
253
|
|
|
254
254
|
// Suggest using test.todo
|
|
255
|
-
// https://
|
|
255
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/prefer-todo.html
|
|
256
256
|
'jest/prefer-todo': 'error',
|
|
257
257
|
|
|
258
258
|
// Require setup and teardown to be within a hook
|
|
259
|
-
// https://
|
|
259
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/require-hook.html
|
|
260
260
|
'jest/require-hook': 'error',
|
|
261
261
|
|
|
262
262
|
// Require toThrow() to be called with an error message
|
|
263
|
-
// https://
|
|
263
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/require-to-throw-message.html
|
|
264
264
|
'jest/require-to-throw-message': 'error',
|
|
265
265
|
|
|
266
266
|
// Enforce that all tests are in a top-level describe
|
|
267
|
-
// https://
|
|
267
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/require-top-level-describe.html
|
|
268
268
|
'jest/require-top-level-describe': 'error',
|
|
269
269
|
|
|
270
270
|
// Enforce valid describe callback
|
|
271
|
-
// https://
|
|
271
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/valid-describe-callback.html
|
|
272
272
|
'jest/valid-describe-callback': 'error',
|
|
273
273
|
|
|
274
274
|
// Enforce valid expect() usage
|
|
275
|
-
// https://
|
|
275
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/valid-expect.html
|
|
276
276
|
'jest/valid-expect': 'error',
|
|
277
277
|
|
|
278
278
|
// Enforce valid titles
|
|
279
|
-
// https://
|
|
279
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jest/valid-title.html
|
|
280
280
|
// decision: `allowArguments` avoids conflict with `prefer-describe-function-title` rule, which is enabled
|
|
281
281
|
'jest/valid-title': ['error', { allowArguments: true }],
|
|
282
282
|
|