Skip to content
30 changes: 29 additions & 1 deletion src/content/docs/linter/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,35 @@ the following configuration:
```

The plugin will now be enabled on all supported files the linter runs on. You
can see its results when running `biome lint` or `biome check`. For example:
can see its results when running `biome lint` or `biome check`.

### File Scoping

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` and `excludes`
glob patterns:

```json name="biome.json"
{
"plugins": [
{
"path": "./react-plugin.grit",
"includes": ["src/components/**"]
},
{
"path": "./no-test-debug.grit",
"excludes": ["tests/**"]
}
]
}
```

When `includes` is set, the plugin only runs on files matching at least one of
the include patterns. When `excludes` is set, the plugin skips files matching
any exclude pattern. If both are set, a file must match an include pattern _and_
not match any exclude pattern.

For example:

```shell
$ biome lint
Expand Down
44 changes: 44 additions & 0 deletions src/content/docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,50 @@ This is required so Biome can orchestrate multiple files in CLI and editors at t

> Default: `true`

## `plugins`

A list of [GritQL plugins](/linter/plugins/) to enable. Each entry can be
either a simple path string or an object with a path and optional file-scoping
options.

Simple path:

```json title="biome.json"
{
"plugins": ["./my-plugin.grit"]
}
```

Path with file scoping:

```json title="biome.json"
{
"plugins": [
{
"path": "./react-plugin.grit",
"includes": ["src/components/**"],
"excludes": ["src/components/generated/**"]
}
]
}
```

You can mix both forms in the same list.

### `plugins.<ITEM>.path`

Path to the plugin file (`.grit`) or plugin directory containing a
`biome-manifest.jsonc`.

### `plugins.<ITEM>.includes`

A list of glob patterns for files the plugin should run on. If set, only
matching files are analyzed by this plugin.

### `plugins.<ITEM>.excludes`

A list of glob patterns for files the plugin should skip. If set, matching
files are excluded from analysis by this plugin.

## `files`

Expand Down