Skip to content

Commit 1b17d79

Browse files
fix(rewrite): route pnpm lint through rtk pnpm
Signed-off-by: Roopesh <roopesh1724989@gmail.com>
1 parent 4020aa0 commit 1b17d79

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
141141

142142
### Bug Fixes
143143

144+
* **rewrite:** route `pnpm lint` to `rtk pnpm lint` (passthrough-safe) instead of forcing `rtk lint` ([#665](https://github.com/rtk-ai/rtk/issues/665))
144145
* **curl:** skip JSON schema replacement when schema is larger than original payload ([#297](https://github.com/rtk-ai/rtk/issues/297))
145146
* **toml-dsl:** fix regex overmatch on `tofu-plan/init/validate/fmt` and `mix-format/compile` — add `(\s|$)` word boundary to prevent matching subcommands (e.g. `tofu planet`, `mix formats`) ([#349](https://github.com/rtk-ai/rtk/issues/349))
146147
* **toml-dsl:** remove 3 dead built-in filters (`docker-inspect`, `docker-compose-ps`, `pnpm-build`) — Clap routes these commands before `run_fallback`, so the TOML filters never fire ([#351](https://github.com/rtk-ai/rtk/issues/351))

src/discover/registry.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,6 +1899,22 @@ mod tests {
18991899
);
19001900
}
19011901

1902+
#[test]
1903+
fn test_rewrite_pnpm_lint_routes_to_pnpm() {
1904+
assert_eq!(
1905+
rewrite_command("pnpm lint", &[]),
1906+
Some("rtk pnpm lint".into())
1907+
);
1908+
}
1909+
1910+
#[test]
1911+
fn test_rewrite_pnpm_lint_with_args_routes_to_pnpm() {
1912+
assert_eq!(
1913+
rewrite_command("pnpm lint --fix", &[]),
1914+
Some("rtk pnpm lint --fix".into())
1915+
);
1916+
}
1917+
19021918
// --- Compound operator edge cases ---
19031919

19041920
#[test]

src/discover/rules.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ pub const PATTERNS: &[&str] = &[
1616
r"^git\s+(?:-[Cc]\s+\S+\s+)*(status|log|diff|show|add|commit|push|pull|branch|fetch|stash|worktree)",
1717
r"^gh\s+(pr|issue|run|repo|api|release)",
1818
r"^cargo\s+(build|test|clippy|check|fmt|install)",
19-
r"^pnpm\s+(list|ls|outdated|install)",
19+
r"^pnpm\s+(list|ls|outdated|install|lint)",
2020
r"^npm\s+(run|exec)",
2121
r"^npx\s+",
2222
r"^(cat|head|tail)\s+",
2323
r"^(rg|grep)\s+",
2424
r"^ls(\s|$)",
2525
r"^find\s+",
2626
r"^(npx\s+|pnpm\s+)?tsc(\s|$)",
27-
r"^(npx\s+|pnpm\s+)?(eslint|biome|lint)(\s|$)",
27+
r"^((npx\s+|pnpm\s+)?(eslint|biome)|lint)(\s|$)",
2828
r"^(npx\s+|pnpm\s+)?prettier",
2929
r"^(npx\s+|pnpm\s+)?next\s+build",
3030
r"^(pnpm\s+|npx\s+)?(vitest|jest|test)(\s|$)",
@@ -180,14 +180,7 @@ pub const RULES: &[RtkRule] = &[
180180
},
181181
RtkRule {
182182
rtk_cmd: "rtk lint",
183-
rewrite_prefixes: &[
184-
"npx eslint",
185-
"pnpm lint",
186-
"npx biome",
187-
"eslint",
188-
"biome",
189-
"lint",
190-
],
183+
rewrite_prefixes: &["npx eslint", "npx biome", "eslint", "biome", "lint"],
191184
category: "Build",
192185
savings_pct: 84.0,
193186
subcmd_savings: &[],

0 commit comments

Comments
 (0)