Skip to content

bug(rewrite): npm run lint forced into rtk lint on Biome projects #1489

Open

Description

@LukaPrebil

Environment

  • rtk 0.37.2 (Homebrew, /opt/homebrew/bin/rtk)
  • macOS darwin 25.4.0 (arm64)
  • Claude Code 2.1.x with the rtk hook claude PreToolUse hook shipped by rtk init

Repro

Project uses Biome, not ESLint. package.json:

{
  "scripts": {
    "lint": "biome check"
  }
}
  1. rtk rewrite "npm run lint" -> rtk lint (exit 0).
  2. Claude Code hook rewrites npm run lint to rtk lint before execution.
  3. rtk lint shells out to biome, biome exits 0 with plain-text output, and the lint adapter attempts to parse biome's output as ESLint JSON.
  4. Observed output: ESLint output (JSON parse failed: EOF while parsing a value at line 1 column 0), process exit 0.

Expected

npm run lint passes through to the project's actual lint script without being forced into the ESLint adapter. Either:

Either way, the adapter's JSON parse should never run on biome output.

Actual

rtk rewrite sends every npm run lint into the ESLint adapter regardless of what the script actually invokes. The adapter fails to parse biome output, prints a JSON-parse-failed warning, and exits 0. Agents see exit 0 and move on; the real lint result is discarded silently.

Reproduced cleanly with an empty-stdout target:

$ rtk lint ./no-op.sh
ESLint output (JSON parse failed: EOF while parsing a value at line 1 column 0)
$ echo $?
0

Also tried

Related

Likely cause

src/discover/rules.rs maps any npm run lint (and pnpm lint, biome check, npm run check) to the rtk lint adapter, which assumes ESLint JSON. PR #678 patches the pnpm lint row; the npm run lint row should follow the same routing change. The natural landing spot is PR #443's NpmCommands::Run { script: "lint", .. } branch: either detect Biome from package.json / biome.json and dispatch to the existing biome filter, or fall through to the generic npm_cmd::run_script boilerplate-stripper when detection is uncertain. Either beats running the ESLint JSON parser on biome output.

Impact

AI coding agents see exit 0 with a suspicious-looking warning and often ignore it. Real lint failures (and anything downstream that gates on lint) can pass silently on Biome projects for multiple commits before the regression is noticed by a human.

Activity

  1. added
    bug
    effort-small
    filter-quality
    on Apr 24, 2026
  2. pszymkowiak commented on Apr 24, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 95%

    Summary

    npm run lint is unconditionally rewritten to the ESLint JSON adapter, silently discarding real lint failures on Biome projects; fix is localized to rules.rs and PR #1491 is already open.

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

    📁 Relevant files
    • src/discover/rules.rs

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

  3. rofreytag commented on May 18, 2026

    @rofreytag

    likely related: when claude tries to run pnpm lint -> it executes rtk lint instead, which in my case errors with

    $ rtk lint
    [warn] Linter process terminated abnormally (possibly out of memory)
    

    instead it should run

    rtk pnpm lint
    
  4. timqi commented on Sep 28, 2026

    @timqi

    Another case of this one, this time with oxlint, on rtk 0.50.0 (the rule is still in src/discover/rules.rs on master @ 7efbaef).

    Repro (a project whose lint script is oxlint, with no ESLint installed):

    // package.json
    "scripts": { "lint": "oxlint src --format=default --deny-warnings" }
    $ rtk rewrite "npm run lint"; echo " [$?]"
    rtk lint [3]
    $ rtk lint; echo "exit=$?"
    ESLint output (JSON parse failed: EOF while parsing a value at line 1 column 0)
    exit=2
    $ rtk run "npm run lint"; echo "exit=$?"
    > oxlint src --format=default --deny-warnings
    Found 0 warnings and 0 errors.
    exit=0

    rtk lint with no linter named falls back to ESLint (npx eslint … --format json). Here npx fails with npm error could not determine executable to run and writes nothing to stdout. The only thing the agent sees is the JSON parse error, and it exits 2 on a tree whose own gate passes. The hook sits in front of every agent npm run lint, so the project looks broken on every branch until someone traces it back to the rewrite.

    Expected: a rewrite of npm run lint / pnpm [run] lint should run the script as written. That means passing it through, or rtk npm run lint (as npm run lint:fix already does). Failing that, rtk lint could read the script body from package.json and only take the ESLint path when the script actually runs ESLint. Separately, when the linter process fails to start or prints nothing, its stderr and exit code should be surfaced, not a JSON parse error.

    Workaround: [hooks] exclude_commands = ["npm run lint", "pnpm run lint", "pnpm lint"] in config.toml. The patterns match as word prefixes, so they also cover npm run lint -- --fix.

  5. jerosa commented on Oct 13, 2026

    @jerosa

    Another variant of the same rewrite, with ESLint itself (not Biome/oxlint): npm workspace flags are passed through to rtk lint, which forwards them to eslint.

    $ rtk rewrite "npm run lint -w back"
    rtk lint -w back
    $ rtk lint -w back
    Invalid option '-w' - perhaps you meant '-c'?   # exit 2
    

    Same for npm run lint -w front -- --no-cache. -w/--workspace (and --workspaces, --if-present) are npm options and should stay with npm, or the command shouldn't be rewritten at all when they're present.

    rtk 0.51.0, macOS, Claude Code hook.

  6. atharvworkshere commented on Nov 7, 2026

    @atharvworkshere

    Another variant, with ESLint itself: the rewrite drops the script's path scope, so npm run lint lints the whole repo.

    rtk 1.1.0 (Homebrew, macOS arm64), rtk hook claude.

    // package.json
    "scripts": { "lint": "eslint src" }
    $ rtk rewrite "npm run lint"; echo " [$?]"
    rtk lint [0]

    rtk lint with no paths then runs eslint -f json . from the repo root, not eslint src. In a large frontend monorepo that run went 17 min at ~100% CPU before we killed it; npm run lint (scoped to src) is far shorter. Nothing errors, so the agent just waits. Running the script as written (rtk npm run lint, as PR #2860 proposes for pnpm) would fix this too.

  7. akumublade commented on Nov 11, 2026

    @akumublade

    Still reproduces on rtk 1.2.0 (Homebrew, macOS 15.7.7 arm64) with pnpm 12.17.0 and oxlint 1.90.0, through rtk hook claude. The rule is unchanged on develop: the rtk lint rule in src/discover/rules.rs still lists pnpm run lint and pnpm lint.

    // package.json
    "scripts": { "lint": "oxlint --deny-warnings --no-error-on-unmatched-pattern" }
    $ rtk rewrite "pnpm run lint"; echo " [$?]"
    rtk lint [3]
    $ rtk lint; echo "exit=$?"
    ESLint output (JSON parse failed: EOF while parsing a value at line 1 column 0)
    exit=1
    $ rtk run pnpm run lint; echo "exit=$?"
    $ oxlint --deny-warnings --no-error-on-unmatched-pattern
    exit=0

    ESLint is not installed, so rtk lint falls back to it, gets no output, and the agent sees a failing lint on a clean tree. Same case as the oxlint report above, now with pnpm on the current release.

  8. charlesroper commented on Nov 13, 2026

    @charlesroper

    Another data point on rtk 1.2.0, Linux arm64, in a project with no ESLint installed at all:

    $ rtk lint
    ESLint output (JSON parse failed: EOF while parsing a value at line 1 column 0)
    $ echo $?
    1

    The real cause is on stderr:

    npm error npx canceled due to missing packages and no YES option: ["[email protected]"]

    So the adapter reports a parse failure on stdout and exits 1, while the actual problem (no ESLint present) is only visible on stderr. Same masking as #3846, but the exit code is 1 here, unlike the exit 0 in the report above.

    Repro project is a package.json with "lint": "biome check ." plus a biome.json, nothing else. rtk lint fails before Biome runs.

    Workaround for Biome projects until this lands: name the script something the rewrite rule does not match, for example:

    "check:lint": "biome check ."

    rtk rewrite "npm run check:lint" leaves it alone, and rtk npm run check:lint preserves the exit code.

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:clibugeffort-smallfilter-qualitygood first issueneeds-triageplatform:macospriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions