Skip to content

fix: resolve glob patterns relative to project root when extending#8519

Merged
ematipico merged 5 commits intobiomejs:mainfrom
ruidosujeira:fix/monorepo-glob-resolution-8518
Feb 11, 2026
Merged

fix: resolve glob patterns relative to project root when extending#8519
ematipico merged 5 commits intobiomejs:mainfrom
ruidosujeira:fix/monorepo-glob-resolution-8518

Conversation

@ruidosujeira
Copy link
Contributor

Summary

Fixes #8518

When using "extends": "//" in monorepo packages, glob patterns from the root config are now resolved relative to the project root instead of the package directory.

Before: "!packages/*/lib/**" in root config → evaluated from package dir → didn't work
After: "!packages/*/lib/**" in root config → evaluated from root dir → works correctly

AI Assistance Notice:
This PR was developed with assistance from Claude (Anthropic).

Test Plan

  1. Tested against reproduction case: https://github.com/brandonw/biome-repro-1766175331469
  2. Verified exclusion patterns now work correctly in monorepo setups
  3. Added unit tests for glob resolution with extends_root
  4. Confirmed backward compatibility with non-monorepo configs

Docs

No documentation changes needed - bug fix for existing behavior.

@changeset-bot
Copy link

changeset-bot bot commented Dec 19, 2025

🦋 Changeset detected

Latest commit: 45c011e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the A-Project Area: project label Dec 19, 2025
@ruidosujeira ruidosujeira changed the title (fix) glob patterns are now resolved relative to the project's fix: resolve glob patterns relative to project root when extending Dec 19, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This change makes workspace settings resolution use resolution_directory when a package uses "extends": "//" in a monorepo. resolution_directory is the project path if extends_root is true, otherwise the workspace directory. update_settings now uses resolution_directory for both merging configuration and loading plugins instead of the prior loading_directory. A unit test was added to verify that include/exclude glob patterns are resolved from the project (root) directory.

Possibly related PRs

Suggested reviewers

  • dyc3
  • ematipico
  • siketyan
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main change: fixing glob pattern resolution to use the project root when extending root configuration in monorepos.
Description check ✅ Passed The description clearly relates to the changeset, explaining the monorepo glob resolution fix with before/after examples and a comprehensive test plan.
Linked Issues check ✅ Passed The changes directly address issue #8518 by fixing glob resolution in monorepos. The code modifications ensure globally excluded files are properly resolved relative to the project root when using 'extends: //' [#8518].
Out of Scope Changes check ✅ Passed All changes are scoped to the monorepo glob resolution fix: changelog entry, configuration resolution logic, and targeted test coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
crates/biome_service/src/workspace/server.tests.rs (1)

508-515: Consider adding a negative test case (non-extends-root) for contrast.

This test proves globs resolve from the project root with "extends": "//", but a companion test showing the old behaviour (globs resolve from workspace_directory without extends) would strengthen confidence that the branching logic is correct and prevent regressions in either direction.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
crates/biome_service/src/workspace/server.rs (1)

1016-1021: Consider reducing allocations from cloning resolution_directory.

resolution_directory is cloned on both line 1016 and line 1019. Consider:

  • Using as_ref() where possible to avoid clones
  • On line 1019, the pattern .clone().unwrap_or_default() could potentially be simplified depending on load_plugins' signature
💡 Potential optimisation

If load_plugins accepts &Utf8Path instead of &Utf8PathBuf, you could write:

-        let plugin_diagnostics = self.load_plugins(
-            &resolution_directory.clone().unwrap_or_default(),
+        let plugin_diagnostics = self.load_plugins(
+            resolution_directory.as_ref().map(|p| p.as_path()).unwrap_or(Utf8Path::new("")),
             &settings.as_all_plugins(),
         );

And for line 1016, if merge_with_configuration can accept a reference:

-        settings.merge_with_configuration(configuration, resolution_directory.clone())?;
+        settings.merge_with_configuration(configuration, resolution_directory.as_ref())?;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c89cfe2 and 4596826.

📒 Files selected for processing (2)
  • .changeset/fix-monorepo-glob-resolution.md (1 hunks)
  • crates/biome_service/src/workspace/server.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
crates/biome_service/src/workspace/server.rs

📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)

Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode

Files:

  • crates/biome_service/src/workspace/server.rs
crates/**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates

Files:

  • crates/biome_service/src/workspace/server.rs
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Write changesets that are concise (1-3 sentences), user-focused, use past tense for actions taken and present tense for Biome behavior, include code examples for rules, and end sentences with periods

Files:

  • .changeset/fix-monorepo-glob-resolution.md
🧠 Learnings (11)
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP tests

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-12-12T10:11:05.564Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-12T10:11:05.564Z
Learning: Applies to **/Cargo.toml : Use workspace dependencies defined in root `Cargo.toml` for internal crates with `workspace = true`, and use path dependencies for `dev-dependencies` to avoid requiring published versions

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/server.rs : Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Assist rules should detect refactoring opportunities and emit code action signals

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Implement `Merge` trait for rule options to support configuration inheritance

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Wrap rule options fields in `Option<>` to properly track set and unset options during merge

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `rename_all = "camelCase"` in serde derive macro for rule options

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Check if a variable is global using the semantic model to avoid false positives

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `version` field to `next` in `declare_lint_rule!` macro

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.

Applied to files:

  • .changeset/fix-monorepo-glob-resolution.md
🧬 Code graph analysis (1)
crates/biome_service/src/workspace/server.rs (1)
crates/biome_configuration/src/lib.rs (1)
  • extends_root (275-277)
🔇 Additional comments (2)
.changeset/fix-monorepo-glob-resolution.md (1)

1-7: LGTM!

The changeset follows all coding guidelines: concise, user-focused, uses proper tenses, and accurately describes the fix. Well done.

crates/biome_service/src/workspace/server.rs (1)

1010-1014: No issues identified. The code at lines 1010–1014 safely handles both None and Some cases: merge_with_configuration explicitly accepts Option<Utf8PathBuf>, and load_plugins uses .unwrap_or_default() to convert None to an empty path.

Copy link
Contributor

@arendjr arendjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you were also okay with this change, right, @ematipico ?

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks ok and agree with the fix, but I would like to see a test too

@ematipico ematipico self-assigned this Feb 4, 2026
@ruidosujeira ruidosujeira force-pushed the fix/monorepo-glob-resolution-8518 branch from 9f272bf to f22b68e Compare February 11, 2026 15:34
@ematipico ematipico merged commit ccdc602 into biomejs:main Feb 11, 2026
13 checks passed
@github-actions github-actions bot mentioned this pull request Feb 11, 2026
@github-actions github-actions bot mentioned this pull request Feb 16, 2026
@EvHaus
Copy link

EvHaus commented Feb 18, 2026

I think the docs need to be updated due to this change. https://biomejs.dev/guides/big-projects/#monorepo still says:

Note that paths in a configuration file are always resolved from the folder in which the biome.json/biome.jsonc file resides.

@siketyan
Copy link
Member

This change has been reverted for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Monorepo] globally excluded files are still processed

5 participants