fix(cli)!: stop injecting -c config so oxlint/oxfmt pick up nested vite.config.ts#1378
fix(cli)!: stop injecting -c config so oxlint/oxfmt pick up nested vite.config.ts#1378fengmk2 wants to merge 11 commits intosupport-disable-nested-configfrom
Conversation
✅ Deploy Preview for viteplus-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label auto-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
This comment was marked as resolved.
This comment was marked as resolved.
17e9ca9 to
b17614e
Compare
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e94193d. Configure here.
|
Direction makes sense, deferring to @leaysgur for approving the code changes. |
…fig.ts loading bug Mirrors the layout from oxc-project/oxc#20416: a root `vite.config.ts` plus `packages/proj-1/vite.config.ts`. Running `vp lint` / `vp fmt` from `packages/proj-1` should pick up the nested config, but the committed snap shows both commands exit with [1] applying the root config instead (root `no-debugger: error` vs proj-1 `off`, root `singleQuote: true` vs proj-1 `false`). Refs oxc-project/oxc#20416
The repo-level `vp check --fix` lint-staged hook was reformatting the snap test fixture to match the repo's own `singleQuote: true`, which erased the double-quoted string the fmt reproduction depends on. Exclude the fixture directory from the repo's `fmt.ignorePatterns` and restore the fixture source so the committed snap.txt captures both the lint and fmt failures.
oxlint 1.60.0 and oxfmt 0.45.0 auto-discover the nearest vite.config.ts from cwd up (gated by VP_VERSION, which vp injects via merge_resolved_envs_with_version and the bin wrappers). Injecting `-c <root vite.config.ts>` broke the nested-workspace case: running `vp lint` / `vp fmt` from a sub-package applied the root config instead of the sub-package's own config. Drop the -c injection from the Lint/Fmt resolver arms and propagate the now-unused resolved_vite_config parameter removal through resolve_and_execute, resolve_and_capture_output, and their callers. resolve_universal_vite_config() stays for check/mod.rs's LintMessageKind derivation. Snapshot updates: - nested-oxc-config-proj-1: both vp lint and vp fmt --check pass when run from packages/proj-1 (regression test for oxc-project/oxc#20416). - workspace-lint-subpackage: sub-package's no-console:off now wins over root's no-console:warn as documented. Closes oxc-project/oxc#20416
Add root-cwd cases that must fail under the root config's strict rules, complementing the existing proj-1 cwd cases that pass under the nested override.
The resolved config is now only consumed by LintMessageKind, so calling the JS-runtime resolver unconditionally wasted a NAPI round-trip on `vp check --no-lint` and fmt-only paths.
Root config's `no-console: warn` should flag app-a's console.log when vp lint runs from the workspace root, complementing the existing nested-override case where the sub-workspace's `no-console: off` wins.
Documents two behaviors observed while investigating why `vp lint` at the repo root was leaking snap-test fixture diagnostics: 1. Root vite.config.ts `lint.ignorePatterns` (wildcard-prefixed) does filter files out of the lint walk when no nearer oxlint config exists — packages/ignored/src/index.js is skipped despite its console.log. 2. Nested vite.config.ts in a subpackage (packages/included/ vite.config.ts, no-console:off) is NOT consulted when cwd is the workspace root; the root's no-console:error still flags it.
11e4980 to
298df47
Compare
| "install-global-cli": "tool install-global-cli", | ||
| "tsgo": "tsgo -b tsconfig.json", | ||
| "lint": "vp lint --type-aware --type-check --threads 4", | ||
| "check": "vp check --disable-nested-config", |
There was a problem hiding this comment.
If you're asking whether that applies even when using vite.config.ts in VP mode, I think the answer is yes.
Adds a dedicated Nested Configuration guide covering how `vp lint` and `vp fmt` select a `vite.config.ts`, with an explicit note on the asymmetry between the two: `vp lint` is cwd-only, while `vp fmt` walks up until it finds a config. Cross-links it from the Lint and Format pages and the Check sidebar. Adds snap-tests/docs-nested-config to pin each documented claim (cwd walk-up for fmt, cwd-only fallback for lint, root-cwd wins over nested configs, `-c <path>` bypasses cwd resolution) so the guide stays in sync with actual behavior.
| `vp lint` and `vp fmt` resolve configuration from the **current working directory** (cwd), but with one subtle difference: | ||
|
|
||
| - **`vp lint`** — cwd-only. Uses `<cwd>/vite.config.ts` if it exists. If not, falls back to Oxlint's built-in defaults — it does **not** walk up to find an ancestor config. | ||
| - **`vp fmt`** — cwd walk-up. Walks up from cwd and uses the first `vite.config.ts` it finds. If none is found anywhere up to the filesystem root, falls back to Oxfmt defaults. |
There was a problem hiding this comment.
@leaysgur Curious why the logic of oxlint and oxfmt is different. 😢
…root Adds claim 2c/2d to probe deeper cwds where lint and fmt diverge (lint stays on oxlint defaults from pkg-a/src, fmt walks up to pkg-a's vite.config.ts), and replaces the targeted per-package lint commands in claim 3 with the bare `vp lint --threads=1` / `vp fmt --check` invocations a user would actually run. `--threads=1` keeps the multi-error output order stable across snapshot runs.


Breaking change
vp lintandvp fmtno longer inject-c <workspace-root vite.config.ts>into the underlying oxlint / oxfmt invocation.Before this PR, every invocation was pinned to the workspace-root config regardless of cwd. That defeated oxlint 1.60 / oxfmt 0.45's new nested-config auto-discovery (gated on
VP_VERSION, which vp already sets — see oxc-project/oxc#20416 / oxc-project/oxc#20417).After this PR, config selection is delegated entirely to oxlint / oxfmt:
vite.config.ts(or.oxlintrc*for lint) — nested overrides apply..oxlintrc.json/.oxlintrc.jsoncin intermediate directories. If any such file sits between cwd and the file being linted, its config wins over the root's.Migration
Repos relying on the old "root config wins everywhere" behavior need one of:
.oxlintrc*/vite.config.tsfiles from subpackages that shouldn't have their own lint/fmt scope.extendsthe root.Refs oxc-project/oxc#20416