Skip to content

biome <sub> runs a tool named after the subcommand and still prints a lint summary; eslint --fix gets a . appended, turning it into a whole-tree autofix #3409

Open

Description

@HetCreep

Two defects in the shared rtk lint path. The first makes rtk report lint results for a command that failed to execute; the second adds a path argument the user did not type to a command that writes files.

Provenance: AI-assisted source audit, human-directed, at v0.44.2 (700bdde). Both behaviours were reproduced by running the shipped rtk 0.44.2 binary; argv was captured with a stand-in on PATH. Outputs are verbatim.

1. biome <subcommand> runs a tool named after the subcommand — and rtk reports lint results anyway

src/discover/rules.rs:171-172 rewrites biome/eslint/lint to rtk lint. src/cmds/js/lint_cmd.rs:77-88 (detect_linter) then treats the first non-flag argument as the linter's name. For biome, that argument is the subcommand.

$ rtk rewrite biome check --write
rtk lint check --write

$ rtk -v lint check --write
Running: check with structured output
Lint: 2 errors, 0 warnings
npm error could not determine executable to run

rtk tried to run a tool literally named check (via npx --no-install), npm could not find it — and rtk still printed Lint: 2 errors, 0 warnings, synthesised from npm's own error output. biome never ran. An agent reading that summary is told there are two lint errors in the project.

Same shape for biome format ., biome ci, biome lint, and for the npx biome … forms.

2. eslint --fix gains a .

src/cmds/js/lint_cmd.rs:152-160 appends . when it decides no path was supplied, and an argument that starts with - or contains = never counts as a path. Captured argv:

user typed argv rtk built
eslint --fix eslint -f json --fix .
eslint src/ eslint -f json src/ ✓
eslint --stdin --fix --stdin-filename=x.js eslint -f json --stdin --fix "--stdin-filename=x.js" .

Row 1 is the problem: --fix writes to disk, and rtk widened its scope from "whatever eslint's config resolves by default" to an explicit whole-tree .. Row 3 is broken differently — ESLint rejects file arguments together with --stdin, so that invocation now fails outright.

Adding a default path is reasonable for a read-only lint; doing it for a write command changes what the command modifies.

Suggested directions (untested — no programmer has reviewed these)

  • For biome: recognise its subcommand grammar (check/format/lint/ci are subcommands, not linter names) rather than taking the first non-flag argument as the tool. At minimum, if the resolved tool cannot be executed, do not print a lint summary — the fabricated Lint: N errors line is worse than no output, because it is indistinguishable from a real result.
  • For the . injection: skip it when a write flag is present (--fix, --write), and when --stdin is present. src/cmds/python/ruff_cmd.rs:46-50 and src/cmds/php/pint_cmd.rs:41 already handle both the --flag=value and --flag value forms correctly and are the pattern to copy.

Related

src/cmds/js/vitest_cmd.rs:232 (the jest arm) and src/cmds/js/playwright_cmd.rs:269 have the same space-separated-value blind spot: playwright test --reporter line tests/ drops the flag but keeps line, which Playwright then treats as a test-path filter — likely selecting zero tests, which the filter reports as a clean run. Not verified against real Playwright (not installed here); noted because the root cause is identical.

Activity

  1. pszymkowiak commented on Aug 4, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 92%

    Summary

    Shared rtk lint path misdetects biome subcommands as tool names (still printing a fabricated lint summary) and appends '.' to eslint --fix, silently widening a write command to the whole tree — fix detect_linter in src/cmds/js/lint_cmd.rs and the biome rewrite in src/discover/rules.rs.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/cmds/js/lint_cmd.rs
    • src/discover/rules.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  2. HetCreep commented on Oct 23, 2026

    @HetCreep
    Author

    Linking related work so this can close together with the rest of the group.

    Part 1 here (the biome subcommand taken as the linter name) overlaps #3117, which was filed earlier, and the closed #2540 and #2906. Three open PRs address that part, each filed against one of those issues rather than this one:

    I have read their descriptions, not run them, so I am not claiming any of them covers the exact repro above (including the npx biome forms). On develop 32b2ec43 the behaviour is unchanged: src/discover/rules.rs:209 still rewrites biome to rtk lint, and detect_linter still takes the first non-flag argument as the tool name.

    Part 2 (eslint --fix getting a . appended) is separate; none of the three PR descriptions mention it.

    Produced with AI assistance (Claude Code) operated by me (HetCreep); the line cites were read at 32b2ec43.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibugpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions