Skip to content

Commit 20559a0

Browse files
committed
feat(check): support --disable-nested-config flag
Forward the flag to oxlint only; silently ignored for fmt since oxfmt does not support it.
1 parent 48e49ca commit 20559a0

File tree

5 files changed

+36
-14
lines changed

5 files changed

+36
-14
lines changed

crates/vite_global_cli/src/help.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,10 @@ fn delegated_help_doc(command: &str) -> Option<HelpDoc> {
760760
row("--fix", "Auto-fix format and lint issues"),
761761
row("--no-fmt", "Skip format check"),
762762
row("--no-lint", "Skip lint check"),
763+
row(
764+
"--disable-nested-config",
765+
"Disable the automatic loading of nested configuration files (lint only)",
766+
),
763767
row("-h, --help", "Print help"),
764768
],
765769
),

packages/cli/binding/src/check/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub(crate) async fn execute_check(
2222
fix: bool,
2323
no_fmt: bool,
2424
no_lint: bool,
25+
disable_nested_config: bool,
2526
paths: Vec<String>,
2627
envs: &Arc<FxHashMap<Arc<OsStr>, Arc<OsStr>>>,
2728
cwd: &AbsolutePathBuf,
@@ -127,6 +128,9 @@ pub(crate) async fn execute_check(
127128
// parser think linting never started. Force the default reporter here so the
128129
// captured output is stable across local and CI environments.
129130
args.push("--format=default".to_string());
131+
if disable_nested_config {
132+
args.push("--disable-nested-config".to_string());
133+
}
130134
if has_paths {
131135
args.extend(paths.iter().cloned());
132136
}

packages/cli/binding/src/cli/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,17 @@ async fn execute_direct_subcommand(
6363
let cwd_arc: Arc<AbsolutePath> = cwd.clone().into();
6464

6565
let status = match subcommand {
66-
SynthesizableSubcommand::Check { fix, no_fmt, no_lint, paths } => {
66+
SynthesizableSubcommand::Check { fix, no_fmt, no_lint, disable_nested_config, paths } => {
6767
return crate::check::execute_check(
68-
&resolver, fix, no_fmt, no_lint, paths, &envs, cwd, &cwd_arc,
68+
&resolver,
69+
fix,
70+
no_fmt,
71+
no_lint,
72+
disable_nested_config,
73+
paths,
74+
&envs,
75+
cwd,
76+
&cwd_arc,
6977
)
7078
.await;
7179
}

packages/cli/binding/src/cli/types.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ pub enum SynthesizableSubcommand {
9393
/// Skip lint check
9494
#[arg(long = "no-lint")]
9595
no_lint: bool,
96+
/// Disable the automatic loading of nested configuration files (forwarded to lint; ignored by fmt)
97+
#[arg(long)]
98+
disable_nested_config: bool,
9699
/// File paths to check (passed through to fmt and lint)
97100
#[arg(trailing_var_arg = true)]
98101
paths: Vec<String>,

packages/cli/snap-tests-global/command-check-help/snap.txt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ Usage: vp check [OPTIONS] [PATHS]...
66
Run format, lint, and type checks.
77

88
Options:
9-
--fix Auto-fix format and lint issues
10-
--no-fmt Skip format check
11-
--no-lint Skip lint check
12-
-h, --help Print help
9+
--fix Auto-fix format and lint issues
10+
--no-fmt Skip format check
11+
--no-lint Skip lint check
12+
--disable-nested-config Disable the automatic loading of nested configuration files (lint only)
13+
-h, --help Print help
1314

1415
Examples:
1516
vp check
@@ -27,10 +28,11 @@ Usage: vp check [OPTIONS] [PATHS]...
2728
Run format, lint, and type checks.
2829

2930
Options:
30-
--fix Auto-fix format and lint issues
31-
--no-fmt Skip format check
32-
--no-lint Skip lint check
33-
-h, --help Print help
31+
--fix Auto-fix format and lint issues
32+
--no-fmt Skip format check
33+
--no-lint Skip lint check
34+
--disable-nested-config Disable the automatic loading of nested configuration files (lint only)
35+
-h, --help Print help
3436

3537
Examples:
3638
vp check
@@ -48,10 +50,11 @@ Usage: vp check [OPTIONS] [PATHS]...
4850
Run format, lint, and type checks.
4951

5052
Options:
51-
--fix Auto-fix format and lint issues
52-
--no-fmt Skip format check
53-
--no-lint Skip lint check
54-
-h, --help Print help
53+
--fix Auto-fix format and lint issues
54+
--no-fmt Skip format check
55+
--no-lint Skip lint check
56+
--disable-nested-config Disable the automatic loading of nested configuration files (lint only)
57+
-h, --help Print help
5558

5659
Examples:
5760
vp check

0 commit comments

Comments
 (0)