diff --git a/.eslintrc.js b/.eslintrc.js index c6fbb20a..a40450ac 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,15 +4,29 @@ module.exports = { es2021: true, node: true }, - extends: ['plugin:react/recommended', 'plugin:@next/next/recommended', 'standard', 'prettier'], + extends: [ + 'plugin:react/recommended', + 'plugin:@next/next/recommended', + 'standard', + 'prettier', + 'plugin:@typescript-eslint/recommended', // 添加 TypeScript 推荐规则 + 'plugin:@typescript-eslint/recommended-requiring-type-checking' // 添加需要类型检查的规则 + ], + parser: '@typescript-eslint/parser', // 使用 TypeScript 解析器 parserOptions: { ecmaFeatures: { jsx: true }, ecmaVersion: 12, - sourceType: 'module' + sourceType: 'module', + project: './tsconfig.json' // 指定 tsconfig.json 的路径 }, - plugins: ['react', 'react-hooks', 'prettier'], + plugins: [ + 'react', + 'react-hooks', + 'prettier', + '@typescript-eslint' // 添加 TypeScript 插件 + ], settings: { react: { version: 'detect' @@ -23,7 +37,9 @@ module.exports = { 'react/no-unknown-property': 'off', //