diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ae9a34964a9..486642aee7a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -148,6 +148,8 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b ``` Contributed by @ematipico +- `biome ci` now enforces printing the output using colours. If you were previously using `--colors=force`, you can remove it because it's automatically set. Contributed by @ematipico + ### Configuration #### New features diff --git a/crates/biome_cli/src/commands/check.rs b/crates/biome_cli/src/commands/check.rs index c652dfb2798e..2647501f73df 100644 --- a/crates/biome_cli/src/commands/check.rs +++ b/crates/biome_cli/src/commands/check.rs @@ -9,10 +9,8 @@ use biome_configuration::{ organize_imports::PartialOrganizeImports, PartialConfiguration, PartialFormatterConfiguration, PartialLinterConfiguration, }; -use biome_console::{markup, ConsoleExt}; use biome_deserialize::Merge; -use biome_diagnostics::PrintDiagnostic; -use biome_service::configuration::{load_editorconfig, PartialConfigurationExt}; +use biome_service::configuration::PartialConfigurationExt; use biome_service::workspace::RegisterProjectFolderParams; use biome_service::{ configuration::{load_configuration, LoadedConfiguration}, @@ -82,34 +80,34 @@ pub(crate) fn check( session.app.console, cli_options.verbose, )?; - let fs = &session.app.fs; - let (editorconfig, editorconfig_diagnostics) = { - let search_path = loaded_configuration - .directory_path - .clone() - .unwrap_or_else(|| fs.working_directory().unwrap_or_default()); - load_editorconfig(fs, search_path)? - }; - for diagnostic in editorconfig_diagnostics { - session.app.console.error(markup! { - {PrintDiagnostic::simple(&diagnostic)} - }) - } + // let fs = &session.app.fs; + // let (editorconfig, editorconfig_diagnostics) = { + // let search_path = loaded_configuration + // .directory_path + // .clone() + // .unwrap_or_else(|| fs.working_directory().unwrap_or_default()); + // load_editorconfig(fs, search_path)? + // }; + // for diagnostic in editorconfig_diagnostics { + // session.app.console.error(markup! { + // {PrintDiagnostic::simple(&diagnostic)} + // }) + // } resolve_manifest(&session)?; let LoadedConfiguration { - configuration: biome_configuration, + configuration: mut fs_configuration, directory_path: configuration_path, .. } = loaded_configuration; - let mut fs_configuration = if let Some(mut fs_configuration) = editorconfig { - // this makes biome configuration take precedence over editorconfig configuration - fs_configuration.merge_with(biome_configuration); - fs_configuration - } else { - biome_configuration - }; + // let mut fs_configuration = if let Some(mut fs_configuration) = editorconfig { + // // this makes biome configuration take precedence over editorconfig configuration + // fs_configuration.merge_with(biome_configuration); + // fs_configuration + // } else { + // biome_configuration + // }; let formatter = fs_configuration .formatter diff --git a/crates/biome_cli/src/commands/format.rs b/crates/biome_cli/src/commands/format.rs index 48c7fcdb9acf..125ef6662c2a 100644 --- a/crates/biome_cli/src/commands/format.rs +++ b/crates/biome_cli/src/commands/format.rs @@ -15,7 +15,7 @@ use biome_console::{markup, ConsoleExt}; use biome_deserialize::Merge; use biome_diagnostics::PrintDiagnostic; use biome_service::configuration::{ - load_configuration, load_editorconfig, LoadedConfiguration, PartialConfigurationExt, + load_configuration, LoadedConfiguration, PartialConfigurationExt, }; use biome_service::workspace::{RegisterProjectFolderParams, UpdateSettingsParams}; use std::ffi::OsString; @@ -77,33 +77,33 @@ pub(crate) fn format( session.app.console, cli_options.verbose, )?; - let fs = &session.app.fs; - let (editorconfig, editorconfig_diagnostics) = { - let search_path = loaded_configuration - .directory_path - .clone() - .unwrap_or_else(|| fs.working_directory().unwrap_or_default()); - load_editorconfig(fs, search_path)? - }; - for diagnostic in editorconfig_diagnostics { - session.app.console.error(markup! { - {PrintDiagnostic::simple(&diagnostic)} - }) - } + // let fs = &session.app.fs; + // let (editorconfig, editorconfig_diagnostics) = { + // let search_path = loaded_configuration + // .directory_path + // .clone() + // .unwrap_or_else(|| fs.working_directory().unwrap_or_default()); + // load_editorconfig(fs, search_path)? + // }; + // for diagnostic in editorconfig_diagnostics { + // session.app.console.error(markup! { + // {PrintDiagnostic::simple(&diagnostic)} + // }) + // } resolve_manifest(&session)?; let LoadedConfiguration { - configuration: biome_configuration, + mut configuration, directory_path: configuration_path, .. } = loaded_configuration; - let mut configuration = if let Some(mut configuration) = editorconfig { - // this makes biome configuration take precedence over editorconfig configuration - configuration.merge_with(biome_configuration); - configuration - } else { - biome_configuration - }; + // let mut configuration = if let Some(mut configuration) = editorconfig { + // // this makes biome configuration take precedence over editorconfig configuration + // configuration.merge_with(biome_configuration); + // configuration + // } else { + // biome_configuration + // }; // TODO: remove in biome 2.0 let console = &mut *session.app.console; diff --git a/crates/biome_cli/src/main.rs b/crates/biome_cli/src/main.rs index 7f1553cfbeda..c6e6a7a20a78 100644 --- a/crates/biome_cli/src/main.rs +++ b/crates/biome_cli/src/main.rs @@ -8,7 +8,7 @@ use biome_cli::{ biome_command, open_transport, setup_panic_handler, to_color_mode, BiomeCommand, CliDiagnostic, CliSession, }; -use biome_console::{markup, ConsoleExt, EnvConsole}; +use biome_console::{markup, ColorMode, ConsoleExt, EnvConsole}; use biome_diagnostics::{set_bottom_frame, Diagnostic, PrintDiagnostic}; use biome_service::workspace; use std::process::{ExitCode, Termination}; @@ -38,7 +38,12 @@ fn main() -> ExitCode { let command = biome_command().fallback_to_usage().run(); let color_mode = to_color_mode(command.get_color()); - console.set_color(color_mode); + // we want force colours in CI, to give e better UX experience + if matches!(command, BiomeCommand::Ci { .. }) { + console.set_color(ColorMode::Enabled); + } else { + console.set_color(color_mode); + } let is_verbose = command.is_verbose(); let result = run_workspace(&mut console, command); diff --git a/crates/biome_cli/tests/cases/editorconfig.rs b/crates/biome_cli/tests/cases/editorconfig.rs index 1468716f8e8b..6c91a50425ec 100644 --- a/crates/biome_cli/tests/cases/editorconfig.rs +++ b/crates/biome_cli/tests/cases/editorconfig.rs @@ -7,6 +7,7 @@ use bpaf::Args; use std::path::Path; #[test] +#[ignore = "enable once we have the configuration to turn it on"] fn should_use_editorconfig() { let mut fs = MemoryFileSystem::default(); let mut console = BufferConsole::default(); diff --git a/crates/biome_cli/tests/snapshots/main_cases_editorconfig/should_use_editorconfig.snap b/crates/biome_cli/tests/snapshots/main_cases_editorconfig/should_use_editorconfig.snap deleted file mode 100644 index 8fc69e806831..000000000000 --- a/crates/biome_cli/tests/snapshots/main_cases_editorconfig/should_use_editorconfig.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: crates/biome_cli/tests/snap_test.rs -expression: content ---- -## `.editorconfig` - -```editorconfig - -[*] -max_line_length = 300 - -``` - -## `test.js` - -```js -console.log("really long string that should cause a break if the line width remains at the default 80 characters"); - -``` - -# Emitted Messages - -```block -Formatted 1 file in