feat: add unified linting scripts and git hooks for code quality enforcement
- Introduced `lint` and `lint-fix` applications in `flake.nix` for unified linting of backend (Python) and frontend (TypeScript/Svelte) code. - Added `scripts/lint.sh` for manual linting execution. - Created `scripts/install-hooks.sh` to set up git hooks for automatic linting before commits and optional tests before pushes. - Updated `README.md` with instructions for using the new linting features and git hooks.
This commit is contained in:
50
README.md
50
README.md
@@ -59,6 +59,56 @@ npm run dev
|
||||
- Backend API Docs: http://localhost:8000/docs
|
||||
- Backend Health: http://localhost:8000/health
|
||||
|
||||
## Code Quality & Linting
|
||||
|
||||
### Unified Linting (All Languages)
|
||||
|
||||
```bash
|
||||
# Check all code (Python + TypeScript/Svelte)
|
||||
./scripts/lint.sh
|
||||
# OR using nix:
|
||||
nix run .#lint
|
||||
|
||||
# Auto-fix all issues
|
||||
nix run .#lint-fix
|
||||
```
|
||||
|
||||
### Git Hooks (Automatic)
|
||||
|
||||
Install git hooks to run linting automatically:
|
||||
|
||||
```bash
|
||||
./scripts/install-hooks.sh
|
||||
```
|
||||
|
||||
This installs:
|
||||
- **pre-commit**: Runs linting before each commit
|
||||
- **pre-push**: Runs tests before push (optional)
|
||||
|
||||
To skip hooks when committing:
|
||||
```bash
|
||||
git commit --no-verify
|
||||
```
|
||||
|
||||
### Manual Linting
|
||||
|
||||
**Backend (Python):**
|
||||
```bash
|
||||
cd backend
|
||||
ruff check app/ # Check for issues
|
||||
ruff check --fix app/ # Auto-fix issues
|
||||
ruff format app/ # Format code
|
||||
```
|
||||
|
||||
**Frontend (TypeScript/Svelte):**
|
||||
```bash
|
||||
cd frontend
|
||||
npm run lint # ESLint check
|
||||
npm run check # TypeScript check
|
||||
npx prettier --check src/ # Prettier check
|
||||
npx prettier --write src/ # Auto-format
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user