fix(hooks): ship run.js so the PostToolUse hook runs on Deno >= 2.9 - #71
Merged
Conversation
run.ts lives under node_modules once installed, and Deno (like Node) refuses to type-strip TypeScript under node_modules (ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING), so the hook aborted before reading the payload and never flagged comments. Ship the hook as compiled run.js; keep the typecheck it replaces via JSDoc annotations + checkJs so deno check still fails on type errors. Point hooks.json at run.js.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
PostToolUsehook ships as TypeScripthooks/run.ts. Once installed through a package manager, the whole plugin lands undernode_modules, and Deno >= 2.9 refuses to type-strip.tsundernode_modules(ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING). The hook aborts before reading the payload, soWrite/Editnever flag a comment.Change
hooks/run.ts->hooks/run.js(compiled; drop the type annotations).hooks/hooks.json: point the hook command athooks/run.js.hooks/deno.jsonc: addcompilerOptions.checkJs; therunfn carries a JSDoc@paramblock sodeno checkstill fails on a real type error.Verification
deno check --config hooks/deno.jsonc hooks/run.jsexits 0 clean, 1 on a plantedType 'string' is not assignable to type 'number'— the check is live on the.js. End-to-end: with the checker on PATH and the hook copied out ofnode_modules, aWritepayload carrying a flagged comment exits 2 and strips it (Deleted 1 comment(s)... restates what the code already says).