From 27450532389595f4f2c29c02038ed1b9e8ac7d04 Mon Sep 17 00:00:00 2001 From: nayounsang Date: Wed, 23 Oct 2024 17:46:37 +0900 Subject: [PATCH 1/6] docs: set plugin in eslint 9 --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index bfff60cf9..a6c201dd6 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,14 @@ can omit the `eslint-plugin-` prefix: } ``` +If you are using `eslint` version 9 or higher, + +```js +plugins: { + jest: jestPlugin, +}, +``` + Then configure the rules you want to use under the rules section. ```json From b8c5097c8c7525ae7129f195eb8ad35a2f9bc94c Mon Sep 17 00:00:00 2001 From: nayounsang Date: Wed, 23 Oct 2024 17:48:43 +0900 Subject: [PATCH 2/6] feat: latest value of global variable keys --- src/globals.latest.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/globals.latest.json 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 From b35eee646645c82dff3e3ff674de5a9311e9543a Mon Sep 17 00:00:00 2001 From: nayounsang Date: Wed, 23 Oct 2024 17:49:42 +0900 Subject: [PATCH 3/6] feat: add latest option in env --- src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.ts b/src/index.ts index d6322697a..ceae88acd 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, }; From b12419c6fdfed54251514f738a392c7eaf7c937c Mon Sep 17 00:00:00 2001 From: nayounsang Date: Wed, 23 Oct 2024 17:53:33 +0900 Subject: [PATCH 4/6] docs: latest global docs --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index a6c201dd6..549751d72 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,10 @@ 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, }, @@ -73,6 +77,21 @@ 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. From d98625acf340d4c3ebebd492d9ee5668900380d4 Mon Sep 17 00:00:00 2001 From: nayounsang Date: Wed, 23 Oct 2024 17:56:10 +0900 Subject: [PATCH 5/6] refactor: prettier docs --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 549751d72..74ff447ef 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ doing: ``` If you are using `eslint` version 9 or higher, + ```js import jestPlugin from "eslint-plugin-jest"; From 3085e90163fc050185f1475fe73d01843dc2111a Mon Sep 17 00:00:00 2001 From: nayounsang Date: Wed, 23 Oct 2024 18:06:06 +0900 Subject: [PATCH 6/6] refactor: prettier import --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index ceae88acd..0fe965699 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ import { version as packageVersion, } from '../package.json'; import globals from './globals.json'; -import latestGlobals from "./globals.latest.json"; +import latestGlobals from './globals.latest.json'; type RuleModule = TSESLint.RuleModule & { meta: Required, 'docs'>>; @@ -85,7 +85,7 @@ const plugin = { }, latest: { latestGlobals, - } + }, }, rules, };