Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
33 changes: 22 additions & 11 deletions src/content/docs/linter/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,33 @@ 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 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
## File Scoping

✖ 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:
Comment thread
ematipico marked this conversation as resolved.
Outdated

10 │ function createContextFromConfig(config: Partial<Config>) {
11 │ return createContext(
> 12 │ resolveConfig(Object.assign({}, DEFAULT_CONFIG, config)),
│ ^^^^^^^^^^^^^
13 │ );
14 │ }
```json name="biome.json"
{
"plugins": [
{
"path": "./react-plugin.grit",
"includes": ["src/components/**"]
},
{
"path": "./ts-only-plugin.grit",
"includes": ["src/**/*.ts", "!**/*.test.ts"]
}
]
}
```

When `includes` is set, the plugin only runs on files matching at least one of
the patterns. Negated patterns act as exceptions. Patterns follow the
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
[glob syntax reference](/reference/configuration/#glob-syntax-reference).

## Target Languages

A GritQL snippet always attempts to match against a given _target language_.
Expand Down
40 changes: 40 additions & 0 deletions src/content/docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,46 @@ 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:
Comment thread
chocky335 marked this conversation as resolved.
Outdated

```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`

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