Files
Spoolman/lefthook.yml
T
2026-07-31 09:15:22 +02:00

84 lines
3.4 KiB
YAML

pre-commit:
parallel: true
jobs:
- group: # Backend checks
parallel: false
jobs:
- name: Run lint check on backend files
run: uv run ruff check --fix .
stage_fixed: true
- name: Run format check on backend files
run: uv run ruff format .
stage_fixed: true
- name: Check UV lockfile consistency
run: uv lock --check
- group: # Client checks
parallel: false
jobs:
- name: Run lint check on client files
root: "client/"
run: ./node_modules/.bin/eslint --fix . # Hardcoded path because Windows messes up if we use npx
stage_fixed: true
- name: Run format check on client files
root: "client/"
run: ./node_modules/.bin/prettier --write .
stage_fixed: true
- group: # Client v2 checks
parallel: false
jobs:
- name: Run lint check on client_v2 files
root: "client_v2/"
run: ./node_modules/.bin/eslint --fix . # Hardcoded path because Windows messes up if we use npx
stage_fixed: true
- name: Run format check on client_v2 files
root: "client_v2/"
run: ./node_modules/.bin/prettier --write .
stage_fixed: true
- name: Run type check on client_v2 files
root: "client_v2/"
# Both prerequisites are gitignored generated code, absent on a fresh
# clone: paraglide compiles $lib/paraglide (normally done by the vite
# plugin, so a non-build check never triggers it), and svelte-kit sync
# generates .svelte-kit/tsconfig.json. npm run keeps the paraglide
# flags in package.json only, so they can't drift from vite.config.ts.
run: npm run paraglide && ./node_modules/.bin/svelte-kit sync && ./node_modules/.bin/svelte-check --tsconfig ./tsconfig.json
# Same as pre-commit but no fixes
ci:
parallel: true
jobs:
- group: # Backend checks
parallel: false
jobs:
- name: Run lint check on backend files
run: uv run ruff check .
- name: Run format check on backend files
run: uv run ruff format --check .
- name: Check UV lockfile consistency
run: uv lock --check
- name: Run backend unit tests
run: uv run pytest tests
- group: # Client checks
parallel: false
jobs:
- name: Run lint check on client files
root: "client/"
run: ./node_modules/.bin/eslint . # Hardcoded path because Windows messes up if we use npx
- name: Run format check on client files
root: "client/"
run: ./node_modules/.bin/prettier --check .
- group: # Client v2 checks
parallel: false
jobs:
- name: Run lint check on client_v2 files
root: "client_v2/"
run: ./node_modules/.bin/eslint . # Hardcoded path because Windows messes up if we use npx
- name: Run format check on client_v2 files
root: "client_v2/"
run: ./node_modules/.bin/prettier --check .
- name: Run type check on client_v2 files
root: "client_v2/"
# See the ci hook's copy of this job for why paraglide runs first.
run: npm run paraglide && ./node_modules/.bin/svelte-kit sync && ./node_modules/.bin/svelte-check --tsconfig ./tsconfig.json