Repository navigation
Conversation
|
The filter itself is genuinely nice — I tested it against real Biome (v2.5.5) output and But there's a gap that stops it from working through the hook, which is the normal path. The rewrite drops the The difference is fatal: eslint is the default, biome isn't. So the command the hook actually produces, So To make this work end-to-end, the routing needs to preserve the linter name for biome (delegate to |
6897ce7 to
e71581e
Compare
e71581e to
6d07d2c
Compare
`rtk lint` treats eslint as its default linter, and the hook rewrite peels the tool name off as a strippable prefix. For eslint that is harmless, for biome it is fatal: `biome check src/` became `rtk lint check src/`, and `detect_linter` then tried to run `check` as the linter. Biome output never reached a Biome-aware filter through the hook — only by typing `rtk lint biome check …` by hand. Routing: keep the linter name when the matched rewrite prefix names a tool that is not `rtk lint`'s default, so every spelling (`biome`, `npx biome`, `pnpm biome`, `pnpm exec biome`, …) lands on `rtk lint biome …`. eslint keeps being stripped exactly as before. Filtering: add a `"biome"` arm to the format-flag match (Biome has its own subcommands and needs no `-f json`) and a `filter_biome_output` that groups diagnostics by rule and file, falling back to the generic lint filter when the output carries no recognizable diagnostics. Tests: a rewrite test per invocation form, four filter tests including a token-savings floor, and an end-to-end test that rewrites `biome check src/` and runs the result against a stubbed biome, asserting the compressed report and the preserved exit code. Fixes rtk-ai#3117
6d07d2c to
433fe9d
Compare
|
@pszymkowiak thanks for catching the routing gap, that was the missing half. It's closed in this push:
One question, since you offered to help wire this up: #2378 routes direct biome invocations to a separate Also, this and #2860 both edit the |
Fixes #3117
rtk lintruns eslint when the args name no linter, and the hook rewrite peels the tool name off as a strippable prefix. For eslint that is harmless. For Biome it is fatal:biome check src/rewrote tortk lint check src/, anddetect_linterthen tried to runcheckas the linter:So Biome output never reached a Biome-aware filter through the hook, only if you typed
rtk lint biome check ...by hand. Thanks pszymkowiak for catching that: the earlier version of this PR only had the filter half.Routing. In
rewrite_segment_inner, when the matchedrtk lintprefix namesbiome, the tool name is kept, sobiome check src/,npx biome check src/,pnpm biome ...,pnpm exec biome ...andnpm run biome ...all land onrtk lint biome .... eslint is still stripped, unchanged, because eslint is the default. It reuses the existingtool_portionhelper (8 added lines).Filtering. A
"biome"arm in the format-flag match (Biome has its own subcommands and needs no-f json) andfilter_biome_output, which groups diagnostics by rule and file and falls back to the generic filter when there is nothing recognizable. The regexes areLazyLockstatics: the previous push usedlazy_static, which isn't a dependency, and that is what turned the clippy job red.End to end, against a stand-in
biomeprinting a real 1110-byte report:1110 bytes -> 251 bytes, exit code preserved. On develop the same rewrite (
rtk lint check src/) ends innpm error could not determine executable to run.tests/biome_hook_roundtrip_test.rspins the whole chain (rewrite, run, filter, exit code) andtest_rewrite_biome_keeps_the_linter_namepins every invocation spelling; both fail on develop's routing.Related open PRs: #2378 routes direct biome invocations to a separate
rtk biomecommand rather thanrtk lint biome, so it is a competing destination. This PR and #2860 both edit thetest_rewrite_lintlist inregistry.rs; the conflict is confined to that one test and resolves to the eslint-only list.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets(0 warnings)cargo test --all(all pass)biome check src/-> rewrite -> biome filter applied, exit code preserved