Skip to content

Commit 496cfca

Browse files
committed
test(snap): add nested-oxc-config-proj-1 to reproduce nested vite.config.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
1 parent a2da29e commit 496cfca

File tree

9 files changed

+93
-0
lines changed

9 files changed

+93
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "nested-oxc-config-proj-1-test",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"packageManager": "pnpm@10.16.1"
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "proj-1",
3+
"version": "0.0.0",
4+
"private": true
5+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function hello() {
2+
debugger;
3+
return 'hello from proj-1';
4+
}
5+
6+
export { hello };
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Nested proj-1 config: relaxes the root's strict rules.
2+
// Running `vp lint` / `vp fmt` from packages/proj-1 should pick this up
3+
// (matching oxc-project/oxc#20416), but currently the root config is used instead.
4+
export default {
5+
lint: {
6+
rules: {
7+
'no-debugger': 'off',
8+
},
9+
},
10+
fmt: {
11+
singleQuote: false,
12+
},
13+
};

packages/cli/snap-tests/nested-oxc-config-proj-1/pnpm-lock.yaml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages:
2+
- 'packages/*'
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
> # Reproduces oxc-project/oxc#20416: nested vite.config.ts in packages/proj-1
2+
> # should override root config when `vp lint` / `vp fmt` run from that cwd.
3+
> # proj-1 disables no-debugger and turns off singleQuote, so both commands
4+
> # should pass. If the root config leaks through, lint reports a debugger
5+
> # violation and fmt reports a quote-style diff.
6+
[1]> cd packages/proj-1 && vp lint # expected: pass (proj-1 disables no-debugger); actual: fails with root rule
7+
8+
× eslint(no-debugger): `debugger` statement is not allowed
9+
╭─[src/index.js:2:3]
10+
1 │ function hello() {
11+
2 │ debugger;
12+
· ─────────
13+
3 │ return "hello from proj-1";
14+
╰────
15+
help: Remove the debugger statement
16+
17+
Found 0 warnings and 1 error.
18+
Finished in <variable>ms on 2 files with <variable> rules using <variable> threads.
19+
20+
[1]> cd packages/proj-1 && vp fmt --check # expected: pass (proj-1 sets singleQuote:false); actual: fails with root singleQuote:true
21+
Checking formatting...
22+
src/index.js (<variable>ms)
23+
24+
Format issues found in above 1 files. Run without `--check` to fix.
25+
Finished in <variable>ms on 3 files using <variable> threads.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"ignoredPlatforms": ["win32"],
3+
"commands": [
4+
"# Reproduces oxc-project/oxc#20416: nested vite.config.ts in packages/proj-1",
5+
"# should override root config when `vp lint` / `vp fmt` run from that cwd.",
6+
"# proj-1 disables no-debugger and turns off singleQuote, so both commands",
7+
"# should pass. If the root config leaks through, lint reports a debugger",
8+
"# violation and fmt reports a quote-style diff.",
9+
"cd packages/proj-1 && vp lint # expected: pass (proj-1 disables no-debugger); actual: fails with root rule",
10+
"cd packages/proj-1 && vp fmt --check # expected: pass (proj-1 sets singleQuote:false); actual: fails with root singleQuote:true"
11+
]
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Root config: strict rules that should NOT apply when running from packages/proj-1.
2+
// If proj-1's nested vite.config.ts is loaded correctly, these rules are overridden.
3+
export default {
4+
lint: {
5+
rules: {
6+
'no-debugger': 'error',
7+
},
8+
},
9+
fmt: {
10+
singleQuote: true,
11+
},
12+
};

0 commit comments

Comments
 (0)