Skip to content

docs: add plugin file scoping (includes) documentation#3993

Open
chocky335 wants to merge 8 commits intobiomejs:nextfrom
chocky335:docs/plugin-file-scoping
Open

docs: add plugin file scoping (includes) documentation#3993
chocky335 wants to merge 8 commits intobiomejs:nextfrom
chocky335:docs/plugin-file-scoping

Conversation

@chocky335
Copy link

@chocky335 chocky335 commented Feb 21, 2026

Summary

Documents the includes file-scoping option for plugin configuration, added in biomejs/biome#9171.

Changes:

  • linter/plugins.mdx: Added "File Scoping" section showing how to use includes with negated globs for exclusions.
  • reference/configuration.mdx: Added plugins section documenting the configuration schema (path, includes).

AI assistance was used during development.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify
Copy link

netlify bot commented Feb 21, 2026

Deploy Preview for biomejs ready!

Name Link
🔨 Latest commit dab73f8
🔍 Latest deploy log https://app.netlify.com/projects/biomejs/deploys/699c3bb04f42380008f4495a
😎 Deploy Preview https://deploy-preview-3993--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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

Walkthrough

Documentation was expanded to add file-scoping for linter plugins and to document plugin configuration. The linter plugins page now explains includes glob patterns (including negations) that restrict when a plugin runs and gives a biome.json example showing mixed plugin forms and patterns. The configuration reference adds a plugins list that accepts either path strings or objects with path and optional includes fields, and defines the semantics of plugins.<ITEM>.path and plugins.<ITEM>.includes.

Possibly related PRs

  • biomejs/website PR 3960: Updates configuration docs and linter documentation around file-includes/negation semantics, closely overlapping the same config and plugin scoping changes.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main change: documentation for the new plugin file scoping (includes) feature.
Description check ✅ Passed The description clearly relates to the changeset, explaining what documentation was added and which files were modified.

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

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

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/content/docs/linter/plugins.mdx (1)

61-75: ⚠️ Potential issue | 🟡 Minor

The "For example:" doesn't illustrate file scoping.

The shell block that follows (lines 63–75) is the generic Object.assign diagnostic from the introduction — it doesn't demonstrate includes/excludes in action. Placing it right after the file-scoping explanation with "For example:" implies it does, which will leave readers scratching their heads.

Either replace the example with one that actually shows a file being skipped or scoped (e.g., showing that a file in tests/** produces no output when excludes: ["tests/**"] is set), or move this existing block back to its original location without the "For example:" preamble.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/docs/linter/plugins.mdx` around lines 61 - 75, The "For example:"
paragraph currently precedes the generic Object.assign diagnostic (the shell
block showing resolveConfig(Object.assign(...))) but doesn't illustrate file
scoping; either replace that shell block with a concrete file-scoping example
that demonstrates includes/excludes (e.g., show a lint run where a file under
tests/** produces no output when excludes: ["tests/**"] is set) or move the
existing Object.assign diagnostic back to its previous location and remove the
"For example:" lead-in so the documentation correctly shows file scoping via the
includes/excludes example rather than the generic diagnostic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/content/docs/linter/plugins.mdx`:
- Line 35: Change the orphaned h3 heading "### File Scoping" to an h2 ("## File
Scoping") so it matches the other top-level headings like "## Target Languages"
and "## Plugin API" and appears correctly in the autogenerated TOC; update the
heading text only (no other content) to preserve structure.

In `@src/content/docs/reference/configuration.mdx`:
- Around line 88-96: Update the documentation for plugins.<ITEM>.includes and
plugins.<ITEM>.excludes to state their default/omission behavior (i.e., if
plugins.<ITEM>.includes is omitted the plugin runs on all files; if
plugins.<ITEM>.excludes is omitted nothing is skipped) and add a link or
cross-reference to the existing "Glob syntax reference" (use the same anchor
used by files.includes/linter.includes) so readers can see the supported glob
patterns; keep wording concise and consistent with other entries in the
document.

---

Outside diff comments:
In `@src/content/docs/linter/plugins.mdx`:
- Around line 61-75: The "For example:" paragraph currently precedes the generic
Object.assign diagnostic (the shell block showing
resolveConfig(Object.assign(...))) but doesn't illustrate file scoping; either
replace that shell block with a concrete file-scoping example that demonstrates
includes/excludes (e.g., show a lint run where a file under tests/** produces no
output when excludes: ["tests/**"] is set) or move the existing Object.assign
diagnostic back to its previous location and remove the "For example:" lead-in
so the documentation correctly shows file scoping via the includes/excludes
example rather than the generic diagnostic.

@chocky335 chocky335 changed the title docs: add plugin file scoping (includes/excludes) documentation docs: add plugin file scoping (includes) documentation Feb 21, 2026
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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/content/docs/linter/plugins.mdx (1)

60-74: ⚠️ Potential issue | 🟡 Minor

The "For example:" shell block doesn't illustrate file scoping.

The shell output shows the generic Object.assign diagnostic introduced at the very top of the page — it has no visible connection to the includes config just described. The file path /packages/tailwindcss-config-analyzer/src/introspect.ts doesn't obviously match either of the two example plugin configs above (src/components/** or src/**/*.ts), so readers can't infer what "scoping in action" looks like.

