Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: switch eslint-plugin-vitest to @vitest/eslint-plugin #1627

Merged
merged 3 commits into from
Aug 13, 2024
Merged
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
2 changes: 1 addition & 1 deletion docs/Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For example, if the repository previously using Jest for testing:

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

You'll then need to manually go through the following two steps to set up tooling on GitHub:
Expand Down
2 changes: 1 addition & 1 deletion docs/Tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ pnpm run lint:knip

Additionally:

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

Running tests in watch mode:

Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ If you're interested in learning more, see the 'getting started' docs on:

import eslint from "@eslint/js";
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
import vitest from "@vitest/eslint-plugin";
import jsdoc from "eslint-plugin-jsdoc";
import jsonc from "eslint-plugin-jsonc";
import markdown from "eslint-plugin-markdown";
import n from "eslint-plugin-n";
import packageJson from "eslint-plugin-package-json/configs/recommended";
import perfectionist from "eslint-plugin-perfectionist";
import * as regexp from "eslint-plugin-regexp";
import vitest from "eslint-plugin-vitest";
import yml from "eslint-plugin-yml";
import tseslint from "typescript-eslint";

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"@types/node": "^22.1.0",
"@types/parse-author": "^2.0.3",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/eslint-plugin": "^1.0.1",
"c8": "^10.1.2",
"console-fail-test": "^0.4.4",
"cspell": "^8.13.1",
Expand All @@ -83,7 +84,6 @@
"eslint-plugin-package-json": "^0.15.2",
"eslint-plugin-perfectionist": "^3.1.3",
"eslint-plugin-regexp": "^2.6.0",
"eslint-plugin-vitest": "^0.5.4",
"eslint-plugin-yml": "^1.14.0",
"globby": "^14.0.2",
"husky": "^9.1.4",
Expand Down
117 changes: 26 additions & 91 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion script/__snapshots__/migrate-test-e2e.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ exports[`expected file changes > eslint.config.js 1`] = `
-
import eslint from "@eslint/js";
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
import jsdoc from "eslint-plugin-jsdoc";
import vitest from "@vitest/eslint-plugin";
@@ ... @@ export default tseslint.config(
languageOptions: {
parserOptions: {
Expand Down
4 changes: 2 additions & 2 deletions src/steps/finalizeDependencies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("finalize", () => {
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
[
[
"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",
"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",
],
[
"npx all-contributors-cli generate",
Expand All @@ -59,7 +59,7 @@ describe("finalize", () => {
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
[
[
"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",
"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",
],
[
"npx all-contributors-cli generate",
Expand Down
2 changes: 1 addition & 1 deletion src/steps/finalizeDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export async function finalizeDependencies(options: Options) {
? []
: [
"@vitest/coverage-v8",
"@vitest/eslint-plugin",
"console-fail-test",
"eslint-plugin-vitest",
"vitest",
]),
]
Expand Down
2 changes: 1 addition & 1 deletion src/steps/writing/creation/createESLintConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ describe("createESLintConfig", () => {
.toMatchInlineSnapshot(`
"import eslint from "@eslint/js";
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
import vitest from "@vitest/eslint-plugin";
import jsdoc from "eslint-plugin-jsdoc";
import jsonc from "eslint-plugin-jsonc";
import markdown from "eslint-plugin-markdown";
import n from "eslint-plugin-n";
import packageJson from "eslint-plugin-package-json/configs/recommended";
import perfectionist from "eslint-plugin-perfectionist";
import * as regexp from "eslint-plugin-regexp";
import vitest from "eslint-plugin-vitest";
import yml from "eslint-plugin-yml";
import tseslint from "typescript-eslint";

Expand Down
2 changes: 1 addition & 1 deletion src/steps/writing/creation/createESLintConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export async function createESLintConfig(options: Options) {
`import eslint from "@eslint/js";`,
!options.excludeLintESLint &&
`import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";`,
!options.excludeTests && `import vitest from "@vitest/eslint-plugin";`,
!options.excludeLintJSDoc && `import jsdoc from "eslint-plugin-jsdoc";`,
!options.excludeLintJson && `import jsonc from "eslint-plugin-jsonc";`,
!options.excludeLintMd && `import markdown from "eslint-plugin-markdown";`,
Expand All @@ -18,7 +19,6 @@ export async function createESLintConfig(options: Options) {
`import perfectionist from "eslint-plugin-perfectionist";`,
!options.excludeLintRegex &&
`import * as regexp from "eslint-plugin-regexp";`,
!options.excludeTests && `import vitest from "eslint-plugin-vitest";`,
!options.excludeLintYml && `import yml from "eslint-plugin-yml";`,
`import tseslint from "typescript-eslint";`,
].filter(Boolean);
Expand Down
Loading