Skip to content

chore: add repo-managed pre-commit and pre-push hooks

Lakshy Yarlagadda requested to merge feat/precommit into main

Summary

This MR adds repo-managed Git hooks for local quality enforcement.


What Changed

  • Added committed hook entrypoints in .githooks/
  • Added automatic hook installation through npm run prepare
  • Added staged-file validation for pre-commit
  • Added full validation for pre-push
  • Extended ESLint coverage to helper scripts
  • Excluded .githooks/ from repo-wide Prettier checks
  • Updated CONTRIBUTING.md and CHANGELOG.md

Hook Behavior

pre-commit

  • Runs staged-file Prettier formatting
  • Runs ESLint autofix on staged JS/TS files
  • Re-stages hook-modified files
  • Aborts on partially staged files to avoid pulling unstaged edits into the commit

pre-push

  • Runs npm run validate
  • Includes format check, lint, type-check, and tests

Validation

  • npm ci
  • .githooks/pre-commit
  • .githooks/pre-push

Result

  • npm run format:check passed
  • npm run lint passed
  • npm run typecheck passed
  • npm test passed
  • 32/32 tests passed

Merge request reports

Loading