简体中文
如何将默认的 linter 切换为 ESLint。
package.json
pnpm remove -w @biomejs/biome ultracite
pnpm add -w -D eslint eslint-plugin-next eslint-plugin-react eslint-plugin-react-hooks typescript-eslint
biome.json
eslint.config.mjs
import react from 'eslint-plugin-react'; import next from '@next/eslint-plugin-next'; import hooks from 'eslint-plugin-react-hooks'; import ts from 'typescript-eslint' export default [ ...ts.configs.recommended, { ignores: ['**/.next'], }, { files: ['**/*.ts', '**/*.tsx'], plugins: { react: react, 'react-hooks': hooks, '@next/next': next, }, rules: { ...react.configs['jsx-runtime'].rules, ...hooks.configs.recommended.rules, ...next.configs.recommended.rules, ...next.configs['core-web-vitals'].rules, '@next/next/no-img-element': 'error', }, }, ]
.vscode/settings.json
{ "editor.codeActionsOnSave": { "source.fixAll": true, "source.fixAll.eslint": true }, "editor.defaultFormatter": "dbaeumer.vscode-eslint", "editor.formatOnPaste": true, "editor.formatOnSave": true, "emmet.showExpandedAbbreviation": "never", "prettier.enable": true, "tailwindCSS.experimental.configFile": "./packages/tailwind-config/config.ts", "typescript.tsdk": "node_modules/typescript/lib" }
lint
{ "scripts": { "lint": "next lint" } }