This project uses git hooks to maintain code quality and ensure builds pass before commits and pushes.
-
pre-commit: Runs
npm run lintbefore each commit- Prevents commits if ESLint errors are found
- Ensures code follows the project's linting standards
-
pre-push: Runs
npm run buildbefore each push- Prevents pushes if the build fails
- Ensures the project compiles successfully before sharing changes
Run the setup script to configure git hooks:
./setup-hooks.shOr manually configure:
chmod +x .githooks/pre-commit .githooks/pre-push
git config core.hooksPath .githooksSometimes you may need to bypass hooks (use sparingly):
# Skip pre-commit hook
git commit --no-verify -m "your message"
# Skip pre-push hook
git push --no-verify- Runs automatically on
git commit - Executes
npm run lint - Exits with error code if linting fails
- Shows helpful error messages
- Runs automatically on
git push - Executes
npm run build - Exits with error code if build fails
- Prevents pushing broken code to remote repository
✅ Code Quality: Ensures all committed code passes linting standards ✅ Build Safety: Prevents pushing code that doesn't compile ✅ Team Consistency: All developers follow the same quality checks ✅ CI/CD Friendly: Reduces failed builds in CI/CD pipelines