chore(frontend): 接入 ESLint、Prettier 与 Vitest 质量门禁

This commit is contained in:
yml2213
2026-11-01 20:54:45 +08:00
parent 7f6ebddd5e
commit 6056afa436
150 changed files with 3895 additions and 1349 deletions
+19
View File
@@ -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}"