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
Copy file name to clipboardExpand all lines: docs/GettingStarted.md
+18-11Lines changed: 18 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -220,17 +220,24 @@ Jest can be used with ESLint without any further configuration as long as you im
220
220
221
221
If you'd like to avoid these imports, you can configure your [ESLint environment](https://eslint.org/docs/latest/use/configure/language-options#specifying-environments) to support these globals by adding the `jest` environment:
222
222
223
-
```json
224
-
{
225
-
"overrides": [
226
-
{
227
-
"files": ["tests/**/*"],
228
-
"env": {
229
-
"jest": true
230
-
}
231
-
}
232
-
]
233
-
}
223
+
```js
224
+
import {defineConfig} from'eslint/config';
225
+
importglobalsfrom'globals';
226
+
227
+
exportdefaultdefineConfig([
228
+
{
229
+
files: ['**/*.js'],
230
+
languageOptions: {
231
+
globals: {
232
+
...globals.jest,
233
+
},
234
+
},
235
+
rules: {
236
+
'no-unused-vars':'warn',
237
+
'no-undef':'warn',
238
+
},
239
+
},
240
+
]);
234
241
```
235
242
236
243
Or use [`eslint-plugin-jest`](https://github.com/jest-community/eslint-plugin-jest), which has a similar effect:
0 commit comments