Skip to content

lint: parse the project's Oxlint config with the project's Oxlint - #106

Merged
thejackshelton merged 2 commits into
tsrx-org:mainfrom
o-alexandrov:fix/canonical-oxlint-parses-project-config
Sep 22, 2026
Merged

thejackshelton merged 2 commits into
tsrx-org:mainfrom
o-alexandrov:fix/canonical-oxlint-parses-project-config

Conversation

@o-alexandrov

@o-alexandrov o-alexandrov commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #105.

The defect

oxlint-current is a pin: one Oxlint version, frozen when this package was released. The configuration it has to parse is not pinned at all, because the project owns .oxlintrc.json and writes it against whatever Oxlint the project installed. A project whose Oxlint is newer than the pin therefore has its own configuration rejected over rules that do exist, but which the pin has simply never heard of.

Reproduced on @tsrx/[email protected] (pin [email protected]) against a project on [email protected]:

oxlint (oxc-tsrx): canonical Oxlint returned non-JSON output while composing diagnostics:
Failed to parse oxlint configuration file.

  x Rule 'set-state-in-effect' not found in plugin 'react'

Bumping the pin does not fix this. It re-breaks on the next Oxlint release that adds a rule.

The change

selectCanonicalOxlint resolves the pin first and prefers the project's own Oxlint only when that one is at least as new. An older, absent, or unreadable project Oxlint leaves the pin exactly where it was, so the pin remains the floor that every composition lane here was established against, and pinned behaviour cannot regress.

This is deliberately not the question decideCanonicalCommand answers. That one decides who owns the command name, where a merely transitive Oxlint must not take the name away from an explicit oxc-tsrx install. Which binary parses the project's configuration is a separate question, because a transitively installed Oxlint is still the version that project's configuration was written against.

Every lint lane that previously reached for the pin directly now goes through the selector: the oxlint launcher, the prestart probe, both lint-cli delegation paths, both JS-plugin lane paths, and the LSP multiplexer. The JS-plugin lane version gate now reads the version of the binary that will actually host the lane, rather than the version this package shipped.

A rejected configuration was also the one failure whose cause was absent from the message the user saw, which talked about JSON composition the user never asked about. The message now names the binary that rejected the configuration and where that binary came from.

The sync project-root walk is kept inside package-binary.ts rather than shared with provider-resolve.ts on purpose. The VSIX bundles provider-resolve by itself, and an import edge between the two modules lets the editor build inline the resolver through package-binary even in the contrast fixture that is supposed to fail to resolve it.

Verification

Functional, on the issue's minimal reproduction:

  • Patched wrapper: reports 1.84.0 and exits 0.
  • Pristine 0.13.0 wrapper on the identical tree: reports 1.74.0 and exits 2 with the error above.
  • Pin-only control, no project oxlint installed: still reports 1.74.0 and exits 0, so the pin remains the floor.

Suites, on this machine:

  • pnpm run build:packages, pnpm run build:editor, and pnpm run licenses:vscode:check all pass. The committed editor bundle and its bundled-dependency license inventory are regenerated in this commit because the resolver region moved.
  • pnpm run test:packaging:unit: the set of failing tests is identical to the set that fails on an unmodified checkout of main at 1020dd8. Those remaining failures all need the Rust artifact target/release/oxc-tsrx, which this environment cannot build.
  • pnpm test: the same 285 failures occur on both the patched tree and the unmodified baseline, from that same missing Rust artifact. I could not run the lanes that depend on it.

