From 5a4e6d2a038b76391f4aa080c367b0aeeee4fc07 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Wed, 24 Dec 2025 19:35:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(eslint):=20=E4=BF=AE=E5=A4=8D=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=86=B2=E7=AA=81=E5=92=8C=E6=9C=AC=E5=9C=B0=E8=A7=84?= =?UTF-8?q?=E5=88=99=E5=8A=A0=E8=BD=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除重复的 @typescript-eslint 插件声明(react-app 已包含) - 重命名 eslint-rules → eslint-local-rules(符合插件约定) - 简化 TypeScript overrides,仅保留规则覆盖 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .eslintrc.js | 24 +++++++------------ {eslint-rules => eslint-local-rules}/index.js | 0 .../no-hardcoded-fui-colors.js | 0 3 files changed, 8 insertions(+), 16 deletions(-) rename {eslint-rules => eslint-local-rules}/index.js (100%) rename {eslint-rules => eslint-local-rules}/no-hardcoded-fui-colors.js (100%) 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