@pplancq/eslint-config 3.0.1 → 4.0.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/CHANGELOG.md +26 -0
- package/MIGRATION.md +52 -0
- package/README.md +32 -56
- package/bin/init.js +8 -3
- package/main.js +67 -0
- package/package.json +11 -16
- package/rules/base.js +18 -11
- package/rules/import.js +14 -6
- package/rules/jest.js +248 -243
- package/rules/prettier.js +10 -2
- package/rules/react-jsx-a11y.js +10 -2
- package/rules/react.js +186 -168
- package/rules/typescript.js +567 -538
- package/rules/vitest.js +181 -173
- package/jest.js +0 -3
- package/node.js +0 -3
- package/prettier.js +0 -3
- package/react.js +0 -3
- package/vitest.js +0 -3
package/rules/vitest.js
CHANGED
|
@@ -1,229 +1,237 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const vitestPlugin = require('@vitest/eslint-plugin');
|
|
2
|
+
|
|
3
|
+
const vitestRules = {
|
|
4
|
+
plugins: {
|
|
5
|
+
'@vitest': vitestPlugin,
|
|
6
|
+
},
|
|
7
|
+
languageOptions: {
|
|
8
|
+
globals: {
|
|
9
|
+
...vitestPlugin.environments.env.globals,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
// eslint-plugin-import https://github.com/import-js/eslint-plugin-import
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
// import/no-extraneous-dependencies
|
|
16
|
+
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
|
|
17
|
+
'import/no-extraneous-dependencies': 'off',
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
// eslint-plugin-vitest https://github.com/veritem/eslint-plugin-vitest
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
// Require .spec test file pattern
|
|
22
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
|
|
23
|
+
'@vitest/consistent-test-filename': 'off',
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
// Enforce using test or it but not both
|
|
26
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md
|
|
27
|
+
'@vitest/consistent-test-it': 'off',
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
// Enforce having expectation in test body
|
|
30
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md
|
|
31
|
+
'@vitest/expect-expect': 'off',
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
// Enforce a maximum number of expect per test
|
|
34
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md
|
|
35
|
+
'@vitest/max-expects': 'off',
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
// Require describe block to be less than set max value or default value
|
|
38
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md
|
|
39
|
+
'@vitest/max-nested-describe': 'off',
|
|
34
40
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
// Disallow alias methods
|
|
42
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-alias-methods.md
|
|
43
|
+
'@vitest/no-alias-methods': 'off',
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
// Disallow commented out tests
|
|
46
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-commented-out-tests.md
|
|
47
|
+
'@vitest/no-commented-out-tests': 'off',
|
|
42
48
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
// Disallow conditional expects
|
|
50
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
|
|
51
|
+
'@vitest/no-conditional-expect': 'error',
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
// Disallow conditional tests
|
|
54
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md
|
|
55
|
+
'@vitest/no-conditional-in-test': 'off',
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
// Disallow conditional tests
|
|
58
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-tests.md
|
|
59
|
+
'@vitest/no-conditional-tests': 'off',
|
|
54
60
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
// Disallow disabled tests
|
|
62
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md
|
|
63
|
+
'@vitest/no-disabled-tests': 'off',
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
// Disallow using a callback in asynchronous tests and hooks
|
|
66
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-done-callback.md
|
|
67
|
+
'@vitest/no-done-callback': 'off',
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
// Disallow duplicate hooks and teardown hooks
|
|
70
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-duplicate-hooks.md
|
|
71
|
+
'@vitest/no-duplicate-hooks': 'off',
|
|
66
72
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
// Disallow focused tests
|
|
74
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md
|
|
75
|
+
'@vitest/no-focused-tests': 'off',
|
|
70
76
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
// Disallow setup and teardown hooks
|
|
78
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md
|
|
79
|
+
'@vitest/no-hooks': 'off',
|
|
74
80
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
// Disallow identical titles
|
|
82
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-identical-title.md
|
|
83
|
+
'@vitest/no-identical-title': 'error',
|
|
78
84
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
// Disallow importing node:test
|
|
86
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md
|
|
87
|
+
'@vitest/no-import-node-test': 'off',
|
|
82
88
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
// Disallow string interpolation in snapshots
|
|
90
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md
|
|
91
|
+
'@vitest/no-interpolation-in-snapshots': 'error',
|
|
86
92
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
// Disallow large snapshots
|
|
94
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-large-snapshots.md
|
|
95
|
+
'@vitest/no-large-snapshots': 'off',
|
|
90
96
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
// Disallow importing from mocks directory
|
|
98
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md
|
|
99
|
+
'@vitest/no-mocks-import': 'error',
|
|
94
100
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
101
|
+
// Disallow the use of certain matchers
|
|
102
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-matchers.md
|
|
103
|
+
'@vitest/no-restricted-matchers': 'off',
|
|
98
104
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
// Disallow specific vi. methods
|
|
106
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md
|
|
107
|
+
'@vitest/no-restricted-vi-methods': 'off',
|
|
102
108
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
// Disallow using expect outside of it or test blocks
|
|
110
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-standalone-expect.md
|
|
111
|
+
'@vitest/no-standalone-expect': 'off',
|
|
106
112
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
// Disallow using test as a prefix
|
|
114
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-prefixes.md
|
|
115
|
+
'@vitest/no-test-prefixes': 'off',
|
|
110
116
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
// Disallow return statements in tests
|
|
118
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
|
|
119
|
+
'@vitest/no-test-return-statement': 'off',
|
|
114
120
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
121
|
+
// Enforce using toBeCalledWith() or toHaveBeenCalledWith()
|
|
122
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md
|
|
123
|
+
'@vitest/prefer-called-with': 'error',
|
|
118
124
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
// Enforce using the built-in comparison matchers
|
|
126
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-comparison-matcher.md
|
|
127
|
+
'@vitest/prefer-comparison-matcher': 'off',
|
|
122
128
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
129
|
+
// Enforce using each rather than manual loops
|
|
130
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md
|
|
131
|
+
'@vitest/prefer-each': 'off',
|
|
126
132
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
133
|
+
// Enforce using the built-in quality matchers
|
|
134
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md
|
|
135
|
+
'@vitest/prefer-equality-matcher': 'off',
|
|
130
136
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
// Enforce using expect assertions instead of callbacks
|
|
138
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-assertions.md
|
|
139
|
+
'@vitest/prefer-expect-assertions': 'off',
|
|
134
140
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
141
|
+
// Enforce using expect().resolves over expect(await ...) syntax
|
|
142
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md
|
|
143
|
+
'@vitest/prefer-expect-resolves': 'off',
|
|
138
144
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
145
|
+
// Enforce having hooks in consistent order (vitest/prefer-hooks-in-order)
|
|
146
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
|
|
147
|
+
'@vitest/prefer-hooks-in-order': 'off',
|
|
142
148
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
149
|
+
// Enforce having hooks before any test cases
|
|
150
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md
|
|
151
|
+
'@vitest/prefer-hooks-on-top': 'off',
|
|
146
152
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
153
|
+
// Enforce lowercase titles
|
|
154
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-lowercase-title.md
|
|
155
|
+
'@vitest/prefer-lowercase-title': 'off',
|
|
150
156
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
157
|
+
// Enforce mock resolved/rejected shorthands for promises
|
|
158
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-promise-shorthand.md
|
|
159
|
+
'@vitest/prefer-mock-promise-shorthand': 'off',
|
|
154
160
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
// Enforce including a hint with external snapshots
|
|
162
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-snapshot-hint.md
|
|
163
|
+
'@vitest/prefer-snapshot-hint': 'off',
|
|
158
164
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
165
|
+
// Enforce using vi.spyOn
|
|
166
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
|
|
167
|
+
'@vitest/prefer-spy-on': 'off',
|
|
162
168
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
169
|
+
// Enforce strict equal over equal
|
|
170
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-equal.md
|
|
171
|
+
'@vitest/prefer-strict-equal': 'error',
|
|
166
172
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
// Enforce using toBe()
|
|
174
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be.md
|
|
175
|
+
'@vitest/prefer-to-be': 'off',
|
|
170
176
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
177
|
+
// Enforce using toBeFalsy()
|
|
178
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-falsy.md
|
|
179
|
+
'@vitest/prefer-to-be-falsy': 'error',
|
|
174
180
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
181
|
+
// Enforce using toBeObject()
|
|
182
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-object.md
|
|
183
|
+
'@vitest/prefer-to-be-object': 'error',
|
|
178
184
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
185
|
+
// Enforce using toBeTruthy
|
|
186
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-truthy.md
|
|
187
|
+
'@vitest/prefer-to-be-truthy': 'error',
|
|
182
188
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
189
|
+
// Enforce using toContain()
|
|
190
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-contain.md
|
|
191
|
+
'@vitest/prefer-to-contain': 'error',
|
|
186
192
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
193
|
+
// Enforce using toHaveLength()
|
|
194
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-length.md
|
|
195
|
+
'@vitest/prefer-to-have-length': 'error',
|
|
190
196
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
// Enforce using test.todo
|
|
198
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-todo.md
|
|
199
|
+
'@vitest/prefer-todo': 'off',
|
|
194
200
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
201
|
+
// Require setup and teardown to be within a hook
|
|
202
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
|
203
|
+
'@vitest/require-hook': 'off',
|
|
198
204
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
205
|
+
// Require local Test Context for concurrent snapshot tests
|
|
206
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
|
|
207
|
+
'@vitest/require-local-test-context-for-concurrent-snapshots': 'off',
|
|
202
208
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
209
|
+
// Require toThrow() to be called with an error message
|
|
210
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-to-throw-message.md
|
|
211
|
+
'@vitest/require-to-throw-message': 'off',
|
|
206
212
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
213
|
+
// Enforce that all tests are in a top-level describe
|
|
214
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
|
|
215
|
+
'@vitest/require-top-level-describe': 'off',
|
|
210
216
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
217
|
+
// Enforce unbound methods are called with their expected scope
|
|
218
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/unbound-method.md
|
|
219
|
+
'@vitest/unbound-method': 'off',
|
|
214
220
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
221
|
+
// Enforce valid describe callback
|
|
222
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-describe-callback.md
|
|
223
|
+
'@vitest/valid-describe-callback': 'error',
|
|
218
224
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
225
|
+
// Enforce valid expect() usage
|
|
226
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-expect.md
|
|
227
|
+
'@vitest/valid-expect': 'error',
|
|
222
228
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
// Enforce valid titles
|
|
230
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
|
|
231
|
+
'@vitest/valid-title': 'warn',
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
module.exports = {
|
|
236
|
+
vitestRules,
|
|
229
237
|
};
|
package/jest.js
DELETED
package/node.js
DELETED
package/prettier.js
DELETED
package/react.js
DELETED
package/vitest.js
DELETED