@effect/tsgo 0.64.1 → 0.67.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,13 +5,13 @@ A wrapper for both [TSRS](https://github.com/oxc-project/tsrs) and [TypeScript-G
5
5
  <!-- supported-components:start -->
6
6
  ## Supported Package Versions
7
7
 
8
- The following target package versions are supported by `@effect/tsgo@0.64.1`:
8
+ The following target package versions are supported by `@effect/tsgo@0.67.1`:
9
9
 
10
10
  | Component | Supported versions |
11
11
  |---|---|
12
- | TypeScript | `7.0.2`, `7.1.0-beta`, `7.1.0-dev.20261101.1` |
13
- | tsrs | `0.20.1-ts7.1.0-beta` |
14
- | Oxlint | `1.88.0`, `1.89.0`, `1.90.0` |
12
+ | TypeScript | `7.0.2`, `7.1.0-beta`, `7.1.0-dev.20261103.1` |
13
+ | tsrs | `0.21.0-ts7.1.0-beta` |
14
+ | Oxlint | `1.88.0`, `1.89.0`, `1.90.0`, `1.91.0` |
15
15
  | oxlint-tsgolint | `7.0.2004`, `7.0.2005` |
16
16
  <!-- supported-components:end -->
17
17
 
@@ -45,12 +45,18 @@ effect-tsgo tsc@7.0.2 --lsp --stdio # a specific TypeScript version
45
45
  effect-tsgo tsc@next --build # or an upstream tag: latest, beta, next
46
46
  effect-tsgo tsrs --noEmit # the Effect-patched tsrs (tsrs@<version> and tsrs@latest work too)
47
47
  effect-tsgo oxlint --type-aware # Oxlint with the Effect rules
48
+ effect-tsgo vp check # vite-plus (vp check, vp lint, vp run ...) with the Effect rules
49
+ effect-tsgo --tsrs-lint oxlint --type-aware # the type-aware rules on tsrs instead of tsgolint (experimental)
50
+ effect-tsgo --tsrs-lint=latest vp lint # with a tsrs version or tag
48
51
  ```
49
52
 
50
53
  Every argument after the tool is passed through unchanged, so the commands work as drop-in replacements in `package.json` scripts and editor settings that launch `tsc`.
51
54
 
52
55
  - `tsc` and `tsrs` run the requested version or tag; without one they run the build of the installed `typescript`/`@typescript/native` (>= 7) or `tsrs` version when this release ships it, and otherwise the latest supported version. They do not require TypeScript or tsrs to be installed.
53
56
  - `oxlint` runs the CLI of the installed `oxlint` package (installed directly or through `vite-plus`) with the Effect-patched native binding and, when `oxlint-tsgolint` is installed, the Effect-patched `tsgolint` of the installed versions. It does not accept a version.
57
+ - `vp` runs the CLI of the installed `vite-plus` package, so that the Oxlint it starts (for `vp check`, `vp lint`, and scripts run through `vp run`) uses the Effect-patched binding and `tsgolint` of the oxlint version vite-plus resolves. It does not accept a version.
58
+ - `--tsrs-lint[=<version|tag>]`, in front of `oxlint` or `vp`, runs Oxlint's type-aware rules, including the Effect ones, on the Effect-patched `tsrs` (`tsrs --lint`, tsrs's port of tsgolint) instead of the patched `tsgolint`; `oxlint-tsgolint` does not need to be installed. The tsrs version is picked as for `effect-tsgo tsrs`: the requested version or tag, else the installed `tsrs` version when this release ships it, else the latest supported one. tsrs does not support tsgolint's Go profiling variables (`OXLINT_TSGOLINT_TRACE`, `OXLINT_TSGOLINT_CPU`, `OXLINT_TSGOLINT_HEAP`, `OXLINT_TSGOLINT_ALLOCS`).
59
+ - `oxlint` and `vp` work under Node.js and Bun: they preload `@effect/tsgo/oxlint-bridge` through `NODE_OPTIONS` and `BUN_OPTIONS`, in front of any options already set there, so every process they start loads the patched Oxlint binding in place of the stock one and every other native addon unchanged.
54
60
  - As with `patch`, the packaged `tsrs` and `oxlint` builds do not support Linux musl.
55
61
 
56
62
  Prefer these commands whenever you cannot or do not want to modify `node_modules`; prefer `patch` when other tools must keep launching the stock binaries (for example `npx tsc`, or editor extensions that resolve the TypeScript package). Note that the type augmentation that adds the `effecttsgo` plugin and rules to Oxlint's config types (for `oxlint.config.ts`) is applied only by `patch`.
@@ -189,6 +195,7 @@ Some diagnostics are off by default or have a default severity of suggestion, bu
189
195
  <tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/match-boolean-to-is-success.md"><code>matchBooleanToIsSuccess</code></a></td><td>Suggests Effect.isSuccess or Effect.isFailure when Effect.match or Effect.matchEager folds to complementary boolean literals</td></tr>
190
196
  <tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/match-effect-to-map-both.md"><code>matchEffectToMapBoth</code></a></td><td>Suggests Effect.mapBoth when Effect.matchEffect only transforms the failure and success channels</td></tr>
191
197
  <tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/match-effect-to-match.md"><code>matchEffectToMatch</code></a></td><td>Suggests Effect.match or Effect.matchCause when both Effect.matchEffect handlers only return Effect.succeed</td></tr>
198
+ <tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/match-to-result-or-option.md"><code>matchToResultOrOption</code></a></td><td>Suggests Effect.result, Effect.option or Effect.either when match handlers, or a map step followed by a catch step, only reify the outcome</td></tr>
192
199
  <tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/missed-pipeable-opportunity.md"><code>missedPipeableOpportunity</code></a></td><td>Suggests using .pipe() for nested function calls</td></tr>
193
200
  <tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/missing-effect-service-dependency.md"><code>missingEffectServiceDependency</code></a></td><td>Checks that Effect.Service dependencies satisfy all required layer inputs</td></tr>
194
201
  <tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/missing-pipeable-signature.md"><code>missingPipeableSignature</code></a></td><td>Reports exported fixed-arity functions whose call signatures have no corresponding pipeable overload</td></tr>
@@ -57911,7 +57911,7 @@ const runWith = (command, config) => {
57911
57911
  //#endregion
57912
57912
  //#region package.json
57913
57913
  var name = "@effect/tsgo";
57914
- var version = "0.64.1";
57914
+ var version = "0.67.1";
57915
57915
 
57916
57916
  //#endregion
57917
57917
  //#region src/metadata.json
@@ -57998,6 +57998,7 @@ var presets$1 = [
57998
57998
  "matchBooleanToIsSuccess": "suggestion",
57999
57999
  "matchEffectToMapBoth": "suggestion",
58000
58000
  "matchEffectToMatch": "suggestion",
58001
+ "matchToResultOrOption": "suggestion",
58001
58002
  "missingEffectContext": "error",
58002
58003
  "missingEffectError": "error",
58003
58004
  "missingLayerContext": "error",
@@ -58100,6 +58101,7 @@ var presets$1 = [
58100
58101
  "matchBooleanToIsSuccess": "error",
58101
58102
  "matchEffectToMapBoth": "error",
58102
58103
  "matchEffectToMatch": "error",
58104
+ "matchToResultOrOption": "error",
58103
58105
  "missingEffectContext": "error",
58104
58106
  "missingEffectError": "error",
58105
58107
  "missingLayerContext": "error",
@@ -58276,6 +58278,7 @@ var presets$1 = [
58276
58278
  "matchBooleanToIsSuccess": "warning",
58277
58279
  "matchEffectToMapBoth": "warning",
58278
58280
  "matchEffectToMatch": "warning",
58281
+ "matchToResultOrOption": "warning",
58279
58282
  "missedPipeableOpportunity": "warning",
58280
58283
  "missingEffectServiceDependency": "warning",
58281
58284
  "missingPipeableSignature": "warning",
@@ -60196,6 +60199,23 @@ var rules = [
60196
60199
  }]
60197
60200
  }
60198
60201
  },
60202
+ {
60203
+ "name": "matchToResultOrOption",
60204
+ "group": "style",
60205
+ "description": "Suggests Effect.result, Effect.option or Effect.either when match handlers, or a map step followed by a catch step, only reify the outcome",
60206
+ "defaultSeverity": "suggestion",
60207
+ "fixable": true,
60208
+ "supportedEffect": ["v3", "v4"],
60209
+ "codes": [377175],
60210
+ "preview": {
60211
+ "sourceText": "import { Data, Effect, Result } from \"effect\"\n\nclass UserNotFound extends Data.TaggedError(\"UserNotFound\")<{\n readonly id: string\n}> {}\n\ndeclare const fetchUser: (id: string) => Effect.Effect<{ readonly name: string }, UserNotFound>\n\n// MUST TRIGGER: both handlers only reify the outcome, which is Effect.result\nexport const userResult = Effect.match(fetchUser(\"u1\"), {\n onFailure: (e) => Result.fail(e),\n onSuccess: (user) => Result.succeed(user)\n})\n",
60212
+ "diagnostics": [{
60213
+ "start": 339,
60214
+ "end": 351,
60215
+ "text": "`Effect.result` reifies the outcome directly; these `Effect.match` handlers only wrap the value and the error. effect(matchToResultOrOption)"
60216
+ }]
60217
+ }
60218
+ },
60199
60219
  {
60200
60220
  "name": "missedPipeableOpportunity",
60201
60221
  "group": "style",
@@ -60871,11 +60891,11 @@ var tags = {
60871
60891
  "typescript": {
60872
60892
  "latest": "7.0.2",
60873
60893
  "beta": "7.1.0-beta",
60874
- "next": "7.1.0-dev.20261101.1"
60894
+ "next": "7.1.0-dev.20261103.1"
60875
60895
  },
60876
- "oxlint": { "latest": "1.90.0" },
60896
+ "oxlint": { "latest": "1.91.0" },
60877
60897
  "oxlint-tsgolint": { "latest": "7.0.2005" },
60878
- "tsrs": { "latest": "0.20.1-ts7.1.0-beta" }
60898
+ "tsrs": { "latest": "0.21.0-ts7.1.0-beta" }
60879
60899
  };
60880
60900
  var components = {
60881
60901
  "typescript": {
@@ -60887,8 +60907,8 @@ var components = {
60887
60907
  "gitHead": "3e9236361fa97a9e6c685f4833ac457ae2d8c50a",
60888
60908
  "provider": "typescript"
60889
60909
  },
60890
- "7.1.0-dev.20261101.1": {
60891
- "gitHead": "6161772c1370bdd4a82f808e6823bd755eb1870d",
60910
+ "7.1.0-dev.20261103.1": {
60911
+ "gitHead": "042e0fb9574980bd67964165df295e629f834fe3",
60892
60912
  "provider": "typescript"
60893
60913
  }
60894
60914
  },
@@ -60905,10 +60925,11 @@ var components = {
60905
60925
  "oxlint": {
60906
60926
  "1.88.0": { "gitHead": "6941b4ed45ead21c45bc2164cb80a180eed85b43" },
60907
60927
  "1.89.0": { "gitHead": "07ed78f4abde4020ca7919381ffea4da8616b78a" },
60908
- "1.90.0": { "gitHead": "9b6fff42fa6edf0bec55861b6f0764c7b9acd86b" }
60928
+ "1.90.0": { "gitHead": "9b6fff42fa6edf0bec55861b6f0764c7b9acd86b" },
60929
+ "1.91.0": { "gitHead": "f3fcdcc61b08e9880476279ba21a363967940fa4" }
60909
60930
  },
60910
- "tsrs": { "0.20.1-ts7.1.0-beta": {
60911
- "gitHead": "77d3cddb44540734abc33a42ccca4d3f33bee527",
60931
+ "tsrs": { "0.21.0-ts7.1.0-beta": {
60932
+ "gitHead": "38931a58019107ba31581791e26a7aa414c9e015",
60912
60933
  "typescript": {
60913
60934
  "version": "7.1.0-beta",
60914
60935
  "gitHead": "3e9236361fa97a9e6c685f4833ac457ae2d8c50a"
@@ -210425,6 +210446,32 @@ const execProxyCommand = (command, host = nodeExecHost) => {
210425
210446
  }
210426
210447
  };
210427
210448
 
210449
+ //#endregion
210450
+ //#region src/cli/proxy/argv.ts
210451
+ const proxyTools = [
210452
+ "tsc",
210453
+ "tsrs",
210454
+ "oxlint",
210455
+ "vp"
210456
+ ];
210457
+ const tsrsLintFlag = "--tsrs-lint";
210458
+ const isProxyTool = (value) => proxyTools.includes(value);
210459
+ const parseTsrsLintFlag = (argument) => argument === tsrsLintFlag ? { version: void 0 } : argument.startsWith(`${tsrsLintFlag}=`) ? { version: argument.slice(12) } : void 0;
210460
+ const parseProxyInvocation = (argv) => {
210461
+ const tsrsLint = argv[0] === void 0 ? void 0 : parseTsrsLintFlag(argv[0]);
210462
+ const [first, ...args] = tsrsLint === void 0 ? argv : argv.slice(1);
210463
+ if (first === void 0) return void 0;
210464
+ const separator = first.indexOf("@");
210465
+ const tool = separator === -1 ? first : first.slice(0, separator);
210466
+ if (!isProxyTool(tool)) return void 0;
210467
+ return {
210468
+ tool,
210469
+ version: separator === -1 ? void 0 : first.slice(separator + 1),
210470
+ tsrsLint,
210471
+ args
210472
+ };
210473
+ };
210474
+
210428
210475
  //#endregion
210429
210476
  //#region src/cli/proxy/resolve.ts
210430
210477
  var ProxyError = class extends TaggedError$1("ProxyError") {
@@ -210486,6 +210533,7 @@ const executablePath = (filePath, platform) => platform === "win32" && filePath.
210486
210533
  const tscExecutable = (context, version) => packagedComponentPath(context.packageDirectory, "typescript", version, context.platform === "win32" ? "tsc.exe" : "tsc");
210487
210534
  const tsrsExecutable = (context, version) => packagedComponentPath(context.packageDirectory, "tsrs", version, tsrsExecutableName(context.platform));
210488
210535
  const resolveTsc = (context, invocation) => gen(function* () {
210536
+ yield* rejectTsrsLint(invocation);
210489
210537
  const installed = invocation.version === void 0 ? yield* installedTypescriptVersion(context) : void 0;
210490
210538
  const executable = yield* requireArtifact(yield* tscExecutable(context, yield* selectVersion("tsc", "typescript", invocation.version, installed)));
210491
210539
  yield* ensureExecutable(executable, context.platform);
@@ -210495,19 +210543,22 @@ const resolveTsc = (context, invocation) => gen(function* () {
210495
210543
  env: context.env
210496
210544
  };
210497
210545
  });
210498
- const resolveTsrs = (context, invocation) => gen(function* () {
210546
+ const packagedTsrs = (context, requested) => gen(function* () {
210499
210547
  const fs = yield* FileSystem;
210500
210548
  const path = yield* Path$2;
210501
210549
  if (context.platform === "linux" && !context.isGlibc()) return yield* new ProxyError({ reason: `Linux musl is not supported by the packaged tsrs integration; it is built for ${tsrsReplacementTargets.join(", ")}.` });
210502
210550
  const target = tsrsTarget(context.platform, context.arch, true);
210503
210551
  if (target === void 0 || !tsrsReplacementTargets.includes(target)) return yield* new ProxyError({ reason: `The packaged tsrs integration is not available for ${context.platform}-${context.arch}; it is built for ${tsrsReplacementTargets.join(", ")}.` });
210504
- const installed = invocation.version === void 0 ? yield* installedTsrsVersion(context) : void 0;
210505
- const executable = yield* requireArtifact(yield* tsrsExecutable(context, yield* selectVersion("tsrs", "tsrs", invocation.version, installed)));
210552
+ const executable = yield* requireArtifact(yield* tsrsExecutable(context, yield* selectVersion("tsrs", "tsrs", requested, requested === void 0 ? yield* installedTsrsVersion(context) : void 0)));
210506
210553
  const libraryPath = path.join(path.dirname(executable), "lib.d.ts");
210507
210554
  if (!(yield* fs.exists(libraryPath).pipe(mapError(toProxyError)))) return yield* new ProxyError({ reason: `Missing ${libraryPath}: tsrs needs its lib*.d.ts files next to the packaged binary ${executable}. Reinstall @effect/tsgo-${context.platform}-${context.arch}.` });
210508
210555
  yield* ensureExecutable(executable, context.platform);
210556
+ return executablePath(executable, context.platform);
210557
+ });
210558
+ const resolveTsrs = (context, invocation) => gen(function* () {
210559
+ yield* rejectTsrsLint(invocation);
210509
210560
  return {
210510
- file: executablePath(executable, context.platform),
210561
+ file: yield* packagedTsrs(context, invocation.version),
210511
210562
  args: invocation.args,
210512
210563
  env: context.env
210513
210564
  };
@@ -210526,12 +210577,13 @@ const findOxlintInstallation = (cwd) => gen(function* () {
210526
210577
  };
210527
210578
  }
210528
210579
  });
210529
- const oxlintBinPath = (oxlint) => gen(function* () {
210580
+ const packageBinPath = (installed, binName) => gen(function* () {
210530
210581
  const path = yield* Path$2;
210531
- const bin = typeof oxlint.bin === "string" ? oxlint.bin : oxlint.bin?.oxlint;
210532
- if (bin === void 0) return yield* new ProxyError({ reason: `${oxlint.packageJsonPath} does not declare an oxlint bin entry.` });
210533
- return path.resolve(path.dirname(oxlint.packageJsonPath), bin);
210582
+ const bin = typeof installed.bin === "string" ? installed.bin : installed.bin?.[binName];
210583
+ if (bin === void 0) return yield* new ProxyError({ reason: `${installed.packageJsonPath} does not declare a ${binName} bin entry.` });
210584
+ return path.resolve(path.dirname(installed.packageJsonPath), bin);
210534
210585
  });
210586
+ const oxlintBinPath = (oxlint) => packageBinPath(oxlint, "oxlint");
210535
210587
  const supportedInstalledVersion = (component, installed) => {
210536
210588
  const versions = supportedVersions(component);
210537
210589
  return versions.includes(installed.version) ? succeed$2(installed.version) : fail$5(new UnsupportedProxyVersionError({
@@ -210542,71 +210594,108 @@ const supportedInstalledVersion = (component, installed) => {
210542
210594
  tags: {}
210543
210595
  }));
210544
210596
  };
210545
- const oxlintCommand = (context, args, installation) => gen(function* () {
210597
+ const packagedTsgolint = (context, installation, target) => gen(function* () {
210598
+ if (installation.tsgolint === void 0) return void 0;
210599
+ const tsgolintVersion = yield* supportedInstalledVersion("oxlint-tsgolint", installation.tsgolint);
210600
+ const tsgolint = yield* requireArtifact(yield* packagedComponentPath(context.packageDirectory, "oxlint-tsgolint", tsgolintVersion, target.tsgolintExecutable));
210601
+ yield* ensureExecutable(tsgolint, context.platform);
210602
+ return {
210603
+ kind: "tsgolint",
210604
+ executable: tsgolint
210605
+ };
210606
+ });
210607
+ const packagedTsrsLint = (context, selection) => gen(function* () {
210608
+ if (selection.version === "") return yield* new ProxyError({ reason: `Expected a tsrs version or tag after ${tsrsLintFlag}=.` });
210609
+ return {
210610
+ kind: "tsrs",
210611
+ executable: yield* packagedTsrs(context, selection.version)
210612
+ };
210613
+ });
210614
+ const oxlintArtifacts = (context, installation, tsrsLint) => gen(function* () {
210546
210615
  const target = yield* try_({
210547
210616
  try: () => experimentalOxlintTarget(context.platform, context.arch, context.platform === "linux" && context.isGlibc()),
210548
210617
  catch: (error) => new ProxyError({ reason: error instanceof Error ? error.message : String(error) })
210549
210618
  });
210550
210619
  const oxlintVersion = yield* supportedInstalledVersion("oxlint", installation.oxlint);
210551
- const binding = yield* requireArtifact(yield* packagedComponentPath(context.packageDirectory, "oxlint", oxlintVersion, target.oxlintBinding));
210552
- let tsgolint;
210553
- if (installation.tsgolint !== void 0) {
210554
- const tsgolintVersion = yield* supportedInstalledVersion("oxlint-tsgolint", installation.tsgolint);
210555
- tsgolint = yield* requireArtifact(yield* packagedComponentPath(context.packageDirectory, "oxlint-tsgolint", tsgolintVersion, target.tsgolintExecutable));
210556
- yield* ensureExecutable(tsgolint, context.platform);
210557
- }
210558
- const bin = yield* oxlintBinPath(installation.oxlint);
210620
+ return {
210621
+ binding: yield* requireArtifact(yield* packagedComponentPath(context.packageDirectory, "oxlint", oxlintVersion, target.oxlintBinding)),
210622
+ linter: tsrsLint === void 0 ? yield* packagedTsgolint(context, installation, target) : yield* packagedTsrsLint(context, tsrsLint)
210623
+ };
210624
+ });
210625
+ const preloadPath = (bridge, platform) => {
210626
+ const preload = platform === "win32" ? bridge.replaceAll("\\", "/") : bridge;
210627
+ return /["\\]/.test(preload) ? fail$5(new ProxyError({ reason: `Unable to preload ${bridge}: NODE_OPTIONS and BUN_OPTIONS cannot carry a path with quotes or backslashes.` })) : succeed$2(preload);
210628
+ };
210629
+ const prependOption = (options, option, preload) => options === void 0 || options.trim() === "" ? option : options.includes(preload) ? options : `${option} ${options}`;
210630
+ const linterEnv = (env, linter) => {
210631
+ if (linter === void 0) return env;
210632
+ const { EFFECT_TSGO_TSGOLINT_MODE: _mode, ...rest } = env;
210633
+ return {
210634
+ ...rest,
210635
+ EFFECT_TSGO_TSGOLINT_PATH: linter.executable,
210636
+ ...linter.kind === "tsrs" ? { EFFECT_TSGO_TSGOLINT_MODE: "tsrs" } : {}
210637
+ };
210638
+ };
210639
+ const oxlintBridgeEnv = (context, artifacts) => gen(function* () {
210640
+ const preload = yield* preloadPath(context.oxlintBridge, context.platform);
210641
+ return {
210642
+ ...linterEnv(context.env, artifacts.linter),
210643
+ NODE_OPTIONS: prependOption(context.env.NODE_OPTIONS, `--require "${preload}"`, preload),
210644
+ BUN_OPTIONS: prependOption(context.env.BUN_OPTIONS, `"--preload=${preload}"`, preload),
210645
+ EFFECT_TSGO_OXLINT_BINDING: artifacts.binding
210646
+ };
210647
+ });
210648
+ const oxlintCommand = (context, args, installation, tsrsLint = void 0) => gen(function* () {
210649
+ const artifacts = yield* oxlintArtifacts(context, installation, tsrsLint);
210559
210650
  return {
210560
210651
  file: context.execPath,
210561
- args: [bin, ...args],
210562
- env: {
210563
- ...context.env,
210564
- NAPI_RS_NATIVE_LIBRARY_PATH: binding,
210565
- ...tsgolint === void 0 ? {} : { OXLINT_TSGOLINT_PATH: tsgolint }
210566
- }
210652
+ args: [yield* oxlintBinPath(installation.oxlint), ...args],
210653
+ env: yield* oxlintBridgeEnv(context, artifacts)
210567
210654
  };
210568
210655
  });
210656
+ const rejectVersion = (tool, version) => version === void 0 ? void_$1 : fail$5(new ProxyError({ reason: `${tool}@${version} is not supported: the packaged Oxlint build is selected by the installed oxlint version. Run effect-tsgo ${tool} instead.` }));
210657
+ const rejectTsrsLint = (invocation) => invocation.tsrsLint === void 0 ? void_$1 : fail$5(new ProxyError({ reason: `${tsrsLintFlag} selects the type-aware linter of Oxlint: use it with effect-tsgo ${tsrsLintFlag} oxlint or effect-tsgo ${tsrsLintFlag} vp.` }));
210658
+ const rejectMusl = (context) => context.platform === "linux" && !context.isGlibc() ? fail$5(new ProxyError({ reason: "Linux musl is not supported by the packaged Oxlint integration." })) : void_$1;
210569
210659
  const resolveOxlint = (context, invocation) => gen(function* () {
210570
- if (invocation.version !== void 0) return yield* new ProxyError({ reason: `oxlint@${invocation.version} is not supported: the packaged Oxlint build is selected by the installed oxlint version. Run effect-tsgo oxlint instead.` });
210571
- if (context.platform === "linux" && !context.isGlibc()) return yield* new ProxyError({ reason: "Linux musl is not supported by the packaged Oxlint integration." });
210660
+ yield* rejectVersion("oxlint", invocation.version);
210661
+ yield* rejectMusl(context);
210572
210662
  const installation = yield* findOxlintInstallation(context.cwd);
210573
210663
  if (installation === void 0) return yield* new ProxyError({ reason: `Unable to resolve oxlint from ${context.cwd}. Install oxlint (or vite-plus) in the project.` });
210574
- return yield* oxlintCommand(context, invocation.args, installation);
210664
+ return yield* oxlintCommand(context, invocation.args, installation, invocation.tsrsLint);
210665
+ });
210666
+ const resolveVitePlus = (context, invocation) => gen(function* () {
210667
+ yield* rejectVersion("vp", invocation.version);
210668
+ yield* rejectMusl(context);
210669
+ const path = yield* Path$2;
210670
+ const vitePlus = yield* findInstalledPackage(node_module.createRequire(path.join(context.cwd, "noop.js")), "vite-plus").pipe(mapError(toProxyError));
210671
+ if (vitePlus === void 0) return yield* new ProxyError({ reason: `Unable to resolve vite-plus from ${context.cwd}. Install vite-plus in the project.` });
210672
+ const installation = yield* findOxlintInstallation(context.cwd);
210673
+ if (installation === void 0) return yield* new ProxyError({ reason: `Unable to resolve the oxlint package of vite-plus from ${context.cwd}.` });
210674
+ const artifacts = yield* oxlintArtifacts(context, installation, invocation.tsrsLint);
210675
+ return {
210676
+ file: context.execPath,
210677
+ args: [yield* packageBinPath(vitePlus, "vp"), ...invocation.args],
210678
+ env: yield* oxlintBridgeEnv(context, artifacts)
210679
+ };
210575
210680
  });
210576
210681
  const resolveProxyCommand = (invocation, context) => {
210577
210682
  switch (invocation.tool) {
210578
210683
  case "tsc": return resolveTsc(context, invocation);
210579
210684
  case "tsrs": return resolveTsrs(context, invocation);
210580
210685
  case "oxlint": return resolveOxlint(context, invocation);
210686
+ case "vp": return resolveVitePlus(context, invocation);
210581
210687
  }
210582
210688
  };
210583
210689
 
210584
- //#endregion
210585
- //#region src/cli/proxy/argv.ts
210586
- const proxyTools = [
210587
- "tsc",
210588
- "tsrs",
210589
- "oxlint"
210590
- ];
210591
- const isProxyTool = (value) => proxyTools.includes(value);
210592
- const parseProxyInvocation = (argv) => {
210593
- const [first, ...args] = argv;
210594
- if (first === void 0) return void 0;
210595
- const separator = first.indexOf("@");
210596
- const tool = separator === -1 ? first : first.slice(0, separator);
210597
- if (!isProxyTool(tool)) return void 0;
210598
- return {
210599
- tool,
210600
- version: separator === -1 ? void 0 : first.slice(separator + 1),
210601
- args
210602
- };
210603
- };
210604
-
210605
210690
  //#endregion
210606
210691
  //#region src/cli/proxy/index.ts
210607
210692
  const runProxy = (invocation, host = nodeExecHost) => {
210608
210693
  const program = gen(function* () {
210609
210694
  const packageDirectory = yield* resolvePlatformPackageDirectory.pipe(mapError(({ reason }) => new ProxyError({ reason })));
210695
+ const oxlintBridge = yield* try_({
210696
+ try: () => node_module.createRequire(require("url").pathToFileURL(__filename).href).resolve("@effect/tsgo/oxlint-bridge"),
210697
+ catch: () => new ProxyError({ reason: "Unable to resolve @effect/tsgo/oxlint-bridge; reinstall @effect/tsgo." })
210698
+ });
210610
210699
  return yield* resolveProxyCommand(invocation, {
210611
210700
  cwd: process.cwd(),
210612
210701
  env: process.env,
@@ -210614,7 +210703,8 @@ const runProxy = (invocation, host = nodeExecHost) => {
210614
210703
  platform: process.platform,
210615
210704
  arch: process.arch,
210616
210705
  isGlibc,
210617
- packageDirectory
210706
+ packageDirectory,
210707
+ oxlintBridge
210618
210708
  });
210619
210709
  }).pipe(provide(layer));
210620
210710
  return runPromiseExit(program).then((exit) => {
@@ -210987,7 +211077,7 @@ const diagnosticsCommand = make("diagnostics", {
210987
211077
  listFiles
210988
211078
  }));
210989
211079
  })));
210990
- const rootCommand = make("tsgo").pipe(withDescription("Effect Language Service for TypeScript-Go. Besides the commands below, `effect-tsgo tsc[@<version|tag>] [args...]`, `effect-tsgo tsrs[@<version|tag>] [args...]` and `effect-tsgo oxlint [args...]` run the Effect-patched tsc, tsrs and Oxlint straight from @effect/tsgo without patching node_modules, passing every argument after the tool through unchanged. Without a version, tsc and tsrs use the installed version when supported, else the latest supported one; oxlint uses the build of the installed oxlint."), withExamples([
211080
+ const rootCommand = make("tsgo").pipe(withDescription("Effect Language Service for TypeScript-Go. Besides the commands below, `effect-tsgo tsc[@<version|tag>] [args...]`, `effect-tsgo tsrs[@<version|tag>] [args...]` and `effect-tsgo oxlint [args...]` run the Effect-patched tsc, tsrs and Oxlint straight from @effect/tsgo without patching node_modules, and `effect-tsgo vp [args...]` runs vite-plus with the Effect-patched Oxlint, passing every argument after the tool through unchanged. Without a version, tsc and tsrs use the installed version when supported, else the latest supported one; oxlint and vp use the build of the installed oxlint."), withExamples([
210991
211081
  {
210992
211082
  command: "effect-tsgo tsc -p tsconfig.json",
210993
211083
  description: "Type check with the Effect-patched tsc"
@@ -211007,6 +211097,10 @@ const rootCommand = make("tsgo").pipe(withDescription("Effect Language Service f
211007
211097
  {
211008
211098
  command: "effect-tsgo oxlint --type-aware",
211009
211099
  description: "Lint with the Effect-patched Oxlint and tsgolint"
211100
+ },
211101
+ {
211102
+ command: "effect-tsgo vp check",
211103
+ description: "Run vite-plus checks with the Effect-patched Oxlint and tsgolint"
211010
211104
  }
211011
211105
  ]), withSubcommands([
211012
211106
  patchCommand,
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ // Preloaded by `effect-tsgo oxlint` and `effect-tsgo vp` into the Node.js and Bun processes they start
4
+ // (NODE_OPTIONS=--require, BUN_OPTIONS=--preload=). Both runtimes load N-API addons through process.dlopen, so the
5
+ // stock Oxlint binding is mapped there to the Effect-patched one named by EFFECT_TSGO_OXLINT_BINDING. Every other
6
+ // addon (vite-plus, rolldown, ...) loads unchanged, which NAPI_RS_NATIVE_LIBRARY_PATH cannot ensure: every napi-rs
7
+ // loader in the process reads it.
8
+ const path = require("node:path");
9
+
10
+ const patchedBinding = process.env.EFFECT_TSGO_OXLINT_BINDING;
11
+ const stockBinding = /[\\/]@oxlint[\\/]binding-[\w-]+[\\/]oxlint\.[\w-]+\.node$/i;
12
+
13
+ if (patchedBinding && typeof process.dlopen === "function") {
14
+ const dlopen = process.dlopen;
15
+ // Node.js passes the namespaced form of long Windows paths; keep it for the replacement.
16
+ const replacement = path.toNamespacedPath(patchedBinding);
17
+ // Only the arguments the caller passed are forwarded: an explicit undefined flags argument is not the default.
18
+ process.dlopen = (module, filename, ...rest) =>
19
+ dlopen(module, typeof filename === "string" && stockBinding.test(filename) ? replacement : filename, ...rest);
20
+ }
@@ -177,6 +177,7 @@ export const recommended = {
177
177
  "effecttsgo/match-boolean-to-is-success": "warn",
178
178
  "effecttsgo/match-effect-to-map-both": "warn",
179
179
  "effecttsgo/match-effect-to-match": "warn",
180
+ "effecttsgo/match-to-result-or-option": "warn",
180
181
  "effecttsgo/missing-effect-context": "error",
181
182
  "effecttsgo/missing-effect-error": "error",
182
183
  "effecttsgo/missing-layer-context": "error",
@@ -284,6 +285,7 @@ export const strict = {
284
285
  "effecttsgo/match-boolean-to-is-success": "error",
285
286
  "effecttsgo/match-effect-to-map-both": "error",
286
287
  "effecttsgo/match-effect-to-match": "error",
288
+ "effecttsgo/match-to-result-or-option": "error",
287
289
  "effecttsgo/missing-effect-context": "error",
288
290
  "effecttsgo/missing-effect-error": "error",
289
291
  "effecttsgo/missing-layer-context": "error",
@@ -374,6 +376,7 @@ export const style = {
374
376
  "effecttsgo/match-boolean-to-is-success": "warn",
375
377
  "effecttsgo/match-effect-to-map-both": "warn",
376
378
  "effecttsgo/match-effect-to-match": "warn",
379
+ "effecttsgo/match-to-result-or-option": "warn",
377
380
  "effecttsgo/missed-pipeable-opportunity": "warn",
378
381
  "effecttsgo/missing-effect-service-dependency": "warn",
379
382
  "effecttsgo/missing-pipeable-signature": "warn",
@@ -57,6 +57,7 @@
57
57
  "effecttsgo/match-boolean-to-is-success": "warn",
58
58
  "effecttsgo/match-effect-to-map-both": "warn",
59
59
  "effecttsgo/match-effect-to-match": "warn",
60
+ "effecttsgo/match-to-result-or-option": "warn",
60
61
  "effecttsgo/missing-effect-context": "error",
61
62
  "effecttsgo/missing-effect-error": "error",
62
63
  "effecttsgo/missing-layer-context": "error",
@@ -57,6 +57,7 @@
57
57
  "effecttsgo/match-boolean-to-is-success": "error",
58
58
  "effecttsgo/match-effect-to-map-both": "error",
59
59
  "effecttsgo/match-effect-to-match": "error",
60
+ "effecttsgo/match-to-result-or-option": "error",
60
61
  "effecttsgo/missing-effect-context": "error",
61
62
  "effecttsgo/missing-effect-error": "error",
62
63
  "effecttsgo/missing-layer-context": "error",
@@ -40,6 +40,7 @@
40
40
  "effecttsgo/match-boolean-to-is-success": "warn",
41
41
  "effecttsgo/match-effect-to-map-both": "warn",
42
42
  "effecttsgo/match-effect-to-match": "warn",
43
+ "effecttsgo/match-to-result-or-option": "warn",
43
44
  "effecttsgo/missed-pipeable-opportunity": "warn",
44
45
  "effecttsgo/missing-effect-service-dependency": "warn",
45
46
  "effecttsgo/missing-pipeable-signature": "warn",
@@ -1021,6 +1021,26 @@
1021
1021
  "markdownDescription": "The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are `callback`, `cb`, `next`.",
1022
1022
  "type": "array"
1023
1023
  },
1024
+ "CapitalizedCallsConfig": {
1025
+ "additionalProperties": false,
1026
+ "properties": {
1027
+ "allow": {
1028
+ "default": [],
1029
+ "description": "Exact names of capitalized functions that may be called directly.\nForwarded to the React Compiler's `validateNoCapitalizedCalls`\nenvironment option.",
1030
+ "items": {
1031
+ "type": "string"
1032
+ },
1033
+ "markdownDescription": "Exact names of capitalized functions that may be called directly.\nForwarded to the React Compiler's `validateNoCapitalizedCalls`\nenvironment option.",
1034
+ "type": "array"
1035
+ },
1036
+ "allowPattern": {
1037
+ "description": "A regex pattern; capitalized functions whose name matches may be called\ndirectly, checked alongside `allow`. Useful when a codebase has a\nnaming convention for capitalized non-component factories, such as\ngenerated event or schema builders (e.g. `\"Event$\"`).",
1038
+ "markdownDescription": "A regex pattern; capitalized functions whose name matches may be called\ndirectly, checked alongside `allow`. Useful when a codebase has a\nnaming convention for capitalized non-component factories, such as\ngenerated event or schema builders (e.g. `\"Event$\"`).",
1039
+ "type": "string"
1040
+ }
1041
+ },
1042
+ "type": "object"
1043
+ },
1024
1044
  "CapitalizedCommentsOptions": {
1025
1045
  "description": "Configuration for the capitalized-comments rule.\n\nThe first element specifies whether comments should `\"always\"` or `\"never\"`\nbegin with a capital letter. The second element is an optional object\ncontaining additional options.",
1026
1046
  "items": [
@@ -2467,6 +2487,9 @@
2467
2487
  "effecttsgo/match-effect-to-match": {
2468
2488
  "$ref": "#/definitions/RuleNoConfig"
2469
2489
  },
2490
+ "effecttsgo/match-to-result-or-option": {
2491
+ "$ref": "#/definitions/RuleNoConfig"
2492
+ },
2470
2493
  "effecttsgo/missed-pipeable-opportunity": {
2471
2494
  "$ref": "#/definitions/RuleNoConfig"
2472
2495
  },
@@ -6869,7 +6892,24 @@
6869
6892
  ]
6870
6893
  },
