You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make sure you're running ESLint `v9.0.0` or higher for the latest version of this plugin to work. The following example is how your `eslint.config.js` should be setup for this plugin to work for you.
25
25
26
26
```js
27
+
import { defineConfig } from'eslint/config'
27
28
importvitestfrom'@vitest/eslint-plugin'
28
29
29
-
exportdefault [
30
-
{
31
-
files: ['tests/**'], // or any other pattern
32
-
plugins: {
33
-
vitest,
34
-
},
35
-
rules: {
36
-
...vitest.configs.recommended.rules, // you can also use vitest.configs.all.rules to enable all rules
37
-
'vitest/max-nested-describe': ['error', { max:3 }], // you can also modify rules' behavior using option like this
38
-
},
30
+
exportdefaultdefineConfig({
31
+
files: ['tests/**'], // or any other pattern
32
+
plugins: {
33
+
vitest,
34
+
},
35
+
rules: {
36
+
...vitest.configs.recommended.rules, // you can also use vitest.configs.all.rules to enable all rules
37
+
'vitest/max-nested-describe': ['error', { max:3 }], // you can also modify rules' behavior using option like this
39
38
},
40
-
]
39
+
})
41
40
```
42
41
43
42
If you're not using the latest version of ESLint (version `v8.57.0` or lower) you can setup this plugin using the following configuration
@@ -80,9 +79,20 @@ Vitest ships with an optional [type-testing feature](https://vitest.dev/guide/te
80
79
If you're using this feature, you should also enabled `typecheck` in the settings for this plugin. This ensures that rules like [expect-expect](docs/rules/expect-expect.md) account for type-related assertions in tests.
81
80
82
81
```js
82
+
import { defineConfig } from'eslint/config'
83
+
importtseslintfrom'typescript-eslint'
83
84
importvitestfrom'@vitest/eslint-plugin'
84
85
85
-
exportdefault [
86
+
exportdefaultdefineConfig(
87
+
// see https://typescript-eslint.io
88
+
tseslint.configs.recommended,
89
+
{
90
+
languageOptions: {
91
+
parserOptions: {
92
+
projectService:true,
93
+
},
94
+
},
95
+
},
86
96
{
87
97
files: ['tests/**'], // or any other pattern
88
98
plugins: {
@@ -102,32 +112,31 @@ export default [
102
112
},
103
113
},
104
114
},
105
-
]
115
+
)
106
116
```
107
117
108
118
### Custom Fixtures
109
119
110
120
If you're using custom fixtures in a separate file and importing them in your tests, you can let the plugin know about them by adding them to the `vitestImports` setting. The property accepts an array of strings or regular expressions that match the module names where your custom fixtures are defined.
0 commit comments