Setup
During initialization, you can select which Git hook tool to use:Supported Tools
Husky
Husky is a popular tool for managing Git hooks. Ultracite creates a.husky/pre-commit file that runs npx ultracite fix before each commit.
.husky/pre-commit
lefthook
lefthook is a fast Git hooks manager written in Go. Ultracite creates alefthook.yml configuration:
lefthook.yml
lint-staged
lint-staged runs linters only on staged files. Ultracite adds configuration to yourpackage.json or creates a .lintstagedrc file:
package.json
pre-commit
pre-commit is a Python-based framework for managing Git hooks. Ultracite creates a.pre-commit-config.yaml:
.pre-commit-config.yaml
pre-commit install to activate the hooks.
How It Works
- You make changes and stage files with
git add - You run
git commit - The pre-commit hook runs
npx ultracite fix - Code is formatted and auto-fixable issues are resolved
- The commit proceeds with properly formatted code
Benefits
- Consistency: All committed code follows the same standards
- Automation: No need to remember to format code manually
- Clean History: Formatting issues never enter your repository
- Team Collaboration: Everyone follows the same rules automatically