Skip to content

Conversation

uozopio
Copy link
Contributor

@uozopio uozopio commented Jun 26, 2025

Summary

  • Add comprehensive pre-commit and pre-push hooks to catch issues early and save CI minutes
  • Install and configure lint-staged for efficient staged file checking
  • Ensure code quality before it reaches the repository

Changes

Pre-commit Hook

  • Detects merge conflict markers
  • Warns about console.log statements (non-blocking)
  • Warns about large files >5MB (non-blocking)
  • Runs lint-staged for fast checks on staged files only:
    • Biome formatting and linting with auto-fix
    • TypeScript type checking

Pre-push Hook

  • Validates branch naming conventions (matching PR validation rules)
  • Validates commit messages follow conventional commit format
  • Runs full CI suite:
    • pnpm lint - Full linting
    • pnpm typecheck - TypeScript type checking
    • pnpm test - Test suite (with CI=true to avoid watch mode)
    • pnpm build - Build validation

Additional Updates

  • Configure lint-staged in package.json
  • Fix hook to only validate new commits (not entire history)
  • Remove deprecated Husky v9 syntax for v10 compatibility

Test Plan

  • Test merge conflict detection - blocks commits with conflict markers
  • Test console.log warning - shows warning but allows commit
  • Test large file warning - warns about files >5MB
  • Test lint-staged auto-formatting - fixes formatting issues automatically
  • Test TypeScript type checking - catches type errors in staged files
  • Test branch naming validation - blocks invalid branch names
  • Test commit message validation - enforces conventional commit format
  • Test full CI checks run before push - all checks pass

Umutcan ÖNER added 5 commits June 26, 2025 16:25
- Add comprehensive VSCode tasks.json for monorepo development workflows
- Change package.json private field from true to false
- Pre-commit: checks for merge conflicts, console.logs, large files, and runs lint-staged
- Pre-push: validates branch names, commit messages, and runs full CI checks (lint, typecheck, test, build)
- Helps catch issues early and saves CI minutes
- Remove shebang and husky.sh sourcing as warned by Husky v9
- These lines will fail in Husky v10
- Check commits since origin/develop for new branches
- Prevents validation errors on existing commits from history
Copy link

github-actions bot commented Jun 26, 2025

✅ PR Size Check Passed

This PR changes 620 lines across 5 files.

@uozopio uozopio requested a review from adminzopio June 26, 2025 13:59
@uozopio uozopio merged commit d844c1d into develop Jun 26, 2025
19 checks passed
@uozopio uozopio deleted the feat/git-hooks branch June 26, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants