fix(eslint): 修复插件冲突和本地规则加载问题

- 移除重复的 @typescript-eslint 插件声明(react-app 已包含)
- 重命名 eslint-rules → eslint-local-rules(符合插件约定)
- 简化 TypeScript overrides,仅保留规则覆盖

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
zdl
2025-12-24 19:35:16 +08:00
parent 7f4f9e4032
commit 5a4e6d2a03
3 changed files with 8 additions and 16 deletions

View File

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