diff --git a/README.md b/README.md index bfff60cf9..74ff447ef 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,18 @@ can omit the `eslint-plugin-` prefix: } ``` +If you are using `eslint` version 9 or higher, + +```js +import jestPlugin from "eslint-plugin-jest"; + +// ... + +plugins: { + jest: jestPlugin, +}, +``` + Then configure the rules you want to use under the rules section. ```json @@ -65,6 +77,22 @@ doing: } ``` +If you are using `eslint` version 9 or higher, + +```js +import jestPlugin from "eslint-plugin-jest"; + +//... + +{ +languageOptions: { + globals: { + ...jestPlugin.environments.globals.latest + } + } +} +``` + This is included in all configs shared by this plugin, so can be omitted if extending them. diff --git a/src/globals.latest.json b/src/globals.latest.json new file mode 100644 index 000000000..25713c5dc --- /dev/null +++ b/src/globals.latest.json @@ -0,0 +1,15 @@ +{ + "afterAll": "readonly", + "afterEach": "readonly", + "beforeAll": "readonly", + "beforeEach": "readonly", + "describe": "readonly", + "expect": "readonly", + "fit": "readonly", + "it": "readonly", + "jest": "readonly", + "test": "readonly", + "xdescribe": "readonly", + "xit": "readonly", + "xtest": "readonly" +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index d6322697a..0fe965699 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,6 +6,7 @@ import { version as packageVersion, } from '../package.json'; import globals from './globals.json'; +import latestGlobals from './globals.latest.json'; type RuleModule = TSESLint.RuleModule & { meta: Required, 'docs'>>; @@ -82,6 +83,9 @@ const plugin = { globals: { globals, }, + latest: { + latestGlobals, + }, }, rules, };