You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Drop oxlint/oxfmt internals from the user-facing guide, lead with the
three rules (default cwd resolution, `-c` pins, `--disable-nested-config`),
and replace the per-cwd bullet lists with tables. Also drop the unverified
`typeAware`/`typeCheck` root-only caveat — current code does not enforce it.
Copy file name to clipboardExpand all lines: docs/guide/nested-config.md
+41-32Lines changed: 41 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,29 @@
1
1
# Nested Configuration
2
2
3
-
Vite+ supports multiple `vite.config.ts` files in the same repository, so packages in a monorepo can have their own lint and format settings while sharing a baseline.
3
+
Vite+ supports multiple `vite.config.ts` files in a repository, so packages in a monorepo can have their own lint and format settings while sharing a baseline.
4
4
5
-
`vp lint` and `vp fmt`resolve configuration from the **current working directory** (cwd), but with one subtle difference:
5
+
## How `vp lint` and `vp fmt`pick a config
6
6
7
-
-**`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.
8
-
-**`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.
7
+
Config resolution is driven by the current working directory (cwd):
9
8
10
-
In both cases, the selected config applies to every path in the run.
9
+
-**`vp lint`** uses `<cwd>/vite.config.ts`. If that file is missing, built-in defaults apply — `vp lint` does **not** walk up the directory tree looking for a parent `vite.config.ts`.
10
+
-**`vp fmt`** walks up from cwd and uses the first `vite.config.ts` it finds. If none is found, built-in defaults apply.
11
11
12
-
If you only need to exclude files or folders, use [`lint.ignorePatterns`](/config/lint) or [`fmt.ignorePatterns`](/config/fmt) instead.
12
+
In both cases, the selected config applies to every path in the run — there is no per-file resolution, and configs are never merged.
13
13
14
-
## How it works
14
+
If your monorepo needs different settings per package, run `vp lint` / `vp fmt` from each package directory (for example, via `vp run -r lint`), or pin a specific config with `-c`.
15
15
16
-
Given the following structure:
16
+
If you only want to exclude files or folders from an otherwise-shared config, use [`lint.ignorePatterns`](/config/lint) or [`fmt.ignorePatterns`](/config/fmt) instead.
17
+
18
+
::: tip Breaking change since the April 2026 release
19
+
20
+
Earlier versions of Vite+ pinned every `vp lint` / `vp fmt` invocation to the workspace-root `vite.config.ts`, regardless of cwd. Vite+ now lets cwd-based resolution select the config, so running from a sub-package picks up that sub-package's own `vite.config.ts`. See [#1378](https://github.com/voidzero-dev/vite-plus/pull/1378) for the migration notes.
21
+
22
+
:::
23
+
24
+
## Example
25
+
26
+
Given this layout:
17
27
18
28
```
19
29
my-project/
@@ -29,48 +39,47 @@ my-project/
29
39
30
40
`vp lint`:
31
41
32
-
- From `my-project/` → uses `my-project/vite.config.ts` for every file (including files under `package1/` and `package2/`).
33
-
- From `my-project/package1/` → uses `my-project/package1/vite.config.ts`.
34
-
- From `my-project/package2/` → no local `vite.config.ts`, so Oxlint's built-in defaults are used.
35
-
- From `my-project/package1/src/` → no local `vite.config.ts`, so Oxlint's built-in defaults are used even though `package1/vite.config.ts` exists one level up.
If your monorepo needs different settings per package, run `vp lint` / `vp fmt` from each package directory (for example, via a `vp run -r lint` task), or pin a specific config with `-c`.
58
+
## Pinning a config with `-c`
45
59
46
-
## What to expect
60
+
`-c` / `--config` bypasses cwd-based resolution. The specified file is used for every path in the run:
47
61
48
-
Configuration files are not automatically merged. When a file is selected, it fully replaces any other config — there is no parent/child layering. To share settings, import the parent config and spread it; see the [monorepo pattern](#monorepo-pattern-share-a-base-config) below.
This also works when you need a one-off config, for example a permissive CI variant.
51
68
52
-
Passing an explicit config file location using `-c` or `--config`bypasses cwd-based resolution entirely, and only that single configuration file is used — for both `vp lint` and `vp fmt`.
69
+
## `--disable-nested-config`(lint only)
53
70
54
-
For lint, you can also pass `--disable-nested-config` to stop Oxlint from picking up any stray legacy config files that may exist in the tree:
71
+
`vp lint` accepts `--disable-nested-config` to stop any auto-loading of nested lint configuration files that may exist in the tree:
55
72
56
73
```bash
57
74
vp lint --disable-nested-config
58
75
vp check --disable-nested-config
59
76
```
60
77
61
-
There is no equivalent flag for `vp fmt`; pass `-c` if you need to pin a single format config.
62
-
63
-
`options.typeAware` and `options.typeCheck` are root-config-only. If either is set in a nested `vite.config.ts` that ends up being selected as the lint config, `vp lint` reports an error.
64
-
65
-
::: tip Breaking change since the April 2026 release
66
-
67
-
Earlier versions of Vite+ always injected the workspace-root `vite.config.ts` into every `vp lint` / `vp fmt` invocation, regardless of cwd. Vite+ now lets cwd-based resolution select the config, so running `vp lint` / `vp fmt` from inside a sub-package picks up that sub-package's own `vite.config.ts`. See [#1378](https://github.com/voidzero-dev/vite-plus/pull/1378) for the migration notes.
68
-
69
-
:::
78
+
This flag has no effect on `vite.config.ts` resolution, which is already cwd-only for `vp lint`. `vp fmt` has no equivalent flag; use `-c` to pin a single format config.
70
79
71
80
## Monorepo pattern: share a base config
72
81
73
-
In a monorepo, you often want one shared baseline at the root and small package-specific adjustments. Import the root `vite.config.ts` from the nested one and spread it:
82
+
Configs are never merged automatically — the selected config fully replaces any other. To share a baseline, import the parent config and spread it:
0 commit comments