The pre-commit hook is file-scoped (LEFTHOOK_FILES), so it can't naturally run the test suite. Pre-push is the right tier for it: - Runs after all commits are made but before the push leaves the machine, catching regressions that span multiple commits - ~3.5s including the tsc step (negligible vs the typical push round-trip to CI) - Offline and deterministic, same philosophy as pre-commit lefthook.yml: new pre-push section, sequential (parallel: false since there's only one command, but the explicit value documents the intent that this hook runs commands in order rather than racing). project-specs.md: updated the CHECK TIERS table to add the pre-push column with in it. Updated the rule-of-thumb list to include the pre-push tier. Updated the 'why' notes to explain why lives in pre-push rather than pre-commit (LEFTHOOK_FILES doesn't apply to the test runner).
22 lines
621 B
YAML
22 lines
621 B
YAML
min_version: 2.0.0
|
|
|
|
pre-commit:
|
|
parallel: true
|
|
commands:
|
|
oxlint:
|
|
glob: "*.{ts,tsx,js,jsx,mjs,cjs}"
|
|
run: sh -c 'LEFTHOOK_FILES="$*" npm run check:oxlint' sh {staged_files}
|
|
oxfmt:
|
|
glob: "*.{ts,tsx,js,jsx,mjs,cjs,json,jsonc,yaml,yml,md,mdx}"
|
|
run: sh -c 'LEFTHOOK_FILES="$*" npm run check:oxfmt' sh {staged_files}
|
|
cspell:
|
|
run: sh -c 'LEFTHOOK_FILES="$*" npm run check:cspell' sh {staged_files}
|
|
typecheck:
|
|
run: npm run check:tsc
|
|
|
|
pre-push:
|
|
parallel: false
|
|
commands:
|
|
test:
|
|
run: npm test
|