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>
This commit is contained in:
parent
c6491372d0
commit
30e863c9b8
@ -8,14 +8,14 @@ if [ -z "$STAGED_FILES" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running Biome check on staged files..."
|
echo "Running Biome lint on staged files..."
|
||||||
|
|
||||||
# 使用 biome check 对暂存文件进行检查(仅 lint,不自动修复)
|
# 使用 biome lint 对暂存文件进行检查(仅 lint,不格式化,不自动修复)
|
||||||
echo "$STAGED_FILES" | xargs bunx biome check --no-errors-on-unmatched
|
echo "$STAGED_FILES" | xargs bunx biome lint --no-errors-on-unmatched
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo ""
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
1
TODO.md
1
TODO.md
@ -21,5 +21,6 @@
|
|||||||
- [x] 冗余代码检查
|
- [x] 冗余代码检查
|
||||||
- [x] git hook 的配置
|
- [x] git hook 的配置
|
||||||
- [x] 代码健康度检查
|
- [x] 代码健康度检查
|
||||||
|
- [x] Biome lint 规则调优(适配反编译代码,关闭格式化避免大规模 diff)
|
||||||
- [x] 单元测试基础设施搭建 (test runner 配置)
|
- [x] 单元测试基础设施搭建 (test runner 配置)
|
||||||
- [x] CI/CD 流水线 (GitHub Actions)
|
- [x] CI/CD 流水线 (GitHub Actions)
|
||||||
|
|||||||
29
biome.json
29
biome.json
@ -9,7 +9,7 @@
|
|||||||
"includes": ["**", "!!**/dist", "!!**/packages/@ant"]
|
"includes": ["**", "!!**/dist", "!!**/packages/@ant"]
|
||||||
},
|
},
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"enabled": true,
|
"enabled": false,
|
||||||
"indentStyle": "tab",
|
"indentStyle": "tab",
|
||||||
"lineWidth": 120
|
"lineWidth": 120
|
||||||
},
|
},
|
||||||
@ -25,7 +25,11 @@
|
|||||||
"noImplicitAnyLet": "off",
|
"noImplicitAnyLet": "off",
|
||||||
"noGlobalIsNan": "off",
|
"noGlobalIsNan": "off",
|
||||||
"noFallthroughSwitchClause": "off",
|
"noFallthroughSwitchClause": "off",
|
||||||
"noShadowRestrictedNames": "off"
|
"noShadowRestrictedNames": "off",
|
||||||
|
"noArrayIndexKey": "off",
|
||||||
|
"noConsole": "off",
|
||||||
|
"noConfusingLabels": "off",
|
||||||
|
"useIterableCallbackReturn": "off"
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
"useConst": "off",
|
"useConst": "off",
|
||||||
@ -34,7 +38,9 @@
|
|||||||
"useDefaultParameterLast": "off",
|
"useDefaultParameterLast": "off",
|
||||||
"noUnusedTemplateLiteral": "off",
|
"noUnusedTemplateLiteral": "off",
|
||||||
"useTemplate": "off",
|
"useTemplate": "off",
|
||||||
"useNumberNamespace": "off"
|
"useNumberNamespace": "off",
|
||||||
|
"useNodejsImportProtocol": "off",
|
||||||
|
"useImportType": "off"
|
||||||
},
|
},
|
||||||
"complexity": {
|
"complexity": {
|
||||||
"noForEach": "off",
|
"noForEach": "off",
|
||||||
@ -45,7 +51,10 @@
|
|||||||
"noUselessSwitchCase": "off",
|
"noUselessSwitchCase": "off",
|
||||||
"noUselessFragments": "off",
|
"noUselessFragments": "off",
|
||||||
"noUselessTernary": "off",
|
"noUselessTernary": "off",
|
||||||
"noUselessLoneBlockStatements": "off"
|
"noUselessLoneBlockStatements": "off",
|
||||||
|
"noUselessEmptyExport": "off",
|
||||||
|
"useArrowFunction": "off",
|
||||||
|
"useLiteralKeys": "off"
|
||||||
},
|
},
|
||||||
"correctness": {
|
"correctness": {
|
||||||
"noUnusedVariables": "off",
|
"noUnusedVariables": "off",
|
||||||
@ -53,7 +62,10 @@
|
|||||||
"useExhaustiveDependencies": "off",
|
"useExhaustiveDependencies": "off",
|
||||||
"noSwitchDeclarations": "off",
|
"noSwitchDeclarations": "off",
|
||||||
"noUnreachable": "off",
|
"noUnreachable": "off",
|
||||||
"useHookAtTopLevel": "off"
|
"useHookAtTopLevel": "off",
|
||||||
|
"noVoidTypeReturn": "off",
|
||||||
|
"noConstantCondition": "off",
|
||||||
|
"noUnusedFunctionParameters": "off"
|
||||||
},
|
},
|
||||||
"a11y": {
|
"a11y": {
|
||||||
"recommended": false
|
"recommended": false
|
||||||
@ -69,11 +81,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"assist": {
|
"assist": {
|
||||||
"enabled": true,
|
"enabled": false
|
||||||
"actions": {
|
|
||||||
"source": {
|
|
||||||
"organizeImports": "on"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,8 +13,8 @@
|
|||||||
"build": "bun build src/entrypoints/cli.tsx --outdir dist --target bun",
|
"build": "bun build src/entrypoints/cli.tsx --outdir dist --target bun",
|
||||||
"dev": "bun run src/entrypoints/cli.tsx",
|
"dev": "bun run src/entrypoints/cli.tsx",
|
||||||
"prepublishOnly": "bun run build",
|
"prepublishOnly": "bun run build",
|
||||||
"lint": "biome check src/",
|
"lint": "biome lint src/",
|
||||||
"lint:fix": "biome check --fix src/",
|
"lint:fix": "biome lint --fix src/",
|
||||||
"format": "biome format --write src/",
|
"format": "biome format --write src/",
|
||||||
"prepare": "git config core.hooksPath .githooks",
|
"prepare": "git config core.hooksPath .githooks",
|
||||||
"test": "bun test",
|
"test": "bun test",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user