-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
60 lines (49 loc) · 2 KB
/
lefthook.yml
File metadata and controls
60 lines (49 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Lefthook configuration for Git hooks
# https://lefthook.dev/
# Use doublestar glob matcher for standard glob behaviour (** matches 0 or more directories)
glob_matcher: doublestar
pre-commit:
parallel: false # Sequential: type-check and tests must run on biome-fixed code
skip:
# Skip pre-commit hooks in these situations
- merge # Merge commits combine already-tested code
- rebase # Commits are replayed during rebase, already tested
commands:
npm-install:
# Sync and add package-lock.json (when package.json changes)
glob: "package.json"
run: npm install && git add package-lock.json
biome-check:
# Biome: lint, format, imports, apply safe fixes (every commit)
# config: biome.json
run: npx @biomejs/biome check --write --error-on-warnings --no-errors-on-unmatched --files-ignore-unknown=true {staged_files}
stage_fixed: true
type-check:
# TypeScript type checking (every commit)
# config: tsconfig.json
run: npx tsc --noEmit --pretty
unit-tests:
# Vitest: run unit tests (when matching files change)
glob:
- "**/*.{ts,tsx}" # code in folders
- "!e2e/**/*" # Exclude e2e tests
- "package-lock.json" # Dependency changes
- "vitest.config.ts" # Config
run: npx vitest run
pre-push:
parallel: false # `npm run build` locks, avoid race condition for Playwright
commands:
build:
# Production build catches static generation errors (e.g. missing Suspense)
run: npm run build
playwright-tests:
# Playwright: E2E tests (when matching files change).
# CI=true ensures tests run against production build (npm start),
# matching CI behaviour and avoiding dev overlay issues.
glob:
- "**/*.{ts,tsx,css}" # code in folders
- "!**/*.{test,spec}.{ts,tsx}" # Exclude unit tests
- "package-lock.json" # Dependency changes
- "postcss.config.mjs" # CSS processing
- "playwright.config.ts" # Config
run: CI=true npx playwright test