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:
@@ -91,6 +91,55 @@ Both scripts perform the same functions:
|
||||
- Push to GitHub Container Registry
|
||||
- Provide next steps for using the image
|
||||
|
||||
## Git Hooks
|
||||
|
||||
This project uses Git hooks via Husky to enforce code quality:
|
||||
|
||||
1. **Pre-commit Hook:**
|
||||
- Automatically runs Biome checks before each commit
|
||||
- Prevents committing code with linting or formatting errors
|
||||
- See [HOOKS.md](./HOOKS.md) for more details and usage instructions
|
||||
|
||||
## Pre-commit Hooks
|
||||
|
||||
The project uses Git hooks to enforce code quality standards automatically when committing changes.
|
||||
|
||||
### Setup
|
||||
|
||||
Husky is used to manage Git hooks and is automatically installed and configured when you run `npm install`. No manual setup is required.
|
||||
|
||||
### Available Hooks
|
||||
|
||||
1. **pre-commit**: Runs before each commit to ensure code quality
|
||||
- Runs Biome.js to check and auto-fix formatting and path alias usage
|
||||
- Runs TypeScript type checking
|
||||
- Auto-stages files fixed by Biome.js
|
||||
|
||||
### Bypassing Hooks
|
||||
|
||||
In rare cases, you may need to bypass the pre-commit hooks:
|
||||
|
||||
```bash
|
||||
git commit --no-verify -m "Your commit message"
|
||||
```
|
||||
|
||||
⚠️ Note: Only bypass hooks when absolutely necessary and ensure code quality manually.
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If the pre-commit hook fails:
|
||||
|
||||
1. Review the error messages in the console
|
||||
2. Fix the reported issues
|
||||
3. Stage your changes again
|
||||
4. Retry the commit
|
||||
|
||||
For hook execution issues:
|
||||
```bash
|
||||
# Reinstall husky hooks
|
||||
npm run prepare
|
||||
```
|
||||
|
||||
## Environment Files
|
||||
|
||||
The project uses two separate environment files:
|
||||
|
||||
Reference in New Issue
Block a user