@wistia/oxlint-config 0.2.0 → 0.3.1
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/javascript.mjs +13 -0
- package/configs/node.mjs +8 -0
- package/configs/playwright.mjs +7 -0
- package/configs/react.mjs +11 -0
- package/configs/storybook.mjs +7 -0
- package/configs/styled-components.mjs +7 -0
- package/configs/testing-library.mjs +7 -0
- package/configs/typescript.mjs +20 -0
- package/configs/vitest.mjs +8 -0
- package/index.mjs +24 -0
- package/package.json +10 -16
- package/rules/{base.jsonc → base.mjs} +179 -184
- package/rules/{import.jsonc → import.mjs} +30 -32
- package/rules/{node.jsonc → node.mjs} +37 -39
- package/rules/{playwright.jsonc → playwright.mjs} +52 -54
- package/rules/{promise.jsonc → promise.mjs} +20 -22
- package/rules/{react-a11y.jsonc → react-a11y.mjs} +48 -50
- package/rules/{react.jsonc → react.mjs} +55 -57
- package/rules/{storybook.jsonc → storybook.mjs} +20 -22
- package/rules/styled-components.mjs +151 -0
- package/rules/{testing-library.jsonc → testing-library.mjs} +48 -50
- package/rules/{typescript.jsonc → typescript.mjs} +134 -136
- package/rules/{vitest.jsonc → vitest.mjs} +87 -89
- package/configs/javascript.jsonc +0 -4
- package/configs/node.jsonc +0 -4
- package/configs/playwright.jsonc +0 -4
- package/configs/react.jsonc +0 -4
- package/configs/storybook.jsonc +0 -4
- package/configs/styled-components.jsonc +0 -4
- package/configs/testing-library.jsonc +0 -4
- package/configs/typescript.jsonc +0 -4
- package/configs/vitest.jsonc +0 -4
- package/jsoncLoader.d.mts +0 -10
- package/jsoncLoader.mjs +0 -27
- package/rules/styled-components.jsonc +0 -153
|
@@ -1,324 +1,322 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"eslint-plugin-no-only-tests",
|
|
1
|
+
// NOTE: oxlint splits vitest-related rules across two plugin namespaces:
|
|
2
|
+
// - "vitest/" for rules that are vitest-specific (no Jest equivalent)
|
|
3
|
+
// - "jest/" for rules that originated in eslint-plugin-jest and are shared with vitest
|
|
4
|
+
// Both namespaces are used here for VITEST projects only. Despite the "jest/" prefix,
|
|
5
|
+
// these rules apply to vitest code. This is an oxlint naming convention, not a dependency on Jest.
|
|
6
|
+
export const vitestRules = {
|
|
7
|
+
plugins: ['vitest', 'jest'],
|
|
8
|
+
jsPlugins: [
|
|
9
|
+
{ name: 'vitest-js', specifier: '@vitest/eslint-plugin' },
|
|
10
|
+
'eslint-plugin-no-only-tests',
|
|
12
11
|
],
|
|
13
|
-
|
|
14
|
-
"rules": {
|
|
12
|
+
rules: {
|
|
15
13
|
// -- vitest-specific rules (no Jest equivalent) --
|
|
16
14
|
|
|
17
15
|
// Require .test test file pattern
|
|
18
16
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
|
|
19
|
-
|
|
17
|
+
'vitest/consistent-test-filename': 'error',
|
|
20
18
|
|
|
21
19
|
// Enforce consistent usage of each with for...of
|
|
22
20
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-each-for.md
|
|
23
|
-
|
|
21
|
+
'vitest/consistent-each-for': 'error',
|
|
24
22
|
|
|
25
23
|
// Enforce consistent usage of vi vs vitest
|
|
26
24
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-vitest-vi.md
|
|
27
|
-
|
|
25
|
+
'vitest/consistent-vitest-vi': 'error',
|
|
28
26
|
|
|
29
27
|
// Ensure hoisted APIs (vi.mock, vi.hoisted, etc.) are at the top
|
|
30
28
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/hoisted-apis-on-top.md
|
|
31
|
-
|
|
29
|
+
'vitest/hoisted-apis-on-top': 'error',
|
|
32
30
|
|
|
33
31
|
// Disallow conditional tests
|
|
34
32
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-tests.md
|
|
35
|
-
|
|
33
|
+
'vitest/no-conditional-tests': 'error',
|
|
36
34
|
|
|
37
35
|
// Disallow importing node:test
|
|
38
36
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md
|
|
39
|
-
|
|
37
|
+
'vitest/no-import-node-test': 'error',
|
|
40
38
|
|
|
41
39
|
// Prefer toHaveBeenCalledOnce() over toHaveBeenCalledTimes(1)
|
|
42
40
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-once.md
|
|
43
41
|
// decision: conflicts with prefer-called-times (jest plugin), which is enabled
|
|
44
|
-
|
|
42
|
+
'vitest/prefer-called-once': 'off',
|
|
45
43
|
|
|
46
44
|
// Prefer toHaveBeenCalledTimes over multiple assertions
|
|
47
45
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-times.md
|
|
48
|
-
|
|
46
|
+
'vitest/prefer-called-times': 'error',
|
|
49
47
|
|
|
50
48
|
// Enforce describe titles to match function names
|
|
51
49
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-describe-function-title.md
|
|
52
|
-
|
|
50
|
+
'vitest/prefer-describe-function-title': 'error',
|
|
53
51
|
|
|
54
52
|
// Prefer expect.typeOf() usage
|
|
55
53
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-type-of.md
|
|
56
|
-
|
|
54
|
+
'vitest/prefer-expect-type-of': 'error',
|
|
57
55
|
|
|
58
56
|
// Prefer vi.importActual/vi.importMock in vi.mock factories
|
|
59
57
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-import-in-mock.md
|
|
60
58
|
// decision: potentially helpful but causes too many type errors
|
|
61
|
-
|
|
59
|
+
'vitest/prefer-import-in-mock': 'off',
|
|
62
60
|
|
|
63
61
|
// Prefer strict boolean matchers (toBe(true) over toBeTruthy())
|
|
64
62
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-boolean-matchers.md
|
|
65
|
-
|
|
63
|
+
'vitest/prefer-strict-boolean-matchers': 'error',
|
|
66
64
|
|
|
67
65
|
// Suggest using toBeFalsy()
|
|
68
66
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-falsy.md
|
|
69
67
|
// decision: not necessary to be prescriptive here
|
|
70
|
-
|
|
68
|
+
'vitest/prefer-to-be-falsy': 'off',
|
|
71
69
|
|
|
72
70
|
// Prefer toBeObject()
|
|
73
71
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-object.md
|
|
74
|
-
|
|
72
|
+
'vitest/prefer-to-be-object': 'error',
|
|
75
73
|
|
|
76
74
|
// Suggest using toBeTruthy
|
|
77
75
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-truthy.md
|
|
78
76
|
// decision: not necessary to be prescriptive here
|
|
79
|
-
|
|
77
|
+
'vitest/prefer-to-be-truthy': 'off',
|
|
80
78
|
|
|
81
79
|
// Require local Test Context for concurrent snapshot tests
|
|
82
80
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
|
|
83
|
-
|
|
81
|
+
'vitest/require-local-test-context-for-concurrent-snapshots': 'error',
|
|
84
82
|
|
|
85
83
|
// -- Shared vitest/jest rules (oxlint uses the "jest/" prefix for these) --
|
|
86
84
|
|
|
87
85
|
// Prefer test or it but not both
|
|
88
86
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md
|
|
89
|
-
|
|
87
|
+
'jest/consistent-test-it': 'error',
|
|
90
88
|
|
|
91
89
|
// Enforce having expectation in test body
|
|
92
90
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md
|
|
93
|
-
|
|
91
|
+
'jest/expect-expect': 'error',
|
|
94
92
|
|
|
95
93
|
// Enforce a maximum number of expect per test
|
|
96
94
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
'jest/max-expects': [
|
|
96
|
+
'error',
|
|
99
97
|
{
|
|
100
|
-
|
|
98
|
+
max: 15,
|
|
101
99
|
},
|
|
102
100
|
],
|
|
103
101
|
|
|
104
102
|
// Nested describe block should be less than set max value or default value
|
|
105
103
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md
|
|
106
|
-
|
|
104
|
+
'jest/max-nested-describe': 'error',
|
|
107
105
|
|
|
108
106
|
// Disallow alias methods
|
|
109
107
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-alias-methods.md
|
|
110
|
-
|
|
108
|
+
'jest/no-alias-methods': 'error',
|
|
111
109
|
|
|
112
110
|
// Disallow commented out tests
|
|
113
111
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-commented-out-tests.md
|
|
114
|
-
|
|
112
|
+
'jest/no-commented-out-tests': 'error',
|
|
115
113
|
|
|
116
114
|
// Disallow conditional expects
|
|
117
115
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
|
|
118
|
-
|
|
116
|
+
'jest/no-conditional-expect': 'error',
|
|
119
117
|
|
|
120
118
|
// Disallow conditional tests
|
|
121
119
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md
|
|
122
120
|
// decision: disabled in oxlint — the native jest/ prefix doesn't match existing
|
|
123
121
|
// `eslint-disable vitest/no-conditional-in-test` comments, and the jsPlugin vitest-js/
|
|
124
122
|
// alias has the same problem. Eslint still enforces this rule.
|
|
125
|
-
|
|
123
|
+
'jest/no-conditional-in-test': 'off',
|
|
126
124
|
|
|
127
125
|
// Disallow disabled tests
|
|
128
126
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md
|
|
129
127
|
// decision: it is often useful to be allowed to add a .skip
|
|
130
|
-
|
|
128
|
+
'jest/no-disabled-tests': 'off',
|
|
131
129
|
|
|
132
130
|
// Disallow duplicate hooks and teardown hooks
|
|
133
131
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-duplicate-hooks.md
|
|
134
|
-
|
|
132
|
+
'jest/no-duplicate-hooks': 'error',
|
|
135
133
|
|
|
136
134
|
// Disallow focused tests
|
|
137
135
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md
|
|
138
|
-
|
|
136
|
+
'jest/no-focused-tests': 'error',
|
|
139
137
|
|
|
140
138
|
// Disallow setup and teardown hooks
|
|
141
139
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md
|
|
142
|
-
|
|
140
|
+
'jest/no-hooks': 'off',
|
|
143
141
|
|
|
144
142
|
// Disallow identical titles
|
|
145
143
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-identical-title.md
|
|
146
|
-
|
|
144
|
+
'jest/no-identical-title': 'error',
|
|
147
145
|
|
|
148
146
|
// Disallow string interpolation in snapshots
|
|
149
147
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md
|
|
150
|
-
|
|
148
|
+
'jest/no-interpolation-in-snapshots': 'error',
|
|
151
149
|
|
|
152
150
|
// Disallow large snapshots
|
|
153
151
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-large-snapshots.md
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
'jest/no-large-snapshots': [
|
|
153
|
+
'error',
|
|
156
154
|
{
|
|
157
|
-
|
|
155
|
+
maxSize: 500,
|
|
158
156
|
},
|
|
159
157
|
],
|
|
160
158
|
|
|
161
159
|
// Disallow importing from mocks directory
|
|
162
160
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md
|
|
163
|
-
|
|
161
|
+
'jest/no-mocks-import': 'error',
|
|
164
162
|
|
|
165
163
|
// Disallow the use of certain matchers
|
|
166
164
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-matchers.md
|
|
167
|
-
|
|
165
|
+
'jest/no-restricted-matchers': 'error',
|
|
168
166
|
|
|
169
167
|
// Disallow using expect outside of it or test blocks
|
|
170
168
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-standalone-expect.md
|
|
171
|
-
|
|
169
|
+
'jest/no-standalone-expect': 'error',
|
|
172
170
|
|
|
173
171
|
// Disallow using test as a prefix
|
|
174
172
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-prefixes.md
|
|
175
|
-
|
|
173
|
+
'jest/no-test-prefixes': 'error',
|
|
176
174
|
|
|
177
175
|
// Disallow return statements in tests
|
|
178
176
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
|
|
179
|
-
|
|
177
|
+
'jest/no-test-return-statement': 'error',
|
|
180
178
|
|
|
181
179
|
// Disallow unnecessary async in expect functions
|
|
182
180
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-unneeded-async-expect-function.md
|
|
183
|
-
|
|
181
|
+
'jest/no-unneeded-async-expect-function': 'error',
|
|
184
182
|
|
|
185
183
|
// Enforce padding around test blocks
|
|
186
184
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-test-blocks.md
|
|
187
|
-
|
|
185
|
+
'jest/padding-around-test-blocks': 'error',
|
|
188
186
|
|
|
189
187
|
// Suggest using toBeCalledWith() or toHaveBeenCalledWith()
|
|
190
188
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md
|
|
191
|
-
|
|
189
|
+
'jest/prefer-called-with': 'error',
|
|
192
190
|
|
|
193
191
|
// Suggest using the built-in comparison matchers
|
|
194
192
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-comparison-matcher.md
|
|
195
|
-
|
|
193
|
+
'jest/prefer-comparison-matcher': 'error',
|
|
196
194
|
|
|
197
195
|
// Prefer each rather than manual loops
|
|
198
196
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md
|
|
199
|
-
|
|
197
|
+
'jest/prefer-each': 'error',
|
|
200
198
|
|
|
201
199
|
// Suggest using the built-in equality matchers
|
|
202
200
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md
|
|
203
|
-
|
|
201
|
+
'jest/prefer-equality-matcher': 'error',
|
|
204
202
|
|
|
205
203
|
// Suggest using expect().resolves over expect(await ...) syntax
|
|
206
204
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md
|
|
207
|
-
|
|
205
|
+
'jest/prefer-expect-resolves': 'error',
|
|
208
206
|
|
|
209
207
|
// Prefer having hooks in consistent order
|
|
210
208
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
|
|
211
|
-
|
|
209
|
+
'jest/prefer-hooks-in-order': 'error',
|
|
212
210
|
|
|
213
211
|
// Suggest having hooks before any test cases
|
|
214
212
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md
|
|
215
|
-
|
|
213
|
+
'jest/prefer-hooks-on-top': 'error',
|
|
216
214
|
|
|
217
215
|
// Enforce lowercase titles
|
|
218
216
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-lowercase-title.md
|
|
219
|
-
|
|
217
|
+
'vitest/prefer-lowercase-title': 'off',
|
|
220
218
|
|
|
221
219
|
// Prefer mock resolved/rejected shorthands for promises
|
|
222
220
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-promise-shorthand.md
|
|
223
|
-
|
|
221
|
+
'jest/prefer-mock-promise-shorthand': 'error',
|
|
224
222
|
|
|
225
223
|
// Prefer mock return shorthands
|
|
226
224
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-return-shorthand.md
|
|
227
|
-
|
|
225
|
+
'jest/prefer-mock-return-shorthand': 'error',
|
|
228
226
|
|
|
229
227
|
// Suggest using vi.spyOn
|
|
230
228
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
|
|
231
|
-
|
|
229
|
+
'jest/prefer-spy-on': 'error',
|
|
232
230
|
|
|
233
231
|
// Prefer strict equal over equal
|
|
234
232
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-equal.md
|
|
235
|
-
|
|
233
|
+
'jest/prefer-strict-equal': 'error',
|
|
236
234
|
|
|
237
235
|
// Suggest using toBe()
|
|
238
236
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be.md
|
|
239
|
-
|
|
237
|
+
'jest/prefer-to-be': 'error',
|
|
240
238
|
|
|
241
239
|
// Prefer using toContain()
|
|
242
240
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-contain.md
|
|
243
|
-
|
|
241
|
+
'jest/prefer-to-contain': 'error',
|
|
244
242
|
|
|
245
243
|
// Suggest using toHaveLength()
|
|
246
244
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-length.md
|
|
247
|
-
|
|
245
|
+
'jest/prefer-to-have-length': 'error',
|
|
248
246
|
|
|
249
247
|
// Suggest using test.todo
|
|
250
248
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-todo.md
|
|
251
|
-
|
|
249
|
+
'jest/prefer-todo': 'error',
|
|
252
250
|
|
|
253
251
|
// Require setup and teardown to be within a hook
|
|
254
252
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
|
255
|
-
|
|
253
|
+
'jest/require-hook': 'error',
|
|
256
254
|
|
|
257
255
|
// Require toThrow() to be called with an error message
|
|
258
256
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-to-throw-message.md
|
|
259
|
-
|
|
257
|
+
'jest/require-to-throw-message': 'error',
|
|
260
258
|
|
|
261
259
|
// Enforce that all tests are in a top-level describe
|
|
262
260
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
|
|
263
|
-
|
|
261
|
+
'jest/require-top-level-describe': 'error',
|
|
264
262
|
|
|
265
263
|
// Enforce valid describe callback
|
|
266
264
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-describe-callback.md
|
|
267
|
-
|
|
265
|
+
'jest/valid-describe-callback': 'error',
|
|
268
266
|
|
|
269
267
|
// Enforce valid expect() usage
|
|
270
268
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-expect.md
|
|
271
|
-
|
|
269
|
+
'jest/valid-expect': 'error',
|
|
272
270
|
|
|
273
271
|
// Enforce valid titles
|
|
274
272
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
|
|
275
273
|
// decision: `allowArguments` avoids conflict with `prefer-describe-function-title` rule, which is enabled
|
|
276
|
-
|
|
274
|
+
'jest/valid-title': ['error', { allowArguments: true }],
|
|
277
275
|
|
|
278
276
|
// -- Rules via jsPlugins (@vitest/eslint-plugin + no-only-tests) --
|
|
279
277
|
|
|
280
278
|
// Disallow .only tests
|
|
281
279
|
// https://github.com/levibuzolic/eslint-plugin-no-only-tests
|
|
282
|
-
|
|
280
|
+
'eslint-plugin-no-only-tests/no-only-tests': 'error',
|
|
283
281
|
|
|
284
282
|
// Disallow the use of certain vi methods
|
|
285
283
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md
|
|
286
|
-
|
|
284
|
+
'vitest-js/no-restricted-vi-methods': 'error',
|
|
287
285
|
|
|
288
286
|
// Prefer toHaveBeenCalledExactlyOnceWith over manual assertions
|
|
289
287
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-exactly-once-with.md
|
|
290
|
-
|
|
288
|
+
'vitest-js/prefer-called-exactly-once-with': 'error',
|
|
291
289
|
|
|
292
290
|
// Prefer importing vitest globals
|
|
293
291
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-importing-vitest-globals.md
|
|
294
|
-
|
|
292
|
+
'vitest-js/prefer-importing-vitest-globals': 'error',
|
|
295
293
|
|
|
296
294
|
// Prefer snapshot hint for inline/external snapshots
|
|
297
295
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-snapshot-hint.md
|
|
298
|
-
|
|
296
|
+
'vitest-js/prefer-snapshot-hint': 'error',
|
|
299
297
|
|
|
300
298
|
// Enforce padding around afterAll blocks
|
|
301
299
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-all-blocks.md
|
|
302
|
-
|
|
300
|
+
'vitest-js/padding-around-after-all-blocks': 'error',
|
|
303
301
|
|
|
304
302
|
// Enforce padding around afterEach blocks
|
|
305
303
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-each-blocks.md
|
|
306
|
-
|
|
304
|
+
'vitest-js/padding-around-after-each-blocks': 'error',
|
|
307
305
|
|
|
308
306
|
// Enforce padding around beforeAll blocks
|
|
309
307
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-before-all-blocks.md
|
|
310
|
-
|
|
308
|
+
'vitest-js/padding-around-before-all-blocks': 'error',
|
|
311
309
|
|
|
312
310
|
// Enforce padding around beforeEach blocks
|
|
313
311
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-before-each-blocks.md
|
|
314
|
-
|
|
312
|
+
'vitest-js/padding-around-before-each-blocks': 'error',
|
|
315
313
|
|
|
316
314
|
// Enforce padding around expect groups
|
|
317
315
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-expect-groups.md
|
|
318
|
-
|
|
316
|
+
'vitest-js/padding-around-expect-groups': 'error',
|
|
319
317
|
|
|
320
318
|
// Enforce padding around describe blocks
|
|
321
319
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-describe-blocks.md
|
|
322
|
-
|
|
320
|
+
'vitest-js/padding-around-describe-blocks': 'error',
|
|
323
321
|
},
|
|
324
|
-
}
|
|
322
|
+
};
|
package/configs/javascript.jsonc
DELETED
package/configs/node.jsonc
DELETED
package/configs/playwright.jsonc
DELETED
package/configs/react.jsonc
DELETED
package/configs/storybook.jsonc
DELETED
package/configs/typescript.jsonc
DELETED
package/configs/vitest.jsonc
DELETED
package/jsoncLoader.d.mts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Load and parse a JSONC file (JSON with comments and trailing commas).
|
|
3
|
-
*
|
|
4
|
-
* Node's ESM loader doesn't support `.jsonc` imports, so this resolves the
|
|
5
|
-
* path via `require.resolve`, reads the file, and parses it with `jsonc-parser`.
|
|
6
|
-
*
|
|
7
|
-
* @param specifier - A module specifier resolvable by `require.resolve`
|
|
8
|
-
* @returns The parsed JSONC content
|
|
9
|
-
*/
|
|
10
|
-
export declare const jsoncLoader: (specifier: string) => Record<string, unknown>;
|
package/jsoncLoader.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
import { parse } from 'jsonc-parser';
|
|
4
|
-
|
|
5
|
-
const require = createRequire(import.meta.url);
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Load and parse a JSONC file (JSON with comments and trailing commas).
|
|
9
|
-
*
|
|
10
|
-
* Node's ESM loader doesn't support `.jsonc` imports, so this resolves the
|
|
11
|
-
* path via `require.resolve`, reads the file, and parses it with `jsonc-parser`.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* import { jsoncLoader } from '@wistia/oxlint-config/jsoncLoader';
|
|
16
|
-
*
|
|
17
|
-
* const baseRules = jsoncLoader('@wistia/oxlint-config/rules/base.jsonc');
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @param {string} specifier - A module specifier resolvable by `require.resolve`
|
|
21
|
-
* @returns {Record<string, unknown>} The parsed JSONC content
|
|
22
|
-
*/
|
|
23
|
-
export const jsoncLoader = (specifier) => {
|
|
24
|
-
const filePath = require.resolve(specifier);
|
|
25
|
-
const raw = readFileSync(filePath, 'utf8');
|
|
26
|
-
return parse(raw);
|
|
27
|
-
};
|