limit-typecheck-hook-by-glob: Skip typecheck hook unless relevant files changed #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/limit-typecheck-hook-by-glob"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Assigned idea
The Lefthook config runs
bun run typecheckin both pre-commit and pre-push. Addglobfilters so typechecking only runs when TypeScript/JavaScript or TS config files change, avoiding unnecessary hook time on docs-only or non-code commits.Approach: 1) Edit
lefthook.ymland add aglobpattern to thepre-commitjob namedtypecheckso it only triggers when relevant files are staged (e.g.,**/*.{ts,tsx,js,jsx,mjs},tsconfig*.json, and other typecheck-affecting config files as appropriate for the repo).2) Optionally apply the same
globgating to thepre-pushjobs namedtypecheckandtypecheck-testif you want pushes that only change docs/config unrelated to typing to skip these checks.3) Keep existing formatting/lint/package-lock hooks unchanged.
Verification: 1) Confirm
lefthook.ymlincludes aglob:entry under thepre-commitjob withname: typecheck.2) Stage a non-matching change (e.g., edit a
.mdfile only) and runlefthook run pre-commit; verify thetypecheckjob is not executed.3) Stage a matching change (e.g., edit a
.tsfile) and runlefthook run pre-commit; verifybun run typecheckexecutes.Risk: If the
globpatterns are too narrow, typechecking may be skipped when it should run (e.g., changes to config files that impact typechecking but aren’t included). Mitigate by including tsconfig and other typecheck-relevant config files in the patterns.Agent context
Task slug: limit-typecheck-hook-by-glob
Branch: task/limit-typecheck-hook-by-glob
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.