Commit dad6bb4
fix(lint): correctly resolve tsgolint in yarn monorepo packages (#1310)
Closes #1296
The `oxlint-tsgolint` executable resolution algorithm assumes that there
is a `node_modules` directory in the current working directory (current
package directory). However, this is only true for `pnpm`, `yarn` only
creates a single `node_modules` in the workspace root, unlike `pnpm`
which creates one under every package.
Because of this, `vp lint`/`vp check` fail to find the `tsgolint`
executable. Updates the algorithm to extract the `node_modules`
directory location based on `resolve()`, rather than `process.cwd()`.
Additionally improves the error message to list all tried paths, rather
than just one:
**Before**
```
VITE+ - The Unified Toolchain for the Web
Failed to find tsgolint executable: OXLINT_TSGOLINT_PATH points to '.\node_modules\.bin\tsgolint.cmd' which does not exist
```
**Now**
```
VITE+ - The Unified Toolchain for the Web
error: Failed to resolve lint command: GenericFailure, Error: Unable to resolve oxlint-tsgolint executable, tried:
- C:\Users\Matei\projects\agent-lab\node_modules\vite-plus\node_modules\.bin\tsgolint.exe
- C:\Users\Matei\projects\agent-lab\node_modules\vite-plus\node_modules\.bin\tsgolint.cmd
- C:\Users\Matei\projects\agent-lab\node_modules\.bin\tsgolint.exe
- C:\Users\Matei\projects\agent-lab\node_modules\.bin\tsgolint.cmd
```
---------
Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>1 parent d7b9b6a commit dad6bb4
1 file changed
+13
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
0 commit comments