Skip to content

fix: improve globs resolution docs#3727

Open
ematipico wants to merge 3 commits intomainfrom
chore/improve-globs-resolution
Open

fix: improve globs resolution docs#3727
ematipico wants to merge 3 commits intomainfrom
chore/improve-globs-resolution

Conversation

@ematipico
Copy link
Member

Summary

Closes biomejs/biome#8518

It seems some users were confused by the behaviour of files.includes, and it was pointed out that there was a gap in our docs.

This PR tries to fill that gap.

@brandonw please let me know if the additions are clear enough for you

@netlify
Copy link

netlify bot commented Dec 22, 2025

Deploy Preview for biomejs ready!

Name Link
🔨 Latest commit dca7ddb
🔍 Latest deploy log https://app.netlify.com/projects/biomejs/deploys/6949145e4ca3e6000852198c
😎 Deploy Preview https://deploy-preview-3727--biomejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ematipico ematipico requested review from a team December 22, 2025 09:13
@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2025

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en src/content/docs/guides/big-projects.mdx Source changed, localizations will be marked as outdated.
en src/content/docs/reference/configuration.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 22, 2025

Walkthrough

Documentation updates only. Added a new "Globs resolution" explanatory section to the big-projects guide describing how globs in includes are resolved when a nested biome.json extends the root, with examples and exclusion strategies; the section was accidentally duplicated. Updated the configuration reference to add the sentence "All globs are resolved from the configuration file where they are defined." across multiple sections (includes/formatting/linting/assist/overrides). No code, API, or runtime behavior changes.

Suggested labels

A-Documentation

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarises the main change: documentation improvements for glob resolution behaviour.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation (filling a documentation gap) and linking to the underlying issue.
Linked Issues check ✅ Passed The PR addresses issue #8518 by adding clarifying documentation about glob resolution from the configuration file where they are defined, which directly explains the behaviour that confused users in the monorepo scenario.
Out of Scope Changes check ✅ Passed All changes are documentation-only (two .mdx files) and directly address the gap in docs around glob resolution behaviour identified in the linked issue.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/improve-globs-resolution

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: 2

📜 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 5ce9ff3 and be1e91d.

📒 Files selected for processing (2)
  • src/content/docs/guides/big-projects.mdx
  • src/content/docs/reference/configuration.mdx
🧰 Additional context used
🪛 LanguageTool
src/content/docs/guides/big-projects.mdx

[grammar] ~154-~154: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...llowing project is placed in the folder /Users/todo, and contains a root configuration in ...

(TO_DO_HYPHEN)


[grammar] ~154-~154: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ..., and contains a root configuration in /Users/todo/biome.json, and one inside /Users/tod...

(TO_DO_HYPHEN)


[grammar] ~155-~155: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: .../Users/todo/biome.json, and one inside /Users/todo/app/biome.json. - Globs defined in /...

(TO_DO_HYPHEN)


[grammar] ~157-~157: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...do/app/biome.json. - Globs defined in /Users/todo/biome.jsonare resolved from/Users/t...

(TO_DO_HYPHEN)


[grammar] ~157-~157: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...sers/todo/biome.jsonare resolved from/Users/todo/. - Globs defined in /Users/todo/app/...

(TO_DO_HYPHEN)


[grammar] ~158-~158: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...from /Users/todo/. - Globs defined in /Users/todo/app/biome.json are resolved from `/Use...

(TO_DO_HYPHEN)


[grammar] ~158-~158: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: .../todo/app/biome.jsonare resolved from/Users/todo/app`. The root configuration excludes ...

(TO_DO_HYPHEN)


[grammar] ~188-~188: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...f/when you decide to run a command from /Users/todo/app**. That's because when Biome resol...

(TO_DO_HYPHEN)


[grammar] ~189-~189: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...pp/generated.tsis resolved like this:/Users/todo/app ~ !app/generatd.ts`, which doesn't ...

(TO_DO_HYPHEN)


[typographical] ~192-~192: The conjunction “so that” does not require a comma.
Context: ...wo options: - Prepend the glob with **, so that any folder is matched: ```json title=...

