Skip to content

Commit 30e863c

Browse files
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>
1 parent c649137 commit 30e863c

4 files changed

Lines changed: 25 additions & 17 deletions

File tree

.githooks/pre-commit

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ if [ -z "$STAGED_FILES" ]; then
88
exit 0
99
fi
1010

11-
echo "Running Biome check on staged files..."
11+
echo "Running Biome lint on staged files..."
1212

13-
# 使用 biome check 对暂存文件进行检查(仅 lint,不自动修复)
14-
echo "$STAGED_FILES" | xargs bunx biome check --no-errors-on-unmatched
13+
# 使用 biome lint 对暂存文件进行检查(仅 lint,不格式化,不自动修复)
14+
echo "$STAGED_FILES" | xargs bunx biome lint --no-errors-on-unmatched
1515

1616
if [ $? -ne 0 ]; then
1717
echo ""
18-
echo "Biome check failed. Fix errors or use --no-verify to bypass."
18+
echo "Biome lint failed. Fix errors or use --no-verify to bypass."
1919
exit 1
2020
fi
2121

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
- [x] 冗余代码检查
2222
- [x] git hook 的配置
2323
- [x] 代码健康度检查
24+
- [x] Biome lint 规则调优(适配反编译代码,关闭格式化避免大规模 diff)
2425
- [x] 单元测试基础设施搭建 (test runner 配置)
2526
- [x] CI/CD 流水线 (GitHub Actions)

biome.json

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"includes": ["**", "!!**/dist", "!!**/packages/@ant"]
1010
},
1111
"formatter": {
12-
"enabled": true,
12+
"enabled": false,
1313
"indentStyle": "tab",
1414
"lineWidth": 120
1515
},
@@ -25,7 +25,11 @@
2525
"noImplicitAnyLet": "off",
2626
"noGlobalIsNan": "off",
2727
"noFallthroughSwitchClause": "off",
28-
"noShadowRestrictedNames": "off"
28+
"noShadowRestrictedNames": "off",
29+
"noArrayIndexKey": "off",
30+
"noConsole": "off",
31+
"noConfusingLabels": "off",
32+
"useIterableCallbackReturn": "off"
2933
},
3034
"style": {
3135
"useConst": "off",
@@ -34,7 +38,9 @@
3438
"useDefaultParameterLast": "off",
3539
"noUnusedTemplateLiteral": "off",
3640
"useTemplate": "off",
37-
"useNumberNamespace": "off"
41+
"useNumberNamespace": "off",
42+
"useNodejsImportProtocol": "off",
43+
"useImportType": "off"
3844
},
3945
"complexity": {
4046
"noForEach": "off",
@@ -45,15 +51,21 @@
4551
"noUselessSwitchCase": "off",
4652
"noUselessFragments": "off",
4753
"noUselessTernary": "off",
48-
"noUselessLoneBlockStatements": "off"
54+
"noUselessLoneBlockStatements": "off",
55+
"noUselessEmptyExport": "off",
56+
"useArrowFunction": "off",
57+
"useLiteralKeys": "off"
4958
},
5059
"correctness": {
5160
"noUnusedVariables": "off",
5261
"noUnusedImports": "off",
5362
"useExhaustiveDependencies": "off",
5463
"noSwitchDeclarations": "off",
5564
"noUnreachable": "off",
56-
"useHookAtTopLevel": "off"
65+
"useHookAtTopLevel": "off",
66+
"noVoidTypeReturn": "off",
67+
"noConstantCondition": "off",
68+
"noUnusedFunctionParameters": "off"
5769
},
5870
"a11y": {
5971
"recommended": false
@@ -69,11 +81,6 @@
6981
}
7082
},
7183
"assist": {
72-
"enabled": true,
73-
"actions": {
74-
"source": {
75-
"organizeImports": "on"
76-
}
77-
}
84+
"enabled": false
7885
}
7986
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"build": "bun build src/entrypoints/cli.tsx --outdir dist --target bun",
1414
"dev": "bun run src/entrypoints/cli.tsx",
1515
"prepublishOnly": "bun run build",
16-
"lint": "biome check src/",
17-
"lint:fix": "biome check --fix src/",
16+
"lint": "biome lint src/",
17+
"lint:fix": "biome lint --fix src/",
1818
"format": "biome format --write src/",
1919
"prepare": "git config core.hooksPath .githooks",
2020
"test": "bun test",

0 commit comments

Comments
 (0)