6871
6894
  "react/capitalized-calls": {
6872
- "$ref": "#/definitions/RuleNoConfig"
6895
+ "anyOf": [
6896
+ {
6897
+ "$ref": "#/definitions/RuleNoConfig"
6898
+ },
6899
+ {
6900
+ "items": [
6901
+ {
6902
+ "$ref": "#/definitions/AllowWarnDeny"
6903
+ },
6904
+ {
6905
+ "$ref": "#/definitions/CapitalizedCallsConfig"
6906
+ }
6907
+ ],
6908
+ "maxItems": 2,
6909
+ "minItems": 2,
6910
+ "type": "array"
6911
+ }
6912
+ ]
6873
6913
  },
6874
6914
  "react/checked-requires-onchange-or-readonly": {
6875
6915
  "anyOf": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/tsgo",
3
- "version": "0.64.1",
3
+ "version": "0.67.1",
4
4
  "type": "module",
5
5
  "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
6
6
  "license": "MIT",
@@ -24,6 +24,7 @@
24
24
  "types": "./lib/getExePath.d.ts",
25
25
  "default": "./lib/getExePath.js"
26
26
  },
27
+ "./oxlint-bridge": "./lib/oxlint-bridge.cjs",
27
28
  "./oxlint-presets": {
28
29
  "types": "./oxlint-presets/index.d.ts",
29
30
  "default": "./oxlint-presets/index.js"
@@ -41,13 +42,13 @@
41
42
  "schema.json"
42
43
  ],
