From 30e863c9b8154a2e2c38c9835cf5b0f24c75ea7e Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Wed, 1 Apr 2026 07:34:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E4=BC=98=20Biome=20lint=20?= =?UTF-8?q?=E8=A7=84=E5=88=99=EF=BC=8C=E5=85=B3=E9=97=AD=20formatter=20?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=A4=A7=E8=A7=84=E6=A8=A1=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 关闭 formatter 和 organizeImports(保持原始代码风格,减少 git diff) - lint/format script 改为 biome lint(只做规则检查) - 新增关闭规则:noConsole, noArrayIndexKey, noConfusingLabels, useIterableCallbackReturn, noVoidTypeReturn, noConstantCondition, noUnusedFunctionParameters, noUselessEmptyExport, useArrowFunction, useLiteralKeys, useImportType, useNodejsImportProtocol - 零源码改动,仅调整配置文件 Co-Authored-By: Claude Opus 4.6 --- .githooks/pre-commit | 8 ++++---- TODO.md | 1 + biome.json | 29 ++++++++++++++++++----------- package.json | 4 ++-- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index b4d3b69..b337926 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -8,14 +8,14 @@ if [ -z "$STAGED_FILES" ]; then exit 0 fi -echo "Running Biome check on staged files..." +echo "Running Biome lint on staged files..." -# 使用 biome check 对暂存文件进行检查(仅 lint,不自动修复) -echo "$STAGED_FILES" | xargs bunx biome check --no-errors-on-unmatched +# 使用 biome lint 对暂存文件进行检查(仅 lint,不格式化,不自动修复) +echo "$STAGED_FILES" | xargs bunx biome lint --no-errors-on-unmatched if [ $? -ne 0 ]; then echo "" - echo "Biome check failed. Fix errors or use --no-verify to bypass." + echo "Biome lint failed. Fix errors or use --no-verify to bypass." exit 1 fi diff --git a/TODO.md b/TODO.md index c8d8cb8..c4fa54d 100644 --- a/TODO.md +++ b/TODO.md @@ -21,5 +21,6 @@ - [x] 冗余代码检查 - [x] git hook 的配置 - [x] 代码健康度检查 +- [x] Biome lint 规则调优(适配反编译代码,关闭格式化避免大规模 diff) - [x] 单元测试基础设施搭建 (test runner 配置) - [x] CI/CD 流水线 (GitHub Actions) diff --git a/biome.json b/biome.json index cc6c405..bd05fcf 100644 --- a/biome.json +++ b/biome.json @@ -9,7 +9,7 @@ "includes": ["**", "!!**/dist", "!!**/packages/@ant"] }, "formatter": { - "enabled": true, + "enabled": false, "indentStyle": "tab", "lineWidth": 120 }, @@ -25,7 +25,11 @@ "noImplicitAnyLet": "off", "noGlobalIsNan": "off", "noFallthroughSwitchClause": "off", - "noShadowRestrictedNames": "off" + "noShadowRestrictedNames": "off", + "noArrayIndexKey": "off", + "noConsole": "off", + "noConfusingLabels": "off", + "useIterableCallbackReturn": "off" }, "style": { "useConst": "off", @@ -34,7 +38,9 @@ "useDefaultParameterLast": "off", "noUnusedTemplateLiteral": "off", "useTemplate": "off", - "useNumberNamespace": "off" + "useNumberNamespace": "off", + "useNodejsImportProtocol": "off", + "useImportType": "off" }, "complexity": { "noForEach": "off", @@ -45,7 +51,10 @@ "noUselessSwitchCase": "off", "noUselessFragments": "off", "noUselessTernary": "off", - "noUselessLoneBlockStatements": "off" + "noUselessLoneBlockStatements": "off", + "noUselessEmptyExport": "off", + "useArrowFunction": "off", + "useLiteralKeys": "off" }, "correctness": { "noUnusedVariables": "off", @@ -53,7 +62,10 @@ "useExhaustiveDependencies": "off", "noSwitchDeclarations": "off", "noUnreachable": "off", - "useHookAtTopLevel": "off" + "useHookAtTopLevel": "off", + "noVoidTypeReturn": "off", + "noConstantCondition": "off", + "noUnusedFunctionParameters": "off" }, "a11y": { "recommended": false @@ -69,11 +81,6 @@ } }, "assist": { - "enabled": true, - "actions": { - "source": { - "organizeImports": "on" - } - } + "enabled": false } } diff --git a/package.json b/package.json index e299d37..04be5fd 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "build": "bun build src/entrypoints/cli.tsx --outdir dist --target bun", "dev": "bun run src/entrypoints/cli.tsx", "prepublishOnly": "bun run build", - "lint": "biome check src/", - "lint:fix": "biome check --fix src/", + "lint": "biome lint src/", + "lint:fix": "biome lint --fix src/", "format": "biome format --write src/", "prepare": "git config core.hooksPath .githooks", "test": "bun test",