Repository navigation
Conversation
`npx eslint src` is rewritten to `rtk lint src`, which drops the linter name. detect_linter then treated `src` as the linter, because a bare directory name carries no `.`, `/` or leading `-`. rtk ran `npx -- src`, the package manager failed, and filter_generic_lint turned that failure into a lint verdict: - npm prints two `npm error` lines, so a clean project was reported as "Lint: 2 errors, 0 warnings" while `npx eslint src` exits 0. - pnpm prints `ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL Command "src" not found`, which contains neither "error" nor "warning", so both counters stayed at zero and the run was summarized as "Lint: No issues found" — a clean bill of health for a linter that never started. On a non-English system the first line is localized too, so the wording a reader would recognize is not there either. Only the exit code carried the truth, and it is invisible to whoever reads the summary. Two changes: - detect_linter treats an argument that exists on disk as a path, so `rtk lint src` lints `src` with ESLint instead of inventing a linter named after the directory. A name that is not a path keeps its linter meaning, so `rtk lint biome check` is unaffected. - filter_generic_lint takes the exit status and refuses to emit "No issues found" for a command that failed, returning the raw output instead. It recognizes issues by the words "error" and "warning", so it cannot tell a clean run from one that never happened — the exit status can. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
5 tasks done
WoldenMn
force-pushed
the
fix/lint-bare-path-treated-as-linter
branch
from
October 10, 2026 21:26
49dfd9b to
2d0477a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rtk lint srcreports lint results for a run that never happened. Two shapes, depending on the package manager:That second one is the dangerous one: the only line printed says the project is clean, while ESLint never started.
Cause
Three steps line up:
npx eslint srctortk lint src, dropping the linter name.detect_lintertreats the first argument as a linter name unless it starts with-or contains.or/. A bare directory —src,app,lib,tests— matches none of those, sosrcbecomes the linter and rtk runsnpx -- src.filter_generic_lintscores the failure as lint output. It counts lines containingerrororwarning:npm error …lines →Lint: 2 errors.ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL Command "src" not found, which contains neither word → both counters stay at 0 →Lint: No issues found.On a non-English system the shell's own message is localized as well (
'src' n'est pas reconnu en tant que commande interne), so a wording-based heuristic has nothing to latch onto there either.The exit code is propagated correctly in both cases — but it is invisible to whoever reads the summary, and the summary is what an agent quotes.
Fix
detect_linter: an argument that exists on disk is a path.rtk lint srcthen lintssrcwith ESLint rather than inventing a linter named after the directory. A name that is not a path keeps its linter meaning, sortk lint biome checkandrtk lint ruffare unaffected. The ambiguity is real — the rewrite discards the information — so it is resolved in the only direction that cannot fabricate a linter run.filter_generic_lint: never certify a failed run as clean. It now takes the exit status and returns the raw output instead ofLint: No issues foundwhen the command failed. The filter recognizes issues by the wordserrorandwarning, which means it cannot distinguish a clean run from one that never started; the exit status can. Real findings are still summarized as before.Verified with a build of this branch:
rtk lint src, clean project, npmLint: 2 errors, 0 warningsESLint: No issues foundrtk lint src, ESLint absent, pnpmLint: No issues foundESLint output (JSON parse failed…)+ the pnpm errorrtk lint <unknown-linter>Lint: No issues foundTests
5 new tests, 20 passing in the module. Three are regression guards, all confirmed non-vacuous by mutation (inverting each guard makes them fail, restoring makes them pass):
detect_linter_treats_an_existing_directory_as_a_pathgeneric_lint_never_reports_clean_on_a_failed_run— fixture is the verbatim pnpm failure, localized line includedgeneric_lint_reports_clean_on_a_successful_runcargo fmt -- --checkclean,cargo clippy --all-targetsno warnings.cargo teston the full crate:2577 passed; 3 failed. The three failures are inhooks::rewrite_cmd::tests::unattestable_passthroughand are pre-existing ondevelop(6f0b0ca), unrelated to this change — same ones noted in #3566.Environment: Windows 11,
stable-x86_64-pc-windows-msvc, npm and pnpm 10.34.4.