Skip to content

Fix npm script argument passing with double dash separator#87

Merged
hyldmo merged 2 commits intofix/npm-command-shorthandfrom
claude/fix-tests-S0TDc
Mar 16, 2026
Merged

Fix npm script argument passing with double dash separator#87
hyldmo merged 2 commits intofix/npm-command-shorthandfrom
claude/fix-tests-S0TDc

Conversation

@hyldmo
Copy link
Copy Markdown
Owner

@hyldmo hyldmo commented Mar 16, 2026

Summary

Fixed npm script argument passing to properly use the -- separator between the script name and forwarded arguments. This ensures that extra arguments are correctly passed to the npm script rather than being interpreted as npm options.

Changes

  • Modified expandScriptCommand() in src/config/expand-scripts.ts to insert -- between the script name and extra arguments when arguments are present
  • Updated all corresponding test expectations in src/config/expand-scripts.test.ts to reflect the corrected command format

Implementation Details

The fix changes the command generation from:

  • npm run lint:js --fix (incorrect - npm interprets --fix as an npm option)

To:

  • npm run lint:js -- --fix (correct - -- tells npm to pass remaining args to the script)

This applies to all script expansion patterns including:

  • Glob patterns with extra args (e.g., lint:* --fix)
  • npm-prefixed patterns (e.g., npm:lint:* --fix)
  • Exact script names with extra args (e.g., npm:lint --fix)
  • Multiple extra arguments (e.g., --fix --quiet)

https://claude.ai/code/session_01DCLpbD8YCmBL8fYjVfK1aZ

claude added 2 commits March 16, 2026 12:49
npm:lint --fix now correctly expands to `npm run lint -- --fix` so
that extra arguments are forwarded to the underlying script rather
than consumed by the package manager.

https://claude.ai/code/session_01DCLpbD8YCmBL8fYjVfK1aZ
Widen env type to Record<string, string | undefined> so the
delete on NO_COLOR doesn't trigger TS2339.

https://claude.ai/code/session_01DCLpbD8YCmBL8fYjVfK1aZ
@hyldmo hyldmo merged commit d873967 into fix/npm-command-shorthand Mar 16, 2026
@hyldmo hyldmo deleted the claude/fix-tests-S0TDc branch March 16, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants