mirror of
https://github.com/acedanger/finance.git
synced 2025-12-05 22:50:12 -08:00
feat: add Husky pre-commit hook for Biome checks - fixes #38
This commit is contained in:
38
HOOKS.md
Normal file
38
HOOKS.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# Git Hooks
|
||||
|
||||
This project uses Git hooks to enforce code quality standards. The hooks are managed using [Husky](https://typicode.github.io/husky/).
|
||||
|
||||
## Pre-commit Hook
|
||||
|
||||
The pre-commit hook runs automatically before each commit and performs the following checks:
|
||||
|
||||
- Runs Biome checks (`npm run check`) to ensure code formatting and linting standards are met
|
||||
|
||||
### Usage
|
||||
|
||||
The hook runs automatically when you commit changes:
|
||||
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "Your commit message"
|
||||
```
|
||||
|
||||
If the code doesn't pass the Biome checks, the commit will be rejected with an error message.
|
||||
|
||||
### Bypassing the Hooks
|
||||
|
||||
In rare cases when you need to bypass the pre-commit hooks (not recommended for regular use), you can use the `--no-verify` flag:
|
||||
|
||||
```bash
|
||||
git commit -m "Your commit message" --no-verify
|
||||
```
|
||||
|
||||
> **Warning:** Bypassing hooks should be done only in exceptional circumstances. It's better to fix code quality issues than to bypass the checks.
|
||||
|
||||
## Adding New Hooks
|
||||
|
||||
To add additional Git hooks:
|
||||
|
||||
1. Create a new script in the `.husky` directory
|
||||
2. Make it executable: `chmod +x .husky/your-hook-name`
|
||||
3. Update this documentation to include information about the new hook
|
||||
Reference in New Issue
Block a user