Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down
15 changes: 15 additions & 0 deletions src/globals.latest.json
Original file line number Diff line number Diff line change
@@ -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"
}
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown[]> & {
meta: Required<Pick<TSESLint.RuleMetaData<string>, 'docs'>>;
Expand Down Expand Up @@ -82,6 +83,9 @@ const plugin = {
globals: {
globals,
},
latest: {
latestGlobals,
},
},
rules,
};
Expand Down