From 177b6a359145265ada71feb994a064b625a2929a Mon Sep 17 00:00:00 2001 From: MK Date: Tue, 14 Apr 2026 15:14:38 +0800 Subject: [PATCH] feat(check): support `--disable-nested-config` flag Forward the flag to oxlint only; silently ignored for fmt since oxfmt does not support it. --- crates/vite_global_cli/src/help.rs | 4 +++ packages/cli/binding/src/check/mod.rs | 4 +++ packages/cli/binding/src/cli/mod.rs | 12 +++++++-- packages/cli/binding/src/cli/types.rs | 3 +++ .../command-check-help/snap.txt | 27 ++++++++++--------- 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/crates/vite_global_cli/src/help.rs b/crates/vite_global_cli/src/help.rs index 55767b0d56..56c6715ce4 100644 --- a/crates/vite_global_cli/src/help.rs +++ b/crates/vite_global_cli/src/help.rs @@ -760,6 +760,10 @@ fn delegated_help_doc(command: &str) -> Option { row("--fix", "Auto-fix format and lint issues"), row("--no-fmt", "Skip format check"), row("--no-lint", "Skip lint check"), + row( + "--disable-nested-config", + "Disable the automatic loading of nested configuration files (lint only)", + ), row("-h, --help", "Print help"), ], ), diff --git a/packages/cli/binding/src/check/mod.rs b/packages/cli/binding/src/check/mod.rs index d166723e19..62efc8348d 100644 --- a/packages/cli/binding/src/check/mod.rs +++ b/packages/cli/binding/src/check/mod.rs @@ -22,6 +22,7 @@ pub(crate) async fn execute_check( fix: bool, no_fmt: bool, no_lint: bool, + disable_nested_config: bool, paths: Vec, envs: &Arc, Arc>>, cwd: &AbsolutePathBuf, @@ -127,6 +128,9 @@ pub(crate) async fn execute_check( // parser think linting never started. Force the default reporter here so the // captured output is stable across local and CI environments. args.push("--format=default".to_string()); + if disable_nested_config { + args.push("--disable-nested-config".to_string()); + } if has_paths { args.extend(paths.iter().cloned()); } diff --git a/packages/cli/binding/src/cli/mod.rs b/packages/cli/binding/src/cli/mod.rs index 5811ef75bc..c6f91fa404 100644 --- a/packages/cli/binding/src/cli/mod.rs +++ b/packages/cli/binding/src/cli/mod.rs @@ -63,9 +63,17 @@ async fn execute_direct_subcommand( let cwd_arc: Arc = cwd.clone().into(); let status = match subcommand { - SynthesizableSubcommand::Check { fix, no_fmt, no_lint, paths } => { + SynthesizableSubcommand::Check { fix, no_fmt, no_lint, disable_nested_config, paths } => { return crate::check::execute_check( - &resolver, fix, no_fmt, no_lint, paths, &envs, cwd, &cwd_arc, + &resolver, + fix, + no_fmt, + no_lint, + disable_nested_config, + paths, + &envs, + cwd, + &cwd_arc, ) .await; } diff --git a/packages/cli/binding/src/cli/types.rs b/packages/cli/binding/src/cli/types.rs index 6e408460b6..52e29f6f34 100644 --- a/packages/cli/binding/src/cli/types.rs +++ b/packages/cli/binding/src/cli/types.rs @@ -93,6 +93,9 @@ pub enum SynthesizableSubcommand { /// Skip lint check #[arg(long = "no-lint")] no_lint: bool, + /// Disable the automatic loading of nested configuration files (forwarded to lint; ignored by fmt) + #[arg(long)] + disable_nested_config: bool, /// File paths to check (passed through to fmt and lint) #[arg(trailing_var_arg = true)] paths: Vec, diff --git a/packages/cli/snap-tests-global/command-check-help/snap.txt b/packages/cli/snap-tests-global/command-check-help/snap.txt index acfb446b24..a9815c769c 100644 --- a/packages/cli/snap-tests-global/command-check-help/snap.txt +++ b/packages/cli/snap-tests-global/command-check-help/snap.txt @@ -6,10 +6,11 @@ Usage: vp check [OPTIONS] [PATHS]... Run format, lint, and type checks. Options: - --fix Auto-fix format and lint issues - --no-fmt Skip format check - --no-lint Skip lint check - -h, --help Print help + --fix Auto-fix format and lint issues + --no-fmt Skip format check + --no-lint Skip lint check + --disable-nested-config Disable the automatic loading of nested configuration files (lint only) + -h, --help Print help Examples: vp check @@ -27,10 +28,11 @@ Usage: vp check [OPTIONS] [PATHS]... Run format, lint, and type checks. Options: - --fix Auto-fix format and lint issues - --no-fmt Skip format check - --no-lint Skip lint check - -h, --help Print help + --fix Auto-fix format and lint issues + --no-fmt Skip format check + --no-lint Skip lint check + --disable-nested-config Disable the automatic loading of nested configuration files (lint only) + -h, --help Print help Examples: vp check @@ -48,10 +50,11 @@ Usage: vp check [OPTIONS] [PATHS]... Run format, lint, and type checks. Options: - --fix Auto-fix format and lint issues - --no-fmt Skip format check - --no-lint Skip lint check - -h, --help Print help + --fix Auto-fix format and lint issues + --no-fmt Skip format check + --no-lint Skip lint check + --disable-nested-config Disable the automatic loading of nested configuration files (lint only) + -h, --help Print help Examples: vp check