chore(frontend): 接入 ESLint、Prettier 与 Vitest 质量门禁
This commit is contained in:
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
MAX_LINES="${FRONTEND_MAX_LINES:-1800}"
|
||||
failed=0
|
||||
|
||||
while IFS= read -r -d '' file; do
|
||||
lines="$(wc -l < "${file}")"
|
||||
if ((lines > MAX_LINES)); then
|
||||
printf '[frontend-size] %s %s 行,超过上限 %s\n' "${file#${ROOT_DIR}/}" "${lines}" "${MAX_LINES}" >&2
|
||||
failed=1
|
||||
fi
|
||||
done < <(find "${ROOT_DIR}/frontend/src" -name '*.tsx' -not -name '*.test.tsx' -print0)
|
||||
|
||||
if ((failed != 0)); then
|
||||
exit 1
|
||||
fi
|
||||
printf '[frontend-size] 所有 React 页面均不超过 %s 行\n' "${MAX_LINES}"
|
||||
Reference in New Issue
Block a user