@devries-cameron20 / t3code Mirror · read-only / commits / 894d6d68f5
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 19:00 UTC

fix(oxlint-plugin): Resolve the oxlint bin without assuming a pnpm layout (#5066)

Mike Olson committed Jul 31, 2026 at 05:45 UTC 894d6d68f555b97a070791590ed99695c09e4233
1 file changed +18 -9
oxlint-plugin-t3code/test/utils.ts
+18 -9
@@ -9,6 +9,17 @@ import * as Predicate from "effect/Predicate";
9 import * as Schema from "effect/Schema";
10 import * as Stream from "effect/Stream";
11 import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
12 +import * as NodeModule from "node:module";
13 +
14 +// oxlint is only a transitive dependency (via vite-plus), so its bin placement
15 +// varies by package manager: pnpm hoists it into the virtual store, while
16 +// other layouts expose vite-plus's LSP-only wrapper instead. Resolve the real
17 +// package through vite-plus rather than hardcoding either layout, and do it at
18 +// module scope so a broken install fails once with a resolution error instead
19 +// of as an opaque defect in every test.
20 +const oxlintPackageJsonPath = NodeModule.createRequire(
21 + NodeModule.createRequire(import.meta.url).resolve("vite-plus/package.json"),
22 +).resolve("oxlint/package.json");
23
24 class OxlintFixtureFailure extends Data.TaggedError("OxlintFixtureFailure")<{
25 readonly exitCode: number;
@@ -93,14 +104,7 @@ export const createOxlintRuleHarness = (
104 const configPath = path.join(fixtureDir, ".oxlintrc.json");
105 const sourcePath = path.join(fixtureDir, options.filename ?? "fixture.ts");
106 const repoRoot = path.join(import.meta.dirname, "..", "..");
96 - const oxlintBin = path.join(
97 - repoRoot,
98 - "node_modules",
99 - ".pnpm",
100 - "node_modules",
101 - ".bin",
102 - "oxlint",
103 - );
107 + const oxlintBin = path.join(path.dirname(oxlintPackageJsonPath), "bin", "oxlint");
108 const pluginPath = path.join(repoRoot, "oxlint-plugin-t3code", "index.ts");
109
110 yield* fs.writeFileString(
@@ -112,8 +116,13 @@ export const createOxlintRuleHarness = (
116 );
117 yield* fs.writeFileString(sourcePath, source);
118
119 + // Run through the current Node binary: oxlint's bin is an extensionless
120 + // shebang script, which Windows cannot spawn directly and which would
121 + // otherwise pick up whatever node is first on PATH.
122 const output = yield* spawnAndCollectOutput(
116 - ChildProcess.make(oxlintBin, ["--config", configPath, sourcePath], { cwd: repoRoot }),
123 + ChildProcess.make(process.execPath, [oxlintBin, "--config", configPath, sourcePath], {
124 + cwd: repoRoot,
125 + }),
126 );
127
128 if (output.exitCode !== 0) {