Pre-commit Hooks

LaunchIt uses Husky to manage Git hooks, ensuring code quality standards are maintained before each commit.

Installation

  1. Add Husky to your workspace root:
pnpm add -Dw husky@latest
  1. Initialize Husky:
pnpm dlx husky init
  1. Create the pre-commit hook:
echo "cd web && pnpm run fix:all" > .husky/pre-commit

This will run the following checks before each commit:

  • ESLint for code style and potential errors
  • Prettier for consistent formatting
  • TypeScript compilation check
  • Unit tests

Skipping Hooks

In cases where you need to bypass the pre-commit hooks (not recommended), you can use:

git commit -m "your message" --no-verify

Skipping pre-commit hooks should be done with caution as it bypasses quality checks.

Manual Quality Checks

You can also run the quality checks manually:

cd app
pnpm run fix:all # Runs all checks and fixes
pnpm run lint # Only ESLint
pnpm run format # Only Prettier
pnpm run typecheck # Only TypeScript