Skip to content

fix: strip npx/bunx/pnpm prefixes in lint linter detection#366

Merged
pszymkowiak merged 1 commit intomasterfrom
fix/lint-npx-prefix
Mar 6, 2026
Merged

fix: strip npx/bunx/pnpm prefixes in lint linter detection#366
pszymkowiak merged 1 commit intomasterfrom
fix/lint-npx-prefix

Conversation

@pszymkowiak
Copy link
Collaborator

Summary

  • rtk lint npx eslint ... was detecting npx as the linter name instead of eslint
  • This caused no -f json flag injection, falling back to text parsing with duplicated diagnostics and wrong counts

Fix

  • Extract strip_pm_prefix() to skip npx, bunx, pnpm, pnpm exec, yarn prefixes
  • Extract detect_linter() to identify linter name from effective args
  • All downstream logic uses effective_args (without PM prefix)

Test plan

  • 10 new unit tests for strip_pm_prefix and detect_linter
  • 676 tests pass, 0 failures
  • cargo fmt clean, cargo clippy clean

Fixes #186

When running `rtk lint npx eslint ...`, args[0] was "npx" instead of
"eslint", causing no JSON format flag injection and duplicated output.

Extract strip_pm_prefix() and detect_linter() helpers, skip package
manager prefixes before identifying the actual linter name.
@pszymkowiak pszymkowiak merged commit 27b35d8 into master Mar 6, 2026
2 of 3 checks passed
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.

bug: rtk lint duplicates ESLint diagnostics and misreports summary counts

1 participant