Repository navigation
Closed as duplicate
Closed as duplicate
Copy link
Labels
Description
Summary
When ~/.claude/settings.json registers rtk hook claude as a Bash PreToolUse hook, the command npm run tsc (where package.json has "tsc": "tsc --noEmit") is rewritten to rtk tsc — silently dropping the --noEmit flag carried by the npm script. TypeScript then emits .js / .jsx / .map files alongside source files, polluting the working tree.
Environment
- RTK version:
rtk 0.37.2 - OS: Windows 10 (Git Bash)
- TypeScript project (Umi/Max),
tsconfig.jsonhas"sourceMap": true, nonoEmitset package.jsonscript:"tsc": "tsc --noEmit"
Reproduction
# In any TS project where tsconfig has no noEmit:true and package.json
# defines "tsc": "tsc --noEmit"
# 1) Direct invocation — correct (no emit)
./node_modules/.bin/tsc --noEmit
ls src/utils/request.js # not found ✓
# 2) Through RTK hook (npm run tsc) — emits files
npm run tsc
ls src/utils/request.js # exists ✗
# Inspect the hook decision:
echo '{"tool_name":"Bash","tool_input":{"command":"npm run tsc"}}' | rtk hook claude
# → {"updatedInput":{"command":"rtk tsc"}} ← original command discardedRoot cause (two interacting issues)
- Hook rewrites
npm run Xblindly. The hook seestscand rewrites the whole invocation tortk tsc, discarding thenpm runcontext that would have resolved totsc --noEmitviapackage.json. rtk tscdoes not pass--noEmitby default. The subcommand's help says "TypeScript compiler with grouped error output", suggesting type-check-only, but the underlyingtscinvocation respects tsconfig defaults — emitting files.
Impact
- 787 stray
.js/.jsx/.mapfiles generated in a real project run git statuspolluted with hundreds of untracked files- Required
.gitignoreworkaround to prevent recurrence - Will affect any user whose npm script relies on
--noEmit
Suggested fix
- Option A (preferred): Don't rewrite
npm run Xat all. The npm script is the source of truth; let it resolve viapackage.json. - Option B: When the matched binary appears inside
npm run …, preserve the fullnpm runinvocation (e.g. rewrite tortk proxy npm run X). - Option C: Have
rtk tscdefault to--noEmit, since the subcommand is documented as for "error output" only.
A combination of A + C would be most robust.
Workaround
src/**/*.js
src/**/*.jsx
src/**/*.js.map
src/**/*.jsx.map
config/**/*.js
config/**/*.js.mapOr use rtk proxy npm run tsc to bypass the rewrite.
Activity
pszymkowiak commentedon May 27, 2026
🔍 Automated Triage
bughighSummary
Hook silently rewrites
npm run tsctortk tsc, dropping--noEmitdefined in package.json script body, causing 787+ unwanted JS/map file emissions — related to #2094 (pnpm) and #2098 (npm workspace flags), same root cause but distinct impact vectorTriaged automatically by wshm · This is an automated analysis, not a human review.
KuSh commentedon Sep 5, 2026
Closing as a duplicate of #2094, which tracks the same problem with the more complete discussion. Please follow up there; if your case differs in a way that issue does not cover, comment here and it can be reopened.