(SO_THAT_UNNECESSARY_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules - biomejs
  • GitHub Check: Header rules - biomejs
  • GitHub Check: Pages changed - biomejs
  • GitHub Check: test
🔇 Additional comments (1)
src/content/docs/reference/configuration.mdx (1)

60-60: LGTM! Clear and consistent clarification.

The added sentence "All globs are resolved from the configuration file where they are defined." is consistently applied across all relevant sections and directly addresses the user confusion mentioned in issue #8518. Well done!

Also applies to: 250-250, 399-399, 513-513, 1494-1494

ematipico and others added 2 commits December 22, 2025 09:50
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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 (2)
src/content/docs/guides/big-projects.mdx (2)

152-152: Clarify the field reference.

The term *.includes is a bit ambiguous—it could be read as a glob pattern rather than referring to configuration fields. Consider being more explicit, such as "fields ending with .includes" or listing them (e.g., "files.includes, linter.includes, etc.").


188-189: Consider clarifying the tilde notation.

The expression /Users/todo/app ~ !app/generated.ts uses a tilde to illustrate glob resolution, but this notation isn't standard and might confuse readers. Consider rephrasing to something like "resolved as /Users/todo/app/app/generated.ts" or "interpreted relative to /Users/todo/app" for clarity.

📜 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 be1e91d and dca7ddb.

📒 Files selected for processing (1)
  • src/content/docs/guides/big-projects.mdx
🧰 Additional context used
🪛 LanguageTool
src/content/docs/guides/big-projects.mdx

[grammar] ~154-~154: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...llowing project is placed in the folder /Users/todo, and contains a root configuration in ...

(TO_DO_HYPHEN)


[grammar] ~154-~154: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ..., and contains a root configuration in /Users/todo/biome.json, and one inside /Users/tod...

(TO_DO_HYPHEN)


[grammar] ~155-~155: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: .../Users/todo/biome.json, and one inside /Users/todo/app/biome.json. - Globs defined in /...

(TO_DO_HYPHEN)


[grammar] ~157-~157: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...do/app/biome.json. - Globs defined in /Users/todo/biome.jsonare resolved from/Users/t...

(TO_DO_HYPHEN)


[grammar] ~157-~157: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...sers/todo/biome.jsonare resolved from/Users/todo/. - Globs defined in /Users/todo/app/...

(TO_DO_HYPHEN)


[grammar] ~158-~158: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...from /Users/todo/. - Globs defined in /Users/todo/app/biome.json are resolved from `/Use...

(TO_DO_HYPHEN)


[grammar] ~158-~158: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: .../todo/app/biome.jsonare resolved from/Users/todo/app`. The root configuration excludes ...

(TO_DO_HYPHEN)


[grammar] ~188-~188: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...f/when you decide to run a command from /Users/todo/app**. That's because when Biome resol...

(TO_DO_HYPHEN)


[grammar] ~189-~189: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...pp/generated.tsis resolved like this:/Users/todo/app ~ !app/generated.ts`, which doesn't...

(TO_DO_HYPHEN)


[typographical] ~192-~192: The conjunction “so that” does not require a comma.
Context: ...wo options: - Prepend the glob with **, so that any folder is matched: ```json title=...

(SO_THAT_UNNECESSARY_COMMA)

🔇 Additional comments (1)
src/content/docs/guides/big-projects.mdx (1)

150-204: Nice addition—addresses the confusion well.

This section directly tackles the issue from #8518 and provides concrete examples with clear solutions. The file tree and configuration snippets make the problem and fix easy to grasp.


A list of [glob patterns](#glob-syntax-reference) of files to process.

All globs are resolved from the configuration file where they are defined.

Choose a reason for hiding this comment

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

@ematipico this seems opposite of the above-- they are not resolved from the config file they are defined, but rather from the "leaf" or "package" config file, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair. What about "configuration where they are loaded from"?

Choose a reason for hiding this comment

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

Yep, that sounds better 👍

inside `/Users/todo/app/biome.json`.

- Globs defined in `/Users/todo/biome.json` are resolved from `/Users/todo/`.
- Globs defined in `/Users/todo/app/biome.json` are resolved from `/Users/todo/app`.

Choose a reason for hiding this comment

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

I think part of the confusion may arise from this kind of description. From my perspective, these two points contradict the actual behavior, because the root glob is evaled from the config file it was defined in only if no other config file inherits from it. If a package config file inherits from the root, then globs are not evaled from the file they are defined in but rather the file that inherits them.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree it's confusing if the docs and the behaviour are contradicting one another. But I do think the behaviour as described here sounds the most sensible, so I would consider the actual behaviour to be a bug then.

the extended glob `!app/generated.ts` is resolved like this: `/Users/todo/app ~ !app/generated.ts`, which doesn't match any existing folder inside the project.

To properly exclude `app/generated.ts`, you have two options:
- Prepend the glob with `**`, so that any folder is matched:
Copy link

@brandonw brandonw Dec 22, 2025

Choose a reason for hiding this comment

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

This doesn't look right-- prepending ** doesn't help because the /app/ part will still not match anything because are are executing from the app directory.

You would need to remove the package path from the root config so that it sees the package relative path correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I understand. The objective is to exclude app/generated.ts, not generated.ts.

What am I missing? Please provide an example so I can understand

Choose a reason for hiding this comment

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

If you have the paths:

biome.json
app/generated.ts
app/biome.json

and app/biome.json extends from biome.json, then including !**/app/generated.ts in the root means it is ingested into the app config as-is. That means from the app conffig, the glob resolves as !**/app/generated.ts. The glob prefix checks the current dir and any subdirs for app/ and finds nothing, because the app dir is what has already been traversed in the transform from root->app config. It doesn't do anything because you aren't adding an unknown prefix in the transition from root->app. You are removing a known prefix.

Prefixing a ** to the glob only helps if there are no intermediate directories between the root and the package configs. If there are, then they likely interfere and render the glob useless.

Let me know if I am making any sense 🤞

}
}
```
- Move the `!app/generated.ts` glob inside `/Users/todo/app/biome.json`

Choose a reason for hiding this comment

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

How is this done? Is there a way to manipulate the global files.includes from configs that inherit the root? The json schema nor the config file reference doesn't seem to think so.

It may be worth clarifying what exactly you can do if you want to move the path into the package config. I think something like:

      "formatter": {
        "enabled": false
      },
      "linter": {
        "enabled": false
      },
      "assist": {
        "enabled": false
      }

in an exclude, but I am not 100% on that.

@arendjr arendjr requested a review from Conaclos December 28, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Monorepo] globally excluded files are still processed

3 participants