43
44
  "optionalDependencies": {
44
- "@effect/tsgo-win32-x64": "0.64.1",
45
- "@effect/tsgo-win32-arm64": "0.64.1",
46
- "@effect/tsgo-linux-x64": "0.64.1",
47
- "@effect/tsgo-linux-arm64": "0.64.1",
48
- "@effect/tsgo-linux-arm": "0.64.1",
49
- "@effect/tsgo-darwin-x64": "0.64.1",
50
- "@effect/tsgo-darwin-arm64": "0.64.1"
45
+ "@effect/tsgo-win32-x64": "0.67.1",
46
+ "@effect/tsgo-win32-arm64": "0.67.1",
47
+ "@effect/tsgo-linux-x64": "0.67.1",
48
+ "@effect/tsgo-linux-arm64": "0.67.1",
49
+ "@effect/tsgo-linux-arm": "0.67.1",
50
+ "@effect/tsgo-darwin-x64": "0.67.1",
51
+ "@effect/tsgo-darwin-arm64": "0.67.1"
51
52
  },
52
53
  "devDependencies": {
53
54
  "@effect/platform-node": "^4.1.2",
package/schema.json CHANGED
@@ -2731,6 +2731,11 @@
2731
2731
  "default": "suggestion",
2732
2732
  "description": "Suggests Effect.match or Effect.matchCause when both Effect.matchEffect handlers only return Effect.succeed"
2733
2733
  },
2734
+ "matchToResultOrOption": {
2735
+ "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
2736
+ "default": "suggestion",
2737
+ "description": "Suggests Effect.result, Effect.option or Effect.either when match handlers, or a map step followed by a catch step, only reify the outcome"
2738
+ },
2734
2739
  "missedPipeableOpportunity": {
2735
2740
  "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
2736
2741
  "default": "off",