tests/packaging/runtime-contract.test.mjs is updated: it pinned the exact importDeclaredPackageBinary("oxlint-current", "oxlint" call in the launcher. It now asserts that the launcher goes through importCanonicalOxlint, that the prestart probe goes through resolveCanonicalOxlint, and that the pin is still what the selector resolves as a declared npm binary.


Note

Medium Risk
Changes which Oxlint binary runs across CLI, LSP, and JS-plugin lanes based on project node_modules resolution; behavior should improve for newer project pins but version-selection edge cases could affect lint results.

Overview
Fixes config parse failures when a project's installed Oxlint is newer than the oxlint-current pin (e.g. unknown rules in .oxlintrc.json).

Canonical Oxlint selection adds selectCanonicalOxlint / resolveCanonicalOxlint / importCanonicalOxlint: start from the pin, then use the project's oxlint when its semver is at least as new (with fallbacks for missing installs, the oxc-tsrx compatibility facade, and same-manifest edge cases). The pinned package remains the floor.

Call sites that spawned or imported the pin directly now go through this selector—the oxlint launcher, composed CLI upstream runs, prestart, JS-plugin projection lane, editor plugin host, and LSP multiplexer. The JS-plugin version gate reads the binary that will actually run.

Diagnostics when upstream output is not JSON but mentions a failed config parse now name whether the project's Oxlint or the pin rejected the config and which version.

The VS Code extension bundle inlines the same resolver (project-root walk kept local to package-binary.ts to avoid bundler coupling); license inventory hashes are refreshed. Packaging contract tests assert the new entry points.

Reviewed by Cursor Bugbot for commit 69116a7. Bugbot is set up for automated code reviews on this repo. Configure here.

…lint

`oxlint-current` is a pin: one Oxlint version, frozen when this package was
released. The configuration it has to parse is not pinned at all, because the
project owns that file and writes it against whatever Oxlint the project
installed. A project whose Oxlint is newer than the pin therefore has its own
configuration rejected over rules that do exist, but which the pin has never
heard of.

Bumping the pin does not fix this. It re-breaks on the next Oxlint release that
adds a rule.

`selectCanonicalOxlint` resolves the pin first and prefers the project's own
Oxlint only when that one is at least as new. An older, absent, or unreadable
project Oxlint leaves the pin exactly where it was, so the pin remains the floor
that every composition lane here was established against and pinned behaviour
cannot regress. This is deliberately not the question `decideCanonicalCommand`
answers: that one decides who owns the command name, where a merely transitive
Oxlint must not take the name from an explicit oxc-tsrx install. Which binary
parses the project's configuration is separate, because a transitively installed
Oxlint is still the version the project's configuration was written against.

The JS-plugin lane gate now reads the version of the binary that will actually
host the lane, rather than the version this package shipped.

A rejected configuration was also the one failure whose cause was absent from
the message the user saw, which talked about JSON composition instead. It now
names the binary that rejected the configuration and where that binary came
from.

Fixes tsrx-org#105
@vercel

vercel Bot commented Sep 21, 2026

Copy link
Copy Markdown

@o-alexandrov is attempting to deploy a commit to the Ripple Team Team on Vercel.

A member of the Team first needs to authorize it.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 852c12f. Configure here.

…LSP cwd

Two review findings on the canonical selector.

`oxc-tsrx setup` can write a compatibility facade into the `oxlint` slot, and
that facade re-enters this launcher. The previous guard compared manifest paths,
but the facade has a path of its own, so the comparison never saw it. A facade
whose version reached the pin would therefore have been selected and the
launcher would have recursed without bound. It is now identified the way
`decideCanonicalCommand` identifies it, by its own `oxcTsrxCompatibility`
metadata. The path comparison is kept for what it does cover, which is the
pinned package resolving under this one.

The LSP multiplexer resolved the selector against `process.cwd()` while
spawning its servers in `options.cwd`, so a session could serve one workspace
while picking the Oxlint belonging to another tree. It now passes its own cwd,
as every other lane does.

Also removes the `resolvePackageBinary` imports that the previous commit
orphaned in `lint-cli.ts` and `lint-js-plugins.ts`.
@thejackshelton
thejackshelton merged commit d116018 into tsrx-org:main Sep 22, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vendored oxlint-current pin rejects rules the project's own installed Oxlint supports

2 participants