Wire the frontend lint into pre-commit; tighten a constants doc
scripts/lint-frontend.sh had no caller: no hook, no hooksPath entry, only a
line of prose in docs/design-system.md saying violations were caught by
reviewer checklist. It now runs from pre-commit when a commit touches
src-tauri/frontend.
Placement matters. It sits above the rustfmt gate because that gate exits 0
early when no .rs files are staged, which is exactly the frontend-only commit
this check exists for. Putting it at the end would have silently skipped the
CHRONIC-XSS escaping gate that lint-frontend.sh runs via the JS suite.
constants.rs module doc: drop the filler purpose clause that restated the
module name.
- Co-Authored-By
- Claude Opus 5 (1M context) <noreply@anthropic.com>
2 files changed,
+19 insertions,
-2 deletions
| 40 |
40 |
|
echo "pre-commit: gitleaks not installed; skipping secret scan (astra gates on push)."
|
| 41 |
41 |
|
fi
|
| 42 |
42 |
|
|
|
43 |
+ |
# --- frontend design-system lint --------------------------------------------
|
|
44 |
+ |
# Runs scripts/lint-frontend.sh when the commit touches src-tauri/frontend. That
|
|
45 |
+ |
# script also runs the JS test suite, which carries the CHRONIC-XSS escaping gate,
|
|
46 |
+ |
# so it has to run on frontend-only commits. It sits ABOVE the rustfmt gate
|
|
47 |
+ |
# deliberately: that gate exits 0 early when no .rs files are staged, which is
|
|
48 |
+ |
# exactly the case where a frontend commit needs checking.
|
|
49 |
+ |
staged_frontend="$(git diff --cached --name-only --diff-filter=ACMR -- 'src-tauri/frontend/*')"
|
|
50 |
+ |
if [ -n "$staged_frontend" ]; then
|
|
51 |
+ |
if ! fe_out=$(./scripts/lint-frontend.sh 2>&1); then
|
|
52 |
+ |
echo "$fe_out"
|
|
53 |
+ |
echo "pre-commit: frontend lint failed."
|
|
54 |
+ |
echo " fix the rules above, then restage."
|
|
55 |
+ |
echo " bypass: git commit --no-verify."
|
|
56 |
+ |
exit 1
|
|
57 |
+ |
fi
|
|
58 |
+ |
echo "pre-commit: frontend lint clean."
|
|
59 |
+ |
fi
|
|
60 |
+ |
|
| 43 |
61 |
|
# Paths the gate ignores (extended regex, matched against repo-relative paths).
|
| 44 |
62 |
|
# Empty means check everything.
|
| 45 |
63 |
|
SKIP_PATHS="${SKIP_PATHS:-}"
|
| 1 |
1 |
|
//! Named constants for the GoingsOn application.
|
| 2 |
2 |
|
//!
|
| 3 |
|
- |
//! This module centralizes magic numbers and configuration values
|
| 4 |
|
- |
//! to improve maintainability and documentation.
|
|
3 |
+ |
//! One home for values used in more than one place, so a change lands once.
|
| 5 |
4 |
|
|
| 6 |
5 |
|
// Time Constants
|
| 7 |
6 |
|
|