Describe the bug
vp check --fix <path/to/file.ts> emits spurious TS2591 errors for node:* imports / process globals on some TS files when given in isolation, while the same files pass when part of a larger batch or a full-project vp check --fix.
This breaks the standard lint-staged pre-commit flow when only a single TS file from the affected directories is staged.
x typescript(TS2591): Cannot find name 'node:util'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.
,-[packages/cli/src/utils/terminal.ts:1:27]
1 | import { styleText } from 'node:util';
: ^^^^^^^^^^^
The root tsconfig.json has "types": ["node"] and @types/node is installed; the import resolves fine at runtime and in the editor.
Reproduction
On the vite-plus repo itself, current main:
# Fails: TS2591 on the node:util import
vp check --fix packages/cli/src/utils/terminal.ts
# Passes: same file, but as part of a batch of ≥3 files
vp check --fix \
packages/cli/src/utils/terminal.ts \
packages/cli/src/version.ts \
packages/cli/src/config/bin.ts
# Passes: full-project check
vp check --fix
Asymmetry between files
Not every file triggers the bug in isolation. Running vp check --fix <one-file> at repo root:
| File |
Result |
packages/cli/src/utils/terminal.ts |
FAIL |
packages/cli/src/utils/help.ts |
FAIL |
packages/cli/src/utils/agent.ts |
FAIL (5 errors) |
packages/cli/src/version.ts |
FAIL (4 errors) |
packages/cli/src/bin.ts |
PASS |
packages/cli/src/config/bin.ts |
PASS |
packages/cli/src/create/bin.ts |
PASS |
packages/cli/src/migration/bin.ts |
PASS |
packages/cli/src/staged/bin.ts |
PASS |
All of these files import from node:* modules. There is no obvious structural difference from the reporter's side.
tsgolint --list-files from the repo root lists every one of the above (both "FAIL" and "PASS" sets) — so the underlying project does include them. The bug appears only when the file is driven into oxlint+tsgolint via a single-file-subset command-line.
Hypothesis
vp check --fix <paths> forwards the paths to oxlint which then fans out to tsgolint. When a single file subset is passed, tsgolint seems to lose the tsconfig's types: ["node"] context for some files. The nearest tsconfig to packages/cli/src/** is packages/cli/tsconfig.json, which has "files": [], "include": [], "exclude": ["**/*"] — effectively excluding the whole package. The root tsconfig.json (which does provide types: ["node"]) is only found if tsgolint walks past the nearest tsconfig when its include set is empty. Whether it walks past seems to depend on which file is passed, which is what makes the behaviour feel like a tsgolint / oxlint-tsgolint project-resolution bug rather than a config issue.
Impact
The default pre-commit hook runs lint-staged → vp check --fix <staged-files>. When a developer stages a single TS file under packages/cli/src/utils/ (or any of the "FAIL" locations above), the commit is blocked by what is not a real type error.
Workarounds
- Commit with
--no-verify (loses all pre-commit validation).
- Stage at least one additional TS file from a "PASS" directory alongside the change.
Suggested direction
If tsgolint is losing types: ["node"] when invoked on a subset of project files, either:
- In oxlint-tsgolint's integration, always resolve the containing tsconfig chain up to the root before invoking tsgolint (even when explicit files are passed).
- Or in vp check, if a tsconfig in the resolution chain has
"exclude": ["**/*"] / empty include, skip past it to the next ancestor tsconfig.
- Or at minimum, expose a stable workaround users can set in
vite.config.ts so single-file checks work under lint-staged.
Steps to reproduce
- Clone vite-plus and check out current
main.
- Build and install the global CLI:
pnpm bootstrap-cli.
- From the repo root:
vp check --fix packages/cli/src/utils/terminal.ts.
- Observe
TS2591 error on line 1.
- Re-run:
vp check --fix packages/cli/src/utils/terminal.ts packages/cli/src/config/bin.ts packages/cli/src/create/bin.ts.
- Observe the same file passes cleanly.
System Info
vp v0.0.0 (current main, commit aeb40fc4)
oxlint v1.61.0
oxlint-tsgolint v0.21.1
- Node.js v22.18.0
- macOS arm64 (Darwin 25.2.0)
Used Package Manager
pnpm
Describe the bug
vp check --fix <path/to/file.ts>emits spuriousTS2591errors fornode:*imports /processglobals on some TS files when given in isolation, while the same files pass when part of a larger batch or a full-projectvp check --fix.This breaks the standard lint-staged pre-commit flow when only a single TS file from the affected directories is staged.
The root
tsconfig.jsonhas"types": ["node"]and@types/nodeis installed; the import resolves fine at runtime and in the editor.Reproduction
On the vite-plus repo itself, current
main:Asymmetry between files
Not every file triggers the bug in isolation. Running
vp check --fix <one-file>at repo root:packages/cli/src/utils/terminal.tspackages/cli/src/utils/help.tspackages/cli/src/utils/agent.tspackages/cli/src/version.tspackages/cli/src/bin.tspackages/cli/src/config/bin.tspackages/cli/src/create/bin.tspackages/cli/src/migration/bin.tspackages/cli/src/staged/bin.tsAll of these files import from
node:*modules. There is no obvious structural difference from the reporter's side.tsgolint --list-filesfrom the repo root lists every one of the above (both "FAIL" and "PASS" sets) — so the underlying project does include them. The bug appears only when the file is driven into oxlint+tsgolint via a single-file-subset command-line.Hypothesis
vp check --fix <paths>forwards the paths tooxlintwhich then fans out totsgolint. When a single file subset is passed,tsgolintseems to lose the tsconfig'stypes: ["node"]context for some files. The nearest tsconfig topackages/cli/src/**ispackages/cli/tsconfig.json, which has"files": [], "include": [], "exclude": ["**/*"]— effectively excluding the whole package. The roottsconfig.json(which does providetypes: ["node"]) is only found if tsgolint walks past the nearest tsconfig when its include set is empty. Whether it walks past seems to depend on which file is passed, which is what makes the behaviour feel like a tsgolint / oxlint-tsgolint project-resolution bug rather than a config issue.Impact
The default pre-commit hook runs lint-staged →
vp check --fix <staged-files>. When a developer stages a single TS file underpackages/cli/src/utils/(or any of the "FAIL" locations above), the commit is blocked by what is not a real type error.Workarounds
--no-verify(loses all pre-commit validation).Suggested direction
If tsgolint is losing
types: ["node"]when invoked on a subset of project files, either:"exclude": ["**/*"]/ empty include, skip past it to the next ancestor tsconfig.vite.config.tsso single-file checks work under lint-staged.Steps to reproduce
main.pnpm bootstrap-cli.vp check --fix packages/cli/src/utils/terminal.ts.TS2591error on line 1.vp check --fix packages/cli/src/utils/terminal.ts packages/cli/src/config/bin.ts packages/cli/src/create/bin.ts.System Info
vp v0.0.0(currentmain, commitaeb40fc4)oxlint v1.61.0oxlint-tsgolint v0.21.1Used Package Manager
pnpm