From 46b084a651094e0914128174c3ee134a38c7c609 Mon Sep 17 00:00:00 2001 From: romano <229324643+ruidosujeira@users.noreply.github.com> Date: Fri, 19 Dec 2025 19:30:39 -0300 Subject: [PATCH 1/4] (fix)glob patterns are now resolved relative to the project's root directory instead of the current package directory. --- .changeset/fix-monorepo-glob-resolution.md | 7 +++++++ crates/biome_service/src/workspace/server.rs | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 .changeset/fix-monorepo-glob-resolution.md diff --git a/.changeset/fix-monorepo-glob-resolution.md b/.changeset/fix-monorepo-glob-resolution.md new file mode 100644 index 000000000000..c5def5af7b09 --- /dev/null +++ b/.changeset/fix-monorepo-glob-resolution.md @@ -0,0 +1,7 @@ +--- +"@biomejs/biome": patch +--- + +Fixed [#8518](https://github.com/biomejs/biome/issues/8518), where globally excluded files in a monorepo were still being processed when using `"extends": "//"`. + +When a package-level configuration extends the root configuration with `"extends": "//"`, glob patterns (such as those in `files.includes`) are now correctly resolved relative to the project root directory, instead of the current workspace directory. diff --git a/crates/biome_service/src/workspace/server.rs b/crates/biome_service/src/workspace/server.rs index 41fcd6975562..6506e8bbe215 100644 --- a/crates/biome_service/src/workspace/server.rs +++ b/crates/biome_service/src/workspace/server.rs @@ -1074,6 +1074,7 @@ impl Workspace for WorkspaceServer { let mut diagnostics: Vec = vec![]; let workspace_directory = workspace_directory.map(|p| p.to_path_buf()); let is_root = configuration.is_root(); + let extends_root = configuration.extends_root(); let mut settings = if !is_root { if !self.projects.is_project_registered(project_key) { return Err(WorkspaceError::no_project()); @@ -1092,9 +1093,14 @@ impl Workspace for WorkspaceServer { .ok_or_else(WorkspaceError::no_project)? }; + let resolution_directory = if extends_root { + self.projects.get_project_path(project_key) + } else { + workspace_directory.clone() + }; settings.merge_with_configuration( configuration, - workspace_directory.clone(), + resolution_directory.clone(), extended_configurations .into_iter() .map(|(path, config)| (path.into(), config)) @@ -1102,7 +1108,7 @@ impl Workspace for WorkspaceServer { )?; let plugin_diagnostics = self.load_plugins( - &workspace_directory.clone().unwrap_or_default(), + &resolution_directory.clone().unwrap_or_default(), &settings.as_all_plugins(), ); From f22b68e32adb2543a724993f7ea3036031fb863f Mon Sep 17 00:00:00 2001 From: romano <229324643+ruidosujeira@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:19:40 -0300 Subject: [PATCH 2/4] test(service): add regression test for extends root glob resolution --- .../src/workspace/server.tests.rs | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/crates/biome_service/src/workspace/server.tests.rs b/crates/biome_service/src/workspace/server.tests.rs index 208d3c77dc46..4cea931927df 100644 --- a/crates/biome_service/src/workspace/server.tests.rs +++ b/crates/biome_service/src/workspace/server.tests.rs @@ -2,8 +2,10 @@ use biome_configuration::{ FormatterConfiguration, JsConfiguration, javascript::{JsFormatterConfiguration, JsParserConfiguration}, }; +use biome_deserialize::json::deserialize_from_json_str; use biome_formatter::{IndentStyle, LineWidth}; use biome_fs::MemoryFileSystem; +use biome_json_parser::JsonParserOptions; use biome_rowan::TextSize; use crate::test_utils::setup_workspace_and_open_project; @@ -471,3 +473,64 @@ fn pull_diagnostics_and_actions_for_js_file() { insta::assert_debug_snapshot!(result) } + +#[test] +fn extends_root_resolves_globs_from_project_root() { + const NESTED_CONFIGURATION: &str = r#" + { + "extends": "//", + "files": { + "includes": ["./packages/pkg-a/src/**"] + } + } + "#; + + let fs = MemoryFileSystem::default(); + fs.insert(Utf8PathBuf::from("/project/packages/pkg-a/src/index.ts"), b"const a = 1;"); + fs.insert( + Utf8PathBuf::from("/project/packages/pkg-a/tests/index.ts"), + b"const a = 1;", + ); + + let (workspace, project_key) = setup_workspace_and_open_project(fs, "/project"); + + let configuration = deserialize_from_json_str::( + NESTED_CONFIGURATION, + JsonParserOptions::default().with_allow_comments(), + "biome.jsonc", + ) + .into_deserialized() + .expect("valid nested config"); + + workspace + .update_settings(UpdateSettingsParams { + project_key, + configuration, + workspace_directory: Some(BiomePath::new("/project/packages/pkg-a")), + }) + .unwrap(); + + let src_is_ignored = workspace + .is_path_ignored(PathIsIgnoredParams { + project_key, + path: BiomePath::new("/project/packages/pkg-a/src/index.ts"), + features: FeatureName::empty(), + ignore_kind: IgnoreKind::Path, + }) + .unwrap(); + + let tests_is_ignored = workspace + .is_path_ignored(PathIsIgnoredParams { + project_key, + path: BiomePath::new("/project/packages/pkg-a/tests/index.ts"), + features: FeatureName::empty(), + ignore_kind: IgnoreKind::Path, + }) + .unwrap(); + + assert!( + !src_is_ignored, + "src file should be included when glob is resolved from project root" + ); + assert!(tests_is_ignored, "file outside includes should be ignored"); +} From e75e1bc0be549d47dabbeeec42ccbd2d0fe0bdf0 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 15:40:15 +0000 Subject: [PATCH 3/4] [autofix.ci] apply automated fixes --- crates/biome_service/src/workspace/server.tests.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/biome_service/src/workspace/server.tests.rs b/crates/biome_service/src/workspace/server.tests.rs index 4cea931927df..b42f0586780c 100644 --- a/crates/biome_service/src/workspace/server.tests.rs +++ b/crates/biome_service/src/workspace/server.tests.rs @@ -486,7 +486,10 @@ fn extends_root_resolves_globs_from_project_root() { "#; let fs = MemoryFileSystem::default(); - fs.insert(Utf8PathBuf::from("/project/packages/pkg-a/src/index.ts"), b"const a = 1;"); + fs.insert( + Utf8PathBuf::from("/project/packages/pkg-a/src/index.ts"), + b"const a = 1;", + ); fs.insert( Utf8PathBuf::from("/project/packages/pkg-a/tests/index.ts"), b"const a = 1;", From 45c011e2ad40b9e2748b0cd2c24a05e74c42186d Mon Sep 17 00:00:00 2001 From: romano <229324643+ruidosujeira@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:57:19 -0300 Subject: [PATCH 4/4] test(service): include extended_configurations in update settings params --- crates/biome_service/src/workspace/server.tests.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/biome_service/src/workspace/server.tests.rs b/crates/biome_service/src/workspace/server.tests.rs index b42f0586780c..c617463aa8e6 100644 --- a/crates/biome_service/src/workspace/server.tests.rs +++ b/crates/biome_service/src/workspace/server.tests.rs @@ -510,6 +510,7 @@ fn extends_root_resolves_globs_from_project_root() { project_key, configuration, workspace_directory: Some(BiomePath::new("/project/packages/pkg-a")), + extended_configurations: Default::default(), }) .unwrap();