Skip to content

Commit 41ccded

Browse files
feat: switch eslint-plugin-vitest to @vitest/eslint-plugin (#1627)
## PR Checklist - [x] Addresses an existing open issue: fixes #1626 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview 💖
1 parent a62d591 commit 41ccded

10 files changed

+36
-101
lines changed

docs/Migration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For example, if the repository previously using Jest for testing:
1818

1919
- `eslint-plugin-jest`, `jest`, and other Jest-related packages will be uninstalled
2020
- Any Jest config file like `jest.config.js` will be deleted
21-
- `eslint-plugin-vitest`, `vitest`, and other Vitest-related packages will be installed
21+
- `@vitest/eslint-plugin`, `vitest`, and other Vitest-related packages will be installed
2222
- A `vitest.config.ts` file will be created
2323

2424
You'll then need to manually go through the following two steps to set up tooling on GitHub:

docs/Tooling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ pnpm run lint:knip
192192

193193
Additionally:
194194

195+
- [`@vitest/eslint-plugin`](https://github.com/vitest-dev/eslint-plugin-vitest) will be added to the ESLint config to lint for Vitest-specific issues
195196
- [`console-fail-test`](https://github.com/JoshuaKGoldberg/console-fail-test) will also be added to ensure tests don't accidentally log to the console.
196-
- [`eslint-plugin-vitest`](https://github.com/veritem/eslint-plugin-vitest) will be added to the ESLint config to lint for Vitest-specific issues
197197

198198
Running tests in watch mode:
199199

eslint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ If you're interested in learning more, see the 'getting started' docs on:
1010

1111
import eslint from "@eslint/js";
1212
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
13+
import vitest from "@vitest/eslint-plugin";
1314
import jsdoc from "eslint-plugin-jsdoc";
1415
import jsonc from "eslint-plugin-jsonc";
1516
import markdown from "eslint-plugin-markdown";
1617
import n from "eslint-plugin-n";
1718
import packageJson from "eslint-plugin-package-json/configs/recommended";
1819
import perfectionist from "eslint-plugin-perfectionist";
1920
import * as regexp from "eslint-plugin-regexp";
20-
import vitest from "eslint-plugin-vitest";
2121
import yml from "eslint-plugin-yml";
2222
import tseslint from "typescript-eslint";
2323

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"@types/node": "^22.1.0",
7373
"@types/parse-author": "^2.0.3",
7474
"@vitest/coverage-v8": "^2.0.5",
75+
"@vitest/eslint-plugin": "^1.0.1",
7576
"c8": "^10.1.2",
7677
"console-fail-test": "^0.4.4",
7778
"cspell": "^8.13.1",
@@ -83,7 +84,6 @@
8384
"eslint-plugin-package-json": "^0.15.2",
8485
"eslint-plugin-perfectionist": "^3.1.3",
8586
"eslint-plugin-regexp": "^2.6.0",
86-
"eslint-plugin-vitest": "^0.5.4",
8787
"eslint-plugin-yml": "^1.14.0",
8888
"globby": "^14.0.2",
8989
"husky": "^9.1.4",

pnpm-lock.yaml

+26-91
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/__snapshots__/migrate-test-e2e.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ exports[`expected file changes > eslint.config.js 1`] = `
110110
-
111111
import eslint from "@eslint/js";
112112
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
113-
import jsdoc from "eslint-plugin-jsdoc";
113+
import vitest from "@vitest/eslint-plugin";
114114
@@ ... @@ export default tseslint.config(
115115
languageOptions: {
116116
parserOptions: {

src/steps/finalizeDependencies.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe("finalize", () => {
3838
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
3939
[
4040
[
41-
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @types/eslint__js@latest @types/node@latest @vitest/coverage-v8@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-vitest@latest eslint-plugin-yml@latest husky@latest jsonc-eslint-parser@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D",
41+
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @types/eslint__js@latest @types/node@latest @vitest/coverage-v8@latest @vitest/eslint-plugin@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-yml@latest husky@latest jsonc-eslint-parser@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D",
4242
],
4343
[
4444
"npx all-contributors-cli generate",
@@ -59,7 +59,7 @@ describe("finalize", () => {
5959
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
6060
[
6161
[
62-
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @types/eslint__js@latest @types/node@latest @vitest/coverage-v8@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-vitest@latest eslint-plugin-yml@latest husky@latest jsonc-eslint-parser@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D --offline",
62+
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @types/eslint__js@latest @types/node@latest @vitest/coverage-v8@latest @vitest/eslint-plugin@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-yml@latest husky@latest jsonc-eslint-parser@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D --offline",
6363
],
6464
[
6565
"npx all-contributors-cli generate",

src/steps/finalizeDependencies.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export async function finalizeDependencies(options: Options) {
5050
? []
5151
: [
5252
"@vitest/coverage-v8",
53+
"@vitest/eslint-plugin",
5354
"console-fail-test",
54-
"eslint-plugin-vitest",
5555
"vitest",
5656
]),
5757
]

src/steps/writing/creation/createESLintConfig.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ describe("createESLintConfig", () => {
110110
.toMatchInlineSnapshot(`
111111
"import eslint from "@eslint/js";
112112
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
113+
import vitest from "@vitest/eslint-plugin";
113114
import jsdoc from "eslint-plugin-jsdoc";
114115
import jsonc from "eslint-plugin-jsonc";
115116
import markdown from "eslint-plugin-markdown";
116117
import n from "eslint-plugin-n";
117118
import packageJson from "eslint-plugin-package-json/configs/recommended";
118119
import perfectionist from "eslint-plugin-perfectionist";
119120
import * as regexp from "eslint-plugin-regexp";
120-
import vitest from "eslint-plugin-vitest";
121121
import yml from "eslint-plugin-yml";
122122
import tseslint from "typescript-eslint";
123123

src/steps/writing/creation/createESLintConfig.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export async function createESLintConfig(options: Options) {
88
`import eslint from "@eslint/js";`,
99
!options.excludeLintESLint &&
1010
`import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";`,
11+
!options.excludeTests && `import vitest from "@vitest/eslint-plugin";`,
1112
!options.excludeLintJSDoc && `import jsdoc from "eslint-plugin-jsdoc";`,
1213
!options.excludeLintJson && `import jsonc from "eslint-plugin-jsonc";`,
1314
!options.excludeLintMd && `import markdown from "eslint-plugin-markdown";`,
@@ -18,7 +19,6 @@ export async function createESLintConfig(options: Options) {
1819
`import perfectionist from "eslint-plugin-perfectionist";`,
1920
!options.excludeLintRegex &&
2021
`import * as regexp from "eslint-plugin-regexp";`,
21-
!options.excludeTests && `import vitest from "eslint-plugin-vitest";`,
2222
!options.excludeLintYml && `import yml from "eslint-plugin-yml";`,
2323
`import tseslint from "typescript-eslint";`,
2424
].filter(Boolean);

0 commit comments

Comments
 (0)