This repository uses pre-commit hooks to ensure code quality and consistency. The hooks run automatically before each commit to catch issues early.
just setup-precommit# Install pre-commit using uv
uv tool install pre-commit
# Install the git hooks
pre-commit install# Install dependencies
npm install
# Setup hooks (runs automatically via package.json prepare script)
npm run prepareThe pre-commit configuration includes the following checks:
- Trailing whitespace: Removes trailing whitespace (except in .md files)
- End of file fixer: Ensures files end with a newline
- Large files: Prevents committing files larger than 1MB
- Private keys: Detects accidentally committed private keys
- Merge conflicts: Checks for unresolved merge conflict markers
- Prettier: Formats JavaScript, CSS, JSON, YAML, and Markdown files
- Markdown linting: Ensures consistent markdown formatting
- YAML linting: Validates YAML syntax and style
- Secret detection: Scans for accidentally committed secrets and credentials
- Hugo build check: Ensures the site builds successfully
- Tailwind CSS check: Validates Tailwind CSS compilation
- TODO/FIXME detection: Warns about uncommitted TODO/FIXME comments
- Spell checking: Uses typos to catch spelling errors in content
# Run all hooks on all files
just check
# or
pre-commit run --all-files
# Run hooks on staged files only
pre-commit run
# Run a specific hook
pre-commit run prettier
pre-commit run markdownlint# Update hook versions to latest
just update-hooks
# or
pre-commit autoupdate.pre-commit-config.yaml- Main pre-commit configuration.prettierrc- Prettier formatting rules.markdownlint.json- Markdown linting rules.yamllint- YAML linting rules_typos.toml- Spell checker configuration
If you need to skip hooks in an emergency:
# Skip all hooks
git commit --no-verify -m "Emergency commit"
# Skip specific hooks
SKIP=hugo-build-check git commit -m "Skip build check"Note: Use --no-verify sparingly and fix issues in follow-up commits.