Overview
ZeroStarter enforces code quality through automated tools that run on every commit. This ensures consistent code style, catches errors early, and maintains a clean commit history.Tools
| Tool | Purpose |
|---|---|
| Lefthook | Git hooks manager |
| lint-staged | Run linters on staged files |
| Oxlint | Fast JavaScript/TypeScript linter |
| Oxfmt | Fast code formatter |
| Commitlint | Commit message linter |
Git Hooks
Git hooks are configured inlefthook.yml:
lefthook.yml
Pre-commit Hook
Runs before each commit in sequence (piped):Commit-msg Hook
Validates commit messages follow conventional commit format.Lint-Staged Configuration
The.lintstagedrc.json defines what runs on staged files:
.lintstagedrc.json
- All files: Format with Oxfmt, then lint with Oxlint
- package.json: Run dependency manager script (ensures consistent dependency versions)
Formatting with Oxfmt
Oxfmt configuration in.oxfmtrc.jsonc:
.oxfmtrc.jsonc
| Setting | Value | Description |
|---|---|---|
semi | false | No semicolons (like Prettier with semi: false) |
experimentalSortImports | {} | Auto-sort imports |
experimentalTailwindcss | {} | Sort Tailwind CSS classes |
ignorePatterns | ["**/*.lock"] | Skip lock files |
Manual Formatting
Linting with Oxlint
Oxlint runs automatically via lint-staged. For manual linting:Commit Message Convention
Commits must follow Conventional Commits:Types
| Type | Description |
|---|---|
feat | New feature |
fix | Bug fix |
docs | Documentation only |
style | Code style (formatting, semicolons) |
refactor | Code change that neither fixes a bug nor adds a feature |
perf | Performance improvement |
test | Adding or updating tests |
chore | Maintenance (dependencies, build scripts) |
ci | CI/CD changes |
Examples
Breaking Changes
Append! after type for breaking changes:
Running Checks Manually
CI/CD Integration
GitHub Actions runs these checks on every PR in.github/workflows/auto-check-build.yml:
Skipping Hooks
In rare cases, you can skip hooks:Troubleshooting
Hooks Not Running
Hooks Not Running
Format Conflicts
Format Conflicts
If formatting creates unexpected changes:
Commitlint Failing
Commitlint Failing
Check your message follows the format: