Skip to content

fix(npm,lint): remove hardcoded allowlists, forward args untouched#2860

Open
guyoron1 wants to merge 1 commit into
rtk-ai:developfrom
guyoron1:fix/npm-lint-root-fix
Open

fix(npm,lint): remove hardcoded allowlists, forward args untouched#2860
guyoron1 wants to merge 1 commit into
rtk-ai:developfrom
guyoron1:fix/npm-lint-root-fix

Conversation

@guyoron1

@guyoron1 guyoron1 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Heyaaaa all :)

Fixes #2663, fixes #2094

Following @aeppling's feedback on #2664 — instead of patching the allowlists, this removes them entirely.

npm

Deletes NPM_SUBCOMMANDS (the 70-entry list). rtk npm now forwards args untouched to npm — no more run injection. If npm build isn't a real subcommand, npm errors and the agent self-corrects to npm run build. Future npm commands (query, sbom, whatever they add next) just work without RTK updates.

lint

Removes lint (the script name) from the lint rewrite rule. pnpm lint / npm run lint are no longer rewritten to rtk lint, so the package.json script's flags, chains, and exit code are preserved. Direct linter calls (eslint, biome, npx eslint, etc.) still route through rtk lint as before.

Command Before After
rtk npm query npm run query (broken) npm query (works)
pnpm lint rtk lint (flags lost) runs natively (correct)
eslint src/ rtk lint rtk lint (unchanged)

Net -104 lines — more deleted than added.

Test plan

  • cargo fmt && cargo clippy --all-targets && cargo test --all — 2361 passed
  • Added test_classify_lint_scripts_not_rewritten + test_rewrite_lint_scripts_not_rewritten_to_rtk_lint

Delete NPM_SUBCOMMANDS and stop injecting `run` — npm commands now
pass through unchanged so future npm subcommands work automatically.

Remove `lint` (script name) from lint rewrite rule so `pnpm lint` and
`npm run lint` are no longer rewritten to `rtk lint`, preserving the
package.json script's flags, chains, and exit codes.  Direct linter
invocations (`eslint`, `biome`) continue to route through rtk lint.

Fixes rtk-ai#2663, fixes rtk-ai#2094
@aeppling aeppling self-assigned this Jul 7, 2026
@aeppling

aeppling commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Hey @guyoron1 thanks for addressing this more durable fix, will avoid further maintenance.

npm run inject part -> valid

lint part -> lost rewrite

Removing lint from the rule fixes the substitution, but it deletes the rewrite entirely, not just the substitution. pnpm lint, npm lint, bare lint -> match no rule -> run raw

The npm part shows the pattern to follow: there the rewrite and the substitution are separate, so dropping the injection kept the rewrite + filter. On lint they're fused, the rewrite target rtk lint is the substitution.

proposed fix

Mirror your npm half: keep the rewrite, drop only the substitution.

1 - npm run lint / pnpm run lint: already fine after this PR,nothing to do.

2 - Bare pnpm lint: the only routing gap. Extend the generic pnpm rule to wrap bare invocations → rtk pnpm lint. Important: wrap any bare pnpm , not just lint, enumerating script names would recreate the exact kind of list this PR removes.

3 - Compression recovery (follow-up) enhance the npm/pnpm output filter to detect lint-style diagnostics (file:line:col + rule id) and compress around them: collapse clean/progress lines, keep diagnostics, tee tail hint the tail.
Pure output-side, no lists, and it degrades safely: worst case is less compression, never a changed command or exit code.

Thanks for your work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants