Skip to content

Hook rewrite: 'pnpm/npm run lint' incorrectly rewritten to 'rtk lint' (assumes ESLint, breaks non-ESLint lint scripts) #3286

Closed as duplicate

Description

@MeiringD

Bug

The command-rewrite hook (rtk rewrite) hardcodes any <pm> run lint / <pm> lint invocation to the top-level rtk lint subcommand ("ESLint with grouped rule violations"), regardless of what the project's lint script actually does. This breaks any project where lint doesn't invoke ESLint directly — e.g. a Turborepo monorepo where lint is turbo run lint, which in turn runs a completely different command per workspace.

Compare with build/test, which are (correctly) rewritten to rtk pnpm run <script> — preserving whatever the real script is:

$ rtk rewrite "pnpm run lint"
rtk lint                    # <- wrong: assumes ESLint directly

$ rtk rewrite "pnpm run build"
rtk pnpm run build          # <- correct: delegates to the real script

$ rtk rewrite "pnpm run test"
rtk pnpm run test           # <- correct: delegates to the real script

$ rtk rewrite "npm run lint"
rtk lint                    # <- same bug, npm

$ rtk rewrite "pnpm lint"
rtk lint                    # <- same bug, pnpm shorthand

Reproduction

Minimal repro: any pnpm/Turborepo workspace where the root lint script is turbo run lint, and turbo.json has a lint task, but no eslint binary is installed as a direct dependency (workspaces run their own lint tooling or placeholders).

$ cat package.json
{
  "scripts": { "lint": "turbo run lint", ... }
}

$ pnpm run lint
# Claude Code / shell hook rewrites this to `rtk lint`
undefined
[ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL] Command "eslint" not found

$ rtk pnpm run lint
# Correct: delegates to the actual script, works fine
$ turbo run lint
...
 Tasks:    15 successful, 15 total

rtk lint tries to invoke eslint directly (likely via pnpm exec eslint or similar) instead of first checking what the project's lint script is configured to do. Since this repo doesn't have eslint installed as a direct dependency (lint delegates to Turborepo, which runs per-workspace placeholder scripts), it fails with a confusing, unrelated error — even though the actual lint command works perfectly when invoked without the rewrite.

Impact

Any agent/hook relying on rtk rewrite to transparently proxy pnpm run lint (or npm run lint) gets a false failure in monorepos / non-ESLint-direct setups, blocking automated workflows that gate on lint success (e.g. CI-like quality gates run by an AI agent before commit).

Suggested fix

Don't hardcode run lint → rtk lint. Instead, treat lint the same way build/test are already handled: rewrite to rtk pnpm run lint (delegate to the real script), and only route through the dedicated ESLint filter (rtk lint) when the resolved script is actually invoking eslint (e.g. by inspecting package.json#scripts.lint before deciding the rewrite target).

Environment

  • rtk --version: 0.43.0
  • Reproduced via Claude Code's rtk hook (RTK.md instructs git status → rtk git status etc., transparently rewritten) in a pnpm + Turborepo monorepo.

Activity

  1. pszymkowiak commented on Jul 28, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 90%

    Summary

    Command-rewrite hook hardcodes 'pnpm/npm run lint' to 'rtk lint' (assumes ESLint) instead of delegating like build/test do, breaking non-ESLint lint scripts (e.g. Turborepo); should inspect package.json's lint script before choosing the rewrite target.

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

    📁 Relevant files
    • src/rewrite.rs
    • src/hook/rewrite.rs
    • src/lint.rs

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

  2. danilofuchs commented on Aug 10, 2026

    @danilofuchs

    This breaks in our oxlint setup

    Agents end up using 'rtk proxy pnpm lint'

  3. KuSh commented on Sep 5, 2026

    @KuSh
    Collaborator

    Closing as a duplicate of #1489, which tracks the same problem with the more complete discussion. Please follow up there; if your case differs in a way that issue does not cover, comment here and it can be reopened.

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