Skip to content

Commit ad5d57b

Browse files
committed
fix(oxlint): run tsgolint.CMD under windows
1 parent df68910 commit ad5d57b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

apps/oxlint/src/lint.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,9 +1215,8 @@ mod test {
12151215
}
12161216

12171217
// ToDo: `tsgolint` does not support `big-endian`?
1218-
// ToDo: windows: my guess is the missing `.exe` suffix when searching
12191218
#[test]
1220-
#[cfg(not(any(target_os = "windows", target_endian = "big")))]
1219+
#[cfg(not(target_endian = "big"))]
12211220
fn test_tsgolint() {
12221221
let args = &["--type-aware"];
12231222
Tester::new().with_cwd("fixtures/tsgolint".into()).test_and_snapshot(args);

apps/oxlint/src/tsgolint.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,14 @@ pub fn try_find_tsgolint_executable(cwd: &Path) -> Option<PathBuf> {
369369
}
370370
}
371371

372+
// executing a sub command in windows, needs a `cmd` or `ps1` extension.
373+
// `cmd` is the most compatible one with older systems
374+
let file = if cfg!(windows) { "tsgolint.CMD" } else { "tsgolint" };
375+
372376
// Move upwards until we find a `package.json`, then look at `node_modules/.bin/tsgolint`
373377
let mut current_dir = cwd.to_path_buf();
374378
loop {
375-
let node_modules_bin = current_dir.join("node_modules").join(".bin").join("tsgolint");
379+
let node_modules_bin = current_dir.join("node_modules").join(".bin").join(file);
376380
if node_modules_bin.exists() {
377381
return Some(node_modules_bin);
378382
}

0 commit comments

Comments
 (0)