Эх сурвалжийг харах

fix: 调优 Biome lint 规则,关闭 formatter 避免大规模代码变更

- 关闭 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 <noreply@anthropic.com>
claude-code-best 3 долоо хоног өмнө
parent
commit
30e863c9b8
4 өөрчлөгдсөн 25 нэмэгдсэн , 17 устгасан
  1. 4 4
      .githooks/pre-commit
  2. 1 0
      TODO.md
  3. 18 11
      biome.json
  4. 2 2
      package.json

+ 4 - 4
.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
 

+ 1 - 0
TODO.md

@@ -21,5 +21,6 @@
 - [x] 冗余代码检查
 - [x] git hook 的配置
 - [x] 代码健康度检查
+- [x] Biome lint 规则调优(适配反编译代码,关闭格式化避免大规模 diff)
 - [x] 单元测试基础设施搭建 (test runner 配置)
 - [x] CI/CD 流水线 (GitHub Actions)

+ 18 - 11
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
 	}
 }

+ 2 - 2
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",