openclaw/git-hooks/pre-commit
Cyrus Goh 13661abbd8
chore: add lint check to pre-commit hook
- Add scripts/lint-staged.js to run oxlint on staged files
- Extend format-staged.js to include ui/src/ directory
- Update pre-commit hook to run both format and lint checks

The pre-commit hook now blocks commits if there are linting
errors, catching issues like unused imports before they land.
2026-01-25 21:34:15 -08:00

10 lines
223 B
Bash
Executable File

#!/bin/sh
ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
[ -z "$ROOT" ] && exit 0
# Format staged files
node "$ROOT/scripts/format-staged.js" || exit 1
# Lint staged files
node "$ROOT/scripts/lint-staged.js" || exit 1