Skip to content

fix(cli): run the bundled oxlint and oxfmt unless the project declares them - #3066

Open
Pduhard wants to merge 2 commits into
voidzero-dev:mainfrom
Pduhard:fix/resolve-oxlint-inside-project
Open

Pduhard wants to merge 2 commits into
voidzero-dev:mainfrom
Pduhard:fix/resolve-oxlint-inside-project

Conversation

@Pduhard

@Pduhard Pduhard commented Oct 15, 2026 •

Copy link
Copy Markdown

vp lint and vp fmt resolve oxlint and oxfmt from the current directory upward, so a project that does not install them runs any copy found in a parent folder instead of the bundled one (#3065).

The project's copy now runs only when the nearest package.json or the workspace root declares it, the same rule Vite uses for its optional dependencies. Otherwise the bundled copy runs. In a monorepo without pnpm-workspace.yaml or a workspaces field, a copy declared at the root no longer runs from a sub-package.

Checked with the repro from the issue on Linux, Windows and Yarn PnP.

Fixes #3065

@Pduhard
Pduhard marked this pull request as draft October 15, 2026 10:00
@Pduhard
Pduhard marked this pull request as ready for review October 15, 2026 10:17
Pduhard and others added 2 commits October 22, 2026 16:28
…s them

vp lint and vp fmt resolved oxlint, oxlint-tsgolint and oxfmt from
process.cwd() first, and Node walks up to the filesystem root. A project
that does not install these tools itself picked up any copy in a parent
directory, such as the main checkout around a git worktree. That copy
can be an older oxlint that predates Vite+ mode: it walks nested configs
past the project and applies the parent's .oxlintrc.json, so every
lint.overrides entry in vite.config.ts is ignored.

The project's copy now runs only when the nearest package.json or the
workspace root declares it, and it is installed between that package and
the workspace root, the rule resolve-core already applies to Vite.
Otherwise the copy shipped with the CLI runs. Yarn PnP resolves the
declared copy through its own resolver.

findWorkspaceRoot moves to utils/workspace-root.ts, next to findPackageRoot
and dirsUpTo, so the lint and fmt resolvers do not load Vite.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Read the nearest package.json with readNearestPackageJson and resolve with createRequire, as resolve-core does for Vite, which also covers Yarn PnP. Find the workspace root with findMonorepoRoot, as resolve-vite-config does. Drop dirsUpTo, findPackageRoot, the PnP branch and the installed-between check; keep one regression test through lint() plus the rule's own spec.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Pduhard
Pduhard force-pushed the fix/resolve-oxlint-inside-project branch from 4bd9e57 to da7a6a8 Compare October 22, 2026 14:36

This branch has not been deployed

No deployments
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.

vp lint / vp fmt run oxlint/oxfmt from a parent directory instead of the bundled one

1 participant