Skip to content

lint(oxlint): forbid node:path in favor of pathe - #184

Merged
cpojer merged 2 commits into
mainfrom
lint/no-node-path
May 6, 2026
Merged

cpojer merged 2 commits into
mainfrom
lint/no-node-path

Conversation

@TheAlexLichter

@TheAlexLichter TheAlexLichter commented May 5, 2026 •

Copy link
Copy Markdown
Member

Summary

node:path returns OS-native separators, which silently breaks any path that ends up embedded in a module specifier, generated source, or compared against Vite's normalized watcher paths. The Windows unit-test regression fixed in #183 is the latest example, and there's nothing stopping us from re-introducing it.

This PR adds an oxlint no-restricted-imports rule that flags node:path (and bare path) and points contributors at pathe. Explicit format work is still allowed via node:path/win32 or node:path/posix as those are different specifiers and have format-specific semantics.

`node:path` returns OS-native separators, which breaks any path that
ends up embedded in a module specifier, generated source, or compared
against Vite's normalized watcher paths — the Windows unit-test
regression in #183 was the latest example. `pathe` is a drop-in
replacement that always emits forward slashes; we already use it
throughout the source.

Add an oxlint `no-restricted-imports` rule that flags `node:path`
(and bare `path`) and points violators at pathe. Explicit format
work is still allowed via `node:path/win32` or `node:path/posix`.

Migrate all 145 remaining imports to `pathe` and add the dep to the
five packages/playgrounds that didn't already have it.
@TheAlexLichter TheAlexLichter changed the title lint(oxlint): forbid node:path in favor of pathe lint(oxlint): forbid node:path in favor of pathe May 5, 2026
@TheAlexLichter
TheAlexLichter marked this pull request as draft May 5, 2026 16:41
create-void ships a single bundled `dist/index.mjs` and has no
runtime `dependencies` — every transitive import has to be listed
in `deps.onlyBundle` for tsdown to inline it. Add `pathe` so the
build doesn't fail with 'located in node_modules but not included
in deps.onlyBundle'.
@TheAlexLichter
TheAlexLichter marked this pull request as ready for review May 5, 2026 16:44
Comment thread .oxlintrc.json
Comment on lines +172 to +176
"message": "Use `pathe` instead. It re-exports the same API but always emits forward slashes, which avoids cross-platform breakage when paths are embedded in module specifiers, generated source, or compared against Vite's normalized watcher events. If you genuinely need format-specific behavior, import `node:path/win32` or `node:path/posix` explicitly."
},
{
"name": "path",
"message": "Use `pathe` instead of the unprefixed `path` import (and prefer `node:path/win32` / `node:path/posix` for explicit format-specific behavior)."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unsure why the message is different for both 🤷‍♂️

@cpojer
cpojer merged commit 147f2e8 into main May 6, 2026
9 checks passed
@cpojer
cpojer deleted the lint/no-node-path branch May 6, 2026 00:10
cpojer pushed a commit that referenced this pull request Sep 11, 2026
…lowlist) (#184)

#183 bumped only the vite-plus CLI to ^0.2.0; two follow-ups were missing.

1. Catalog aliases. Vite+ 0.2 dropped the separate @voidzero-dev/vite-plus-test
   package (npm latest is 0.1.24, no 0.2.x) and now bundles upstream
   vitest@4.1.9 directly. The catalog still pointed vite/vitest at the old
   0.1.x packaging, so `vp test run` could not launch ("Could not find
   'vitest' bin entry"). Point vite -> @voidzero-dev/vite-plus-core@0.2.0 and
   vitest -> 4.1.9.

2. minimumReleaseAge. The freshly-published 0.2.0 first-party packages were
   rejected by pnpm's supply-chain age check, breaking
   `vp install --frozen-lockfile` in CI. Exclude the org's own scopes (the
   list Vite+ `vp config` maintains automatically); third-party stays gated.
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.

2 participants