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