Skip to content

Commit c9d5d79

Browse files
authored
jest to vitest (#28)
1 parent 3d1bf86 commit c9d5d79

File tree

12 files changed

+2016
-4377
lines changed

12 files changed

+2016
-4377
lines changed

babel.config.cjs

-7
This file was deleted.

eslint.config.mjs

+11-9
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ export default [
2121
},
2222
{
2323
files: ["*.ts"],
24-
parser: "@typescript-eslint/parser",
25-
parserOptions: {
26-
// eslint-disable-next-line no-undef
27-
tsconfigRootDir: process.cwd(),
28-
project: [
29-
"./tsconfig.json",
30-
"./packages/*/tsconfig.json",
31-
"./examples/*/tsconfig.json",
32-
],
24+
languageOptions: {
25+
parser: tsParser,
26+
parserOptions: {
27+
// eslint-disable-next-line no-undef
28+
tsconfigRootDir: process.cwd(),
29+
project: [
30+
"./tsconfig.json",
31+
"./packages/*/tsconfig.json",
32+
"./examples/*/tsconfig.json",
33+
],
34+
},
3335
},
3436
rules: {
3537
...typescriptPlugin.configs["recommended-requiring-type-checking"].rules,

jest.config.mjs

-16
This file was deleted.

package.json

+7-10
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,26 @@
1919
"lint:fix:package": "prettier-package-json --write package.json",
2020
"package:copy:files": "cp README.md LICENSE CHANGELOG.md packages/eslint-plugin-react-prefer-function-component",
2121
"prepare": "husky install",
22-
"test": "pnpm jest",
23-
"test:ci": "pnpm jest --coverage",
22+
"test": "pnpm vitest",
23+
"test:ci": "pnpm vitest --coverage",
2424
"typecheck": "pnpm run --recursive typecheck"
2525
},
2626
"devDependencies": {
27-
"@babel/preset-env": "^7.26.9",
28-
"@babel/preset-react": "^7.26.3",
29-
"@babel/preset-typescript": "^7.26.0",
3027
"@types/eslint": "^9.6.1",
3128
"@types/estree": "^1.0.6",
32-
"@types/jest": "^29.5.14",
3329
"@types/node": "^22.13.10",
34-
"@typescript-eslint/eslint-plugin": "^8.26.1",
35-
"@typescript-eslint/parser": "^8.26.1",
30+
"@typescript-eslint/eslint-plugin": "^8.27.0",
31+
"@typescript-eslint/parser": "^8.27.0",
32+
"@vitest/coverage-v8": "3.0.9",
3633
"eslint": "^9.22.0",
3734
"eslint-config-prettier": "^10.1.1",
3835
"eslint-plugin-react": "^7.37.4",
3936
"eslint-plugin-react-hooks": "^5.2.0",
4037
"husky": "^9.1.7",
41-
"jest": "^29.7.0",
4238
"prettier": "^3.5.3",
4339
"prettier-package-json": "^2.8.0",
44-
"typescript": "^5.8.2"
40+
"typescript": "^5.8.2",
41+
"vitest": "^3.0.9"
4542
},
4643
"packageManager": "[email protected]"
4744
}

packages/eslint-plugin-react-prefer-function-component/src/config.mts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* c8 ignore start */
12
import type { ESLint } from "eslint";
23
import preferFunctionComponent from "./prefer-function-component/index.js";
34

packages/eslint-plugin-react-prefer-function-component/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* c8 ignore start */
12
import type { ESLint } from "eslint";
23
import PreferFunctionComponent from "./prefer-function-component/index.js";
34

packages/flat-config/test.ts packages/flat-config/e2e.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { spawnSync } from "child_process";
2+
import { describe, beforeAll, it, expect } from "vitest";
23

34
function run(cmd: string) {
45
return spawnSync(cmd, { shell: true, encoding: "utf8" });

packages/legacy-config/test.ts packages/legacy-config/e2e.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { spawnSync } from "child_process";
2+
import { describe, beforeAll, it, expect } from "vitest";
23

34
function run(cmd: string) {
45
return spawnSync(cmd, { shell: true, encoding: "utf8" });
@@ -8,7 +9,7 @@ function removeAbsolutePathToEslintFile(str: string): string {
89
return str.replace(__dirname, "");
910
}
1011

11-
describe("flat config", () => {
12+
describe("legacy config", () => {
1213
beforeAll(() => process.chdir(__dirname));
1314

1415
it("flags errors", () => {

packages/legacy-config/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "legacy-config",
3-
"type": "module",
43
"version": "1.0.0",
54
"description": "",
65
"main": "index.js",
@@ -12,6 +11,6 @@
1211
"license": "ISC",
1312
"devDependencies": {
1413
"eslint": "7.32.0",
15-
"eslint-plugin-react-prefer-function-component": "^4.0.0"
14+
"eslint-plugin-react-prefer-function-component": "workspace:^"
1615
}
1716
}

0 commit comments

Comments
 (0)