quicknotes/.cursor/rules/pre-commit-checks.mdc

62 lines
1.4 KiB
Text
Raw Normal View History

---
description: Always run pre-commit checks before committing changes
globs: **/*
---
<rule>
Before committing changes:
1. Run pre-commit checks:
```bash
./scripts/pre-commit.sh
```
2. Frontend checks must pass:
- Code formatting (bun format)
- Linting (bun lint)
- Type checking (bun check)
- Build verification (bun run build)
3. Backend checks must pass:
- Go tests (go test -v ./...)
- Go linting (golangci-lint run)
4. All checks must pass before committing:
- Fix any formatting issues
- Address all linting errors
- Fix type errors
- Fix failing tests
- Fix build errors
5. Do not bypass checks:
- Never use git commit --no-verify
- Fix issues rather than skipping checks
- Keep the codebase clean and consistent
metadata:
priority: high
version: 1.0
</rule>
examples:
- input: |
# Bad: Bypassing checks
git commit --no-verify -m "quick fix"
output: |
# Good: Run checks and fix issues
./scripts/pre-commit.sh
# Fix any issues
git add .
git commit -m "fix: resolve linting issues"
- input: |
# Bad: Ignoring failing checks
# Checks failed but commit anyway
output: |
# Good: Address all issues
./scripts/pre-commit.sh
# Fix frontend formatting
bun format
# Fix Go lint issues
# Fix failing tests
./scripts/pre-commit.sh # Run again to verify
git commit