lefthook.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Git hooks (lefthook). Keep these local checkpoints fast; CI owns the full
  2. # repository-wide gate matrix.
  3. # Install: `node scripts/install-lefthook.mjs` (runs automatically via postinstall).
  4. pre-commit:
  5. jobs:
  6. - name: format (staged)
  7. glob: '*.{ts,tsx,mts,cts,mjs}'
  8. exclude:
  9. - 'vendor/*/src/**'
  10. run: node_modules/.bin/eslint --config eslint.format.config.mjs --fix --no-warn-ignored {staged_files}
  11. stage_fixed: true
  12. - name: lint (staged)
  13. glob: '*.{ts,tsx,mts,cts,mjs}'
  14. exclude:
  15. - 'vendor/*/src/**'
  16. run: node_modules/.bin/tsx scripts/run-oxlint.ts --fix --no-error-on-unmatched-pattern {staged_files}
  17. stage_fixed: true
  18. # Regenerate rather than reject: a dependency edit that forgot the notices
  19. # would otherwise fail the test lane long after the commit. The glob matches
  20. # every input the generator reads, including the generator itself and the
  21. # build-time pin source. Deleting a manifest cannot trigger this job —
  22. # lefthook only inspects files present on disk — so that one case still
  23. # falls through to the freshness assertion in the test lane.
  24. - name: third-party notices (staged)
  25. glob: '{package.json,*/package.json,*/*/package.json,*/*/*/package.json,*/*/*/*/package.json,pnpm-workspace.yaml,*/*/pnpm-workspace.yaml,pnpm-lock.yaml,vendor/README.md,python/*/pyproject.toml,scripts/gen-third-party-notices.ts,scripts/build-exe-for-python-sdk.ts}'
  26. run: node_modules/.bin/tsx scripts/gen-third-party-notices.ts && git add THIRD_PARTY_NOTICES.md
  27. - name: whitespace (staged)
  28. run: git diff --cached --check
  29. - name: vendor manifest guard
  30. run: scripts/check-vendor-manifest.sh
  31. pre-push:
  32. jobs:
  33. - name: typecheck
  34. run: node_modules/.bin/tsc -b --pretty false