mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-10-28 07:37:56 +09:00
Adds a shared git hook (.githooks/pre-commit) that lints staged frontend JS/JSX and blocks the commit on ESLint ERRORS only (warnings allowed). It exits early for commits with no frontend JS/JSX (backend, SCSS, docs), so it never disrupts those. Enable once per clone: `git config core.hooksPath .githooks` (or `sh frontend/setup-hooks.sh`). Chose a committed .githooks script over husky/lint-staged: this is a monorepo (git root has the Python backend; only frontend/ is a node package with no root package.json), so a dependency-free hook avoids an npm-install-time git-config mutation and keeps backend committers unaffected. Documented in AGENTS.md. Tested: blocks a staged file with a parse error (exit 123), passes when clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7 lines
294 B
Bash
7 lines
294 B
Bash
#!/bin/sh
|
|
# Enable the repo's shared git hooks (pre-commit ESLint guard).
|
|
# Run once after cloning: sh frontend/setup-hooks.sh
|
|
cd "$(git rev-parse --show-toplevel)" || exit 1
|
|
git config core.hooksPath .githooks
|
|
echo "✓ core.hooksPath set to .githooks — pre-commit ESLint guard is active."
|