Add pre-commit hooks for linting and formatting
Set up pre-commit framework with ruff (backend) and ESLint/Prettier/tsc (frontend) hooks to catch issues locally before CI. Auto-format all frontend files with Prettier to comply with the new check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
34
.pre-commit-config.yaml
Normal file
34
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
repos:
|
||||
# Backend (Python) — ruff linting + formatting
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.15.0
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix]
|
||||
files: ^backend/
|
||||
- id: ruff-format
|
||||
files: ^backend/
|
||||
|
||||
# Frontend (TypeScript/React) — local hooks using project node_modules
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: eslint
|
||||
name: eslint
|
||||
entry: npx eslint
|
||||
language: system
|
||||
files: ^frontend/src/.*\.(ts|tsx)$
|
||||
pass_filenames: true
|
||||
|
||||
- id: prettier
|
||||
name: prettier
|
||||
entry: npx prettier --check
|
||||
language: system
|
||||
files: ^frontend/src/.*\.(ts|tsx|css|json)$
|
||||
pass_filenames: true
|
||||
|
||||
- id: tsc
|
||||
name: tsc
|
||||
entry: bash -c 'cd frontend && npx tsc -b'
|
||||
language: system
|
||||
files: ^frontend/src/.*\.(ts|tsx)$
|
||||
pass_filenames: false
|
||||
Reference in New Issue
Block a user