Skip to content
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:
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.


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", "!src/**/*.test.ts"]
}
]
}
```

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

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

## `files`

Expand Down