From a2c2595fb02b01b0278cfc3c042bf851af5bb6ed Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Fri, 21 Nov 2025 10:48:17 +0000 Subject: [PATCH 1/3] fix(cli): make config-path absolute --- .changeset/bumpy-months-draw.md | 7 +++++++ crates/biome_cli/src/cli_options.rs | 9 ++++++--- crates/biome_cli/src/commands/mod.rs | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .changeset/bumpy-months-draw.md diff --git a/.changeset/bumpy-months-draw.md b/.changeset/bumpy-months-draw.md new file mode 100644 index 000000000000..09fd6262a118 --- /dev/null +++ b/.changeset/bumpy-months-draw.md @@ -0,0 +1,7 @@ +--- +"@biomejs/biome": patch +--- + +Fixed [#7390](https://github.com/biomejs/biome/issues/7390), where Biome couldn't apply the correct configuration passed via `--config-path`. + +Now if you have multiple **root** configuration files, running any command with `--config-path` will apply the chose configuration file. diff --git a/crates/biome_cli/src/cli_options.rs b/crates/biome_cli/src/cli_options.rs index 79ad1001d081..47322103420b 100644 --- a/crates/biome_cli/src/cli_options.rs +++ b/crates/biome_cli/src/cli_options.rs @@ -3,7 +3,7 @@ use crate::logging::LoggingKind; use biome_configuration::ConfigurationPathHint; use biome_diagnostics::Severity; use bpaf::Bpaf; -use camino::Utf8PathBuf; +use camino::{Utf8Path, Utf8PathBuf}; use std::fmt::{Display, Formatter}; use std::str::FromStr; @@ -100,13 +100,16 @@ pub struct CliOptions { impl CliOptions { /// Computes the [ConfigurationPathHint] based on the options passed by the user - pub(crate) fn as_configuration_path_hint(&self) -> ConfigurationPathHint { + pub(crate) fn as_configuration_path_hint( + &self, + working_directory: &Utf8Path, + ) -> ConfigurationPathHint { match self.config_path.as_ref() { None => ConfigurationPathHint::default(), Some(path) => { let path = Utf8PathBuf::from(path); let path = path.strip_prefix("./").unwrap_or(&path); - ConfigurationPathHint::FromUser(path.to_path_buf()) + ConfigurationPathHint::FromUser(working_directory.join(path)) } } } diff --git a/crates/biome_cli/src/commands/mod.rs b/crates/biome_cli/src/commands/mod.rs index 9ebad78f51b3..80040c0b4628 100644 --- a/crates/biome_cli/src/commands/mod.rs +++ b/crates/biome_cli/src/commands/mod.rs @@ -939,8 +939,9 @@ pub(crate) trait CommandRunner: Sized { workspace: &dyn Workspace, cli_options: &CliOptions, ) -> Result { + let working_dir = fs.working_directory().unwrap_or_default(); // Load configuration - let configuration_path_hint = cli_options.as_configuration_path_hint(); + let configuration_path_hint = cli_options.as_configuration_path_hint(working_dir.as_path()); let loaded_configuration = load_configuration(fs, configuration_path_hint)?; if self.should_validate_configuration_diagnostics() { validate_configuration_diagnostics( @@ -961,7 +962,6 @@ pub(crate) trait CommandRunner: Sized { let execution = self.get_execution(cli_options, console, workspace)?; - let working_dir = fs.working_directory().unwrap_or_default(); let root_configuration_dir = configuration_dir_path .clone() .unwrap_or_else(|| working_dir.clone()); From 2c1a124706474620db1a9d2220537038951600f1 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Fri, 21 Nov 2025 10:57:51 +0000 Subject: [PATCH 2/3] fix(cli): make config-path absolute --- .changeset/bumpy-months-draw.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/bumpy-months-draw.md b/.changeset/bumpy-months-draw.md index 09fd6262a118..b3f14c630cb3 100644 --- a/.changeset/bumpy-months-draw.md +++ b/.changeset/bumpy-months-draw.md @@ -4,4 +4,4 @@ Fixed [#7390](https://github.com/biomejs/biome/issues/7390), where Biome couldn't apply the correct configuration passed via `--config-path`. -Now if you have multiple **root** configuration files, running any command with `--config-path` will apply the chose configuration file. +If you have multiple **root** configuration files, running any command with `--config-path` will now apply the chosen configuration file. From 55ef1100ce63032cbc13aa6570844a52f5fa406f Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Fri, 21 Nov 2025 11:03:16 +0000 Subject: [PATCH 3/3] handle possible path being absolute --- crates/biome_cli/src/cli_options.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/biome_cli/src/cli_options.rs b/crates/biome_cli/src/cli_options.rs index 47322103420b..aa1a842c79fe 100644 --- a/crates/biome_cli/src/cli_options.rs +++ b/crates/biome_cli/src/cli_options.rs @@ -109,7 +109,11 @@ impl CliOptions { Some(path) => { let path = Utf8PathBuf::from(path); let path = path.strip_prefix("./").unwrap_or(&path); - ConfigurationPathHint::FromUser(working_directory.join(path)) + if path.is_absolute() { + ConfigurationPathHint::FromUser(path.to_path_buf()) + } else { + ConfigurationPathHint::FromUser(working_directory.join(path)) + } } } }