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