diff --git a/.eslintrc.js b/.eslintrc.js index 7a1b8166..96057815 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -54,29 +54,21 @@ module.exports = { }, /* TypeScript 文件特殊配置 */ + // 注意:react-app 已包含完整的 @typescript-eslint 配置 + // 此处仅覆盖特定规则,不重复加载插件 overrides: [ { - files: ['**/*.ts', '**/*.tsx'], // 仅对 TS 文件应用以下配置 - parser: '@typescript-eslint/parser', // 使用 TypeScript 解析器 - parserOptions: { - project: './tsconfig.json', // 关联 tsconfig.json - }, - extends: [ - 'plugin:@typescript-eslint/recommended', // TypeScript 推荐规则 - ], - plugins: ['@typescript-eslint'], + files: ['**/*.ts', '**/*.tsx'], rules: { - // TypeScript 特定规则 - '@typescript-eslint/no-explicit-any': 'warn', // 警告使用 any(允许但提示) - '@typescript-eslint/explicit-module-boundary-types': 'off', // 不强制导出函数类型 + // TypeScript 特定规则覆盖 + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', }], - '@typescript-eslint/no-non-null-assertion': 'warn', // 警告使用 !(非空断言) - - // 覆盖基础规则(避免与 TS 规则冲突) - 'no-unused-vars': 'off', // 使用 TS 版本的规则 + '@typescript-eslint/no-non-null-assertion': 'warn', + 'no-unused-vars': 'off', }, }, // Company 视图主题硬编码检测 diff --git a/eslint-rules/index.js b/eslint-local-rules/index.js similarity index 100% rename from eslint-rules/index.js rename to eslint-local-rules/index.js diff --git a/eslint-rules/no-hardcoded-fui-colors.js b/eslint-local-rules/no-hardcoded-fui-colors.js similarity index 100% rename from eslint-rules/no-hardcoded-fui-colors.js rename to eslint-local-rules/no-hardcoded-fui-colors.js