Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions src/content/docs/linter/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,37 @@ 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`.

```shell
$ biome lint
/packages/tailwindcss-config-analyzer/src/introspect.ts:12:17 plugin ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
## Restricting Plugins to Specific Files

✖ Prefer object spread instead of `Object.assign()`
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.

10 │ function createContextFromConfig(config: Partial<Config>) {
11 │ return createContext(
> 12 │ resolveConfig(Object.assign({}, DEFAULT_CONFIG, config)),
│ ^^^^^^^^^^^^^
13 │ );
14 │ }
In the following example, the first plugin only runs on files inside
`src/components/`. The second plugin runs on all TypeScript files under `src/`,
except test files:
Comment thread
chocky335 marked this conversation as resolved.
Outdated

```json name="biome.json"
{
"plugins": [
{
"path": "./react-plugin.grit",
"includes": ["src/components/**"]
},
{
"path": "./ts-only-plugin.grit",
"includes": ["src/**/*.ts", "!src/**/*.test.ts"]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
}
]
}
```

When `includes` is set, the plugin only runs on files that match at least one
positive pattern and are not excluded by a negated pattern. Patterns follow the
[glob syntax reference](/reference/configuration/#glob-syntax-reference).

## Target Languages

A GritQL snippet always attempts to match against a given _target language_.
Expand Down
42 changes: 42 additions & 0 deletions src/content/docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,48 @@ 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-filtering
options.

Simple path:

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

Restricting to specific files:

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

You can mix both forms in the same list.

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

**Required.**

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

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

A list of [glob patterns](#glob-syntax-reference) for files the plugin should
run on. Use negated globs (prefixed with `!`) for exclusions.

When omitted, the plugin runs on every file the linter processes.
Comment thread
chocky335 marked this conversation as resolved.
Outdated

## `files`

Expand Down