This repository uses comprehensive pre-commit hooks to ensure code quality and prevent broken commits.
Every commit automatically runs:
-
🏗️ Build Compilation -
npm run build- Ensures TypeScript compiles without errors
- Verifies all imports and exports are valid
-
🔍 Type Checking -
npm run type-check- Runs TypeScript compiler in no-emit mode
- Catches type errors before they reach the repository
-
📝 Code Linting -
npm run lint- ESLint checks for code style violations
- Enforces consistent coding standards
-
✨ Code Formatting -
prettier --write(via lint-staged)- Automatically formats staged files
- Ensures consistent code style across the project
-
🧪 Test Suite -
npm test- Runs all 1087 tests to ensure functionality
- Prevents broken code from entering the repository
Pre-commit hooks are automatically installed when you run:
npm installThe hooks are managed by Husky and lint-staged.
You can run all quality checks manually:
npm run check-allThis runs the same checks as the pre-commit hook without committing.
When pre-commit hooks fail:
- Fix the issues reported by the tools
- Stage your fixes with
git add - Retry the commit
Common failures:
- Build errors: Fix TypeScript compilation issues
- Test failures: Fix broken tests before committing
- Lint errors: Run
npm run lint:fixto auto-fix style issues - Type errors: Fix TypeScript type issues
✅ Prevents broken builds from reaching the repository
✅ Ensures all tests pass before any commit
✅ Maintains consistent code style across the team
✅ Catches errors early in the development process
✅ Improves code quality and reduces bugs
.husky/pre-commit- Main pre-commit hook script.lintstagedrc.json- Lint-staged configuration for staged filespackage.json- Scripts and dependencies
This ensures that every commit maintains production-quality standards and prevents the QA failures that previously allowed broken code to be committed.