Either replace it with an example that shows a file being skipped because it doesn't match includes, or remove it entirely — the JSON snippet above already tells the story.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/docs/linter/plugins.mdx` around lines 60 - 74, The example shell
output currently uses /packages/tailwindcss-config-analyzer/src/introspect.ts
which doesn't demonstrate the plugin "includes" scoping (e.g., src/components/**
or src/**/*.ts); update the shell block under "For example:" to either (a)
replace the output with a lint run that shows a file being skipped or not
reported because it does not match the includes pattern (so readers see scoping
in action), or (b) swap the path to a matching file path that clearly aligns
with one of the example include patterns (for instance a file under
src/components/**) so the diagnostic reflects the described scope; alternatively
remove the shell block entirely if you prefer the JSON snippet to stand alone.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/content/docs/linter/plugins.mdx`:
- Around line 56-58: Update the wording that currently claims "following the
same semantics as .gitignore" to instead state that the plugin `includes` option
uses Biome's own `biome_glob` semantics (reference the `includes` option and
`biome_glob` by name), and replace or remove the `.gitignore` link—preferably
swap it for Biome's glob syntax reference
(https://biomejs.dev/reference/configuration/#glob-syntax) and add a brief note
about negated patterns only working as exceptions to regular globs and requiring
a leading `**` to match files and folders; ensure the sentence about negated
patterns and examples reference `includes`/`biome_glob` rather than gitignore.

---

Outside diff comments:
In `@src/content/docs/linter/plugins.mdx`:
- Around line 60-74: The example shell output currently uses
/packages/tailwindcss-config-analyzer/src/introspect.ts which doesn't
demonstrate the plugin "includes" scoping (e.g., src/components/** or
src/**/*.ts); update the shell block under "For example:" to either (a) replace
the output with a lint run that shows a file being skipped or not reported
because it does not match the includes pattern (so readers see scoping in
action), or (b) swap the path to a matching file path that clearly aligns with
one of the example include patterns (for instance a file under
src/components/**) so the diagnostic reflects the described scope; alternatively
remove the shell block entirely if you prefer the JSON snippet to stand alone.

---

Duplicate comments:
In `@src/content/docs/linter/plugins.mdx`:
- Line 35: The "File Scoping" heading is using an h3 ("### File Scoping") but
should be an h2 to match its sibling sections; update the heading token from
"### File Scoping" to "## File Scoping" so it is a proper sibling of "## Target
Languages" and "## Plugin API" (look for the literal heading text "File Scoping"
in the document and change its leading hashes).

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

🧹 Nitpick comments (1)
src/content/docs/linter/plugins.mdx (1)

49-51: Nit: tighten the negated glob to match the positive pattern's scope.

The positive pattern restricts to src/**/*.ts, but the negation uses !**/*.test.ts (project-wide). The net result is identical since no file outside src/ can be selected anyway, but scoping the exclusion to match makes the intent self-documenting.

✏️ Suggested tweak
-            "includes": ["src/**/*.ts", "!**/*.test.ts"]
+            "includes": ["src/**/*.ts", "!src/**/*.test.ts"]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/docs/linter/plugins.mdx` around lines 49 - 51, Tighten the
negated glob so it matches the positive pattern's scope by replacing the
project-wide exclusion "!**/*.test.ts" with a scoped exclusion like
"!src/**/*.test.ts" in the plugin config (the JSON object containing "path":
"./ts-only-plugin.grit" and "includes": ["src/**/*.ts", ...]); this keeps the
intent explicit and ensures the exclusion only applies within the same
"src/**/*.ts" pattern.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/content/docs/linter/plugins.mdx`:
- Around line 56-57: The phrase about "matching at least one of the patterns" is
ambiguous when negated globs exist; update the sentence that references the
includes option to state that the plugin runs only on files that match at least
one positive (non‑negated) pattern, and that negated patterns (those beginning
with "!") act as exclusions—files matching a negated pattern are explicitly
excluded rather than included (e.g., "!**/*.test.ts" excludes test files).
Ensure the updated text mentions both positive vs. negated semantics and gives
the "!**/*.test.ts" example for clarity.

---

Nitpick comments:
In `@src/content/docs/linter/plugins.mdx`:
- Around line 49-51: Tighten the negated glob so it matches the positive
pattern's scope by replacing the project-wide exclusion "!**/*.test.ts" with a
scoped exclusion like "!src/**/*.test.ts" in the plugin config (the JSON object
containing "path": "./ts-only-plugin.grit" and "includes": ["src/**/*.ts",
...]); this keeps the intent explicit and ensures the exclusion only applies
within the same "src/**/*.ts" pattern.

Comment on lines 37 to 39
By default, a plugin runs on every file the linter processes. If a plugin only
applies to certain files, you can restrict it using `includes` glob patterns.
Use negated globs (prefixed with `!`) for exclusions:
Copy link
Member

Choose a reason for hiding this comment

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

In our docs, when we provide code examples like here, we follow this pattern, in this order

  • explain the feature
  • talk about the example in the specifics
  • then show the example

In this case, we miss a description of the example you added. It should explain which plugin matches which paths

Copy link
Author

Choose a reason for hiding this comment

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

Added a paragraph before the example describing which plugin matches which paths.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/content/docs/linter/plugins.mdx`:
- Around line 42-54: Update the mismatch between the prose and the glob in the
second plugin: either change the includes glob in the plugin object with "path":
"./ts-only-plugin.grit" from "src/**/*.ts" to a broader pattern that includes
TSX (for example use "src/**/*.{ts,tsx}" or add "src/**/*.tsx"), or else change
the documentation text that says "TypeScript files" to explicitly say
"TypeScript (.ts) files" so the description matches the existing "src/**/*.ts"
include pattern; locate the includes key in the plugin entry for
"./ts-only-plugin.grit" to apply the change.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cebc481 and fc139c7.

📒 Files selected for processing (2)
  • src/content/docs/linter/plugins.mdx
  • src/content/docs/reference/configuration.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/content/docs/reference/configuration.mdx

@chocky335
Copy link
Author

@coderabbitai resume

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 23, 2026

✅ Actions performed

Reviews resumed.

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.

🧹 Nitpick comments (1)
src/content/docs/linter/plugins.mdx (1)

37-39: Optional: mention the "positive pattern first" constraint for negated globs.

When using a negated pattern, you should always specify ** first to match all files and folders, otherwise the negated pattern will not match any files. The intro text currently says "Use negated globs (prefixed with !) for exclusions" without this caveat, which could lead readers astray if they try "includes": ["!src/**/*.test.ts"] alone.

The linked glob-syntax reference should cover this in full — so this is purely a "nice to have" callout rather than a required fix.

✏️ Suggested addition
 Use negated globs (prefixed with `!`) for exclusions.
+Note that a negated pattern alone has no effect; it must be preceded by at
+least one positive pattern (e.g. `**`) to function as an exclusion.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/docs/linter/plugins.mdx` around lines 37 - 39, Add a short caveat
to the plugins "includes" explanation that when using negated globs (prefixed
with '!') you must include a positive pattern first (commonly "**") so the
negation can match—e.g., explain that `"includes": ["**", "!src/**/*.test.ts"]`
is required and that `"includes": ["!src/**/*.test.ts"]` alone will match
nothing; update the sentence referencing "Use negated globs (prefixed with `!`)
for exclusions" to include this constraint and optionally link the existing
glob-syntax reference for full details.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/content/docs/linter/plugins.mdx`:
- Around line 37-39: Add a short caveat to the plugins "includes" explanation
that when using negated globs (prefixed with '!') you must include a positive
pattern first (commonly "**") so the negation can match—e.g., explain that
`"includes": ["**", "!src/**/*.test.ts"]` is required and that `"includes":
["!src/**/*.test.ts"]` alone will match nothing; update the sentence referencing
"Use negated globs (prefixed with `!`) for exclusions" to include this
constraint and optionally link the existing glob-syntax reference for full
details.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc139c7 and dab73f8.

📒 Files selected for processing (2)
  • src/content/docs/linter/plugins.mdx
  • src/content/docs/reference/configuration.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/content/docs/reference/configuration.mdx

@chocky335
Copy link
Author

chocky335 commented Feb 23, 2026

Re CodeRabbit nitpick on negated globs needing a positive pattern first: this is already covered by the glob syntax reference linked at the bottom of the section, and our example already demonstrates the correct usage.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 23, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Read the linter/plugins.mdx file to see the section about file scoping and the glob syntax reference link
cat src/content/docs/linter/plugins.mdx

Length of output: 3334


@chocky335 You're absolutely right—the example demonstrates the proper pattern, and the glob syntax reference covers the details. The documentation is clear as written. Thanks for the clarification! 👍

@chocky335 chocky335 requested a review from ematipico February 23, 2026 12:08
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.

2 participants