Skip to content

Commit cd12d58

Browse files
authored
docs: fixed deprecated code snippet in GettingStarted.md (#15551)
1 parent fb73b54 commit cd12d58

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

docs/GettingStarted.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,24 @@ Jest can be used with ESLint without any further configuration as long as you im
220220

221221
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:
222222

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+
import globals from 'globals';
226+
227+
export default defineConfig([
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+
]);
234241
```
235242

236243
Or use [`eslint-plugin-jest`](https://github.com/jest-community/eslint-plugin-jest), which has a similar effect:

0 commit comments

Comments
 (0)