Skip to content

Commit 8881f97

Browse files
committed
fix: eslint vitest
1 parent 3af7177 commit 8881f97

File tree

8 files changed

+42
-8
lines changed

8 files changed

+42
-8
lines changed

.eslintrc.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
extends: [
99
// 'next/core-web-vitals',
1010
'next',
11-
'next/typescript',
11+
'next/typescript', // or use 'plugin:@typescript-eslint/recommended-type-checked'
1212
'plugin:tailwindcss/recommended',
1313
'plugin:prettier/recommended',
1414
],
@@ -31,7 +31,7 @@ module.exports = {
3131
files: ['**/*.test.ts', '**/*.test.tsx'],
3232
excludedFiles: ['e2e/**'],
3333
extends: [
34-
'plugin:vitest/legacy-recommended',
34+
'plugin:@vitest/legacy-recommended',
3535
'plugin:jest-dom/recommended',
3636
'plugin:testing-library/react',
3737
],

__tests__/page.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { render, screen, within } from '@testing-library/react'
1+
import { render, screen } from '@testing-library/react'
22
import userEvent from '@testing-library/user-event'
3-
import { describe, expect, it } from 'vitest'
43

4+
// import { describe, expect, it } from 'vitest'
55
import Page from '../app/page'
66
describe('Home component', () => {
77
it('renders correctly', () => {

__tests__/setup.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
import '@testing-library/jest-dom'
1+
import '@testing-library/jest-dom/vitest'
2+
3+
import { cleanup } from '@testing-library/react'
4+
import { afterEach } from 'vitest'
5+
6+
afterEach(() => {
7+
cleanup()
8+
})

next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const nextConfig = bundleAnalyzer({
1414
output: 'standalone',
1515
distDir: isProd ? 'dist' : '.next',
1616
cacheMaxMemorySize: 60 * 1024,
17-
// fix all before production. Now it slow the develop speed.
17+
// todo: fix it all before production. Now it slow the develop speed.
1818
eslint: {
1919
// Warning: This allows production builds to successfully complete even if
2020
// your project has ESLint errors.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"@types/react-dom": "^18.3.0",
7575
"@vitejs/plugin-react": "^4.3.1",
7676
"@vitest/coverage-v8": "^2.1.1",
77+
"@vitest/eslint-plugin": "^1.1.4",
7778
"autoprefixer": "^10.4.20",
7879
"cross-env": "^7.0.3",
7980
"eslint": "^8",
@@ -85,7 +86,6 @@
8586
"eslint-plugin-simple-import-sort": "^12.1.1",
8687
"eslint-plugin-tailwindcss": "^3.17.4",
8788
"eslint-plugin-testing-library": "^6.3.0",
88-
"eslint-plugin-vitest": "^0.5.4",
8989
"husky": "^9.1.6",
9090
"jsdom": "^25.0.0",
9191
"lint-staged": "^15.2.10",

pnpm-lock.yaml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"isolatedModules": true,
1313
"jsx": "preserve",
1414
"incremental": true,
15+
"types": ["vitest/globals"],
1516
"plugins": [
1617
{
1718
"name": "next"

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineConfig({
1616
setupFiles: './__tests__/setup.ts',
1717
// you might want to disable it, if you don't have tests that rely on CSS
1818
// since parsing CSS is slow
19-
css: true,
19+
// css: true,
2020
coverage: {
2121
// todo check coverage
2222
include: ['**/*.test.ts'],

0 commit comments

Comments
 (0)