- 关闭 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>
23 lines
598 B
Bash
Executable File
23 lines
598 B
Bash
Executable File
#!/bin/sh
|
||
# pre-commit hook: 对暂存的文件运行 Biome 检查
|
||
# 仅检查 src/ 下的 .ts/.tsx/.js/.jsx 文件
|
||
|
||
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '^src/.*\.(ts|tsx|js|jsx)$')
|
||
|
||
if [ -z "$STAGED_FILES" ]; then
|
||
exit 0
|
||
fi
|
||
|
||
echo "Running Biome lint on staged files..."
|
||
|
||
# 使用 biome lint 对暂存文件进行检查(仅 lint,不格式化,不自动修复)
|
||
echo "$STAGED_FILES" | xargs bunx biome lint --no-errors-on-unmatched
|
||
|
||
if [ $? -ne 0 ]; then
|
||
echo ""
|
||
echo "Biome lint failed. Fix errors or use --no-verify to bypass."
|
||
exit 1
|
||
fi
|
||
|
||
exit 0
|