diff --git a/apps/oxlint/src/lint.rs b/apps/oxlint/src/lint.rs index 04b22b7d0d6a8..f277ad9771949 100644 --- a/apps/oxlint/src/lint.rs +++ b/apps/oxlint/src/lint.rs @@ -1215,9 +1215,8 @@ mod test { } // ToDo: `tsgolint` does not support `big-endian`? - // ToDo: windows: my guess is the missing `.exe` suffix when searching #[test] - #[cfg(not(any(target_os = "windows", target_endian = "big")))] + #[cfg(not(target_endian = "big"))] fn test_tsgolint() { let args = &["--type-aware"]; Tester::new().with_cwd("fixtures/tsgolint".into()).test_and_snapshot(args); diff --git a/apps/oxlint/src/tsgolint.rs b/apps/oxlint/src/tsgolint.rs index 0d0d404233c09..e6ea050d79fa9 100644 --- a/apps/oxlint/src/tsgolint.rs +++ b/apps/oxlint/src/tsgolint.rs @@ -369,10 +369,14 @@ pub fn try_find_tsgolint_executable(cwd: &Path) -> Option { } } + // executing a sub command in windows, needs a `cmd` or `ps1` extension. + // `cmd` is the most compatible one with older systems + let file = if cfg!(windows) { "tsgolint.CMD" } else { "tsgolint" }; + // Move upwards until we find a `package.json`, then look at `node_modules/.bin/tsgolint` let mut current_dir = cwd.to_path_buf(); loop { - let node_modules_bin = current_dir.join("node_modules").join(".bin").join("tsgolint"); + let node_modules_bin = current_dir.join("node_modules").join(".bin").join(file); if node_modules_bin.exists() { return Some(node_modules_bin); }