-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Priority
🟡 Minor - Code Quality & Team Workflow
Location
Repository root - missing .husky directory and related config
Problem Description
The project has no automated code quality checks before commits.
Missing Automations
1. Pre-commit Hooks
No automated checks before commit - code with errors gets committed.
2. Linting on Commit
- TypeScript errors committed
- ESLint warnings committed
- Prettier formatting not applied
3. Test Verification
No tests run before commit - broken tests can be committed
4. Commit Message Linting
No enforced commit message format - inconsistent commit styles
Issues
1. Broken Code in Repository
Can commit code with syntax errors.
2. Inconsistent Formatting
Different developers use different formatting styles.
3. TypeScript Errors in Git History
Bisecting becomes difficult, CI/CD fails after merge.
4. Manual Review Required
Must manually check code quality - wastes reviewer time.
Expected Behavior
Pre-commit Setup
Install husky and lint-staged, configure pre-commit hooks.
Commit Message Linting
Enforce conventional commits format.
Benefits
For Developers
- Immediate feedback on code quality
- Automatic formatting
- Prevents bad commits
- Faster development
For Reviewers
- Consistent code style
- Fewer nitpicks
- Focus on logic, not formatting
- Faster reviews
For Project
- Clean git history
- Fewer CI failures
- Better code quality
- Professional workflow
Related Issues
- Critical bug in authentication module #2 - Build errors ignored (pre-commit would catch)
- Critical: Docker Compose Configuration Uses MongoDB Instead of PostgreSQL #6 - Debug console.log (pre-commit would catch)
- Major: No Rate Limiting on API Routes #12 - French comments (could warn)
Steps to Fix
Phase 1: Basic Hooks
- Install husky and lint-staged
- Set up pre-commit hook
- Configure lint-staged
- Test with intentional bad code
Phase 2: Commit Messages
- Install commitlint
- Configure commit message rules
- Add commit-msg hook
Phase 3: Additional Checks
- Run affected tests on commit
- Check for console.log/debugger
- Validate file sizes
Phase 4: Team Onboarding
- Document in contributing guide
- Ensure hooks work for all platforms
- Add to setup documentation
Additional Context
Pre-commit hooks are a best practice for professional projects. They catch issues at the commit stage, preventing bad code from ever entering the repository. This is especially important for teams.
Git Hooks vs CI/CD
Pre-commit hooks: Catch issues immediately (fast)
CI/CD: Catch issues after push (slow, but comprehensive)
Both needed for optimal workflow