Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/bumpy-months-draw.md
Original file line number Diff line number Diff line change
@@ -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`.

If you have multiple **root** configuration files, running any command with `--config-path` will now apply the chosen configuration file.
13 changes: 10 additions & 3 deletions crates/biome_cli/src/cli_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -100,13 +100,20 @@ 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())
if path.is_absolute() {
ConfigurationPathHint::FromUser(path.to_path_buf())
} else {
ConfigurationPathHint::FromUser(working_directory.join(path))
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,9 @@ pub(crate) trait CommandRunner: Sized {
workspace: &dyn Workspace,
cli_options: &CliOptions,
) -> Result<ConfiguredWorkspace, CliDiagnostic> {
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(
Expand All @@ -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());
Expand Down