diff --git a/src/content/docs/analyzer/suppressions.mdx b/src/content/docs/analyzer/suppressions.mdx index 0ed737d6c..a8f4f788d 100644 --- a/src/content/docs/analyzer/suppressions.mdx +++ b/src/content/docs/analyzer/suppressions.mdx @@ -22,6 +22,8 @@ Suppression comments have the following format: // biome-ignore lint/suspicious: // biome-ignore lint/suspicious/noDebugger: // biome-ignore lint/suspicious/noDebugger(foo): +// biome-ignore lint/plugin: +// biome-ignore lint/plugin/: // biome-ignore-all lint: // biome-ignore-start lint: // biome-ignore-end lint: @@ -32,6 +34,7 @@ Let's break it down: - `biome-ignore`, `biome-ignore-all`, `biome-ignore-start` and `biome-ignore-end` are the start of a suppression comment. - After the space follows the **category** of the suppression comment. It can be `lint`, `assist`, or `syntax`. - The category is followed by an optional group, or group and name, separated by slashes. For example, `/suspicious` or `/suspicious/noDebugger`. The more you specify, the more specific (i.e. targeted) your suppression is. +- Plugin diagnostics use `lint/plugin`. You can target all plugins with `lint/plugin`, or a single plugin with `lint/plugin/`. - Some rules even allow you to specify values during suppression. These can be specified between parentheses, for example: `(foo)`. Refer to the rule documentation to see whether a rule supports suppression with values. - `` explanation why the rule is disabled. @@ -41,7 +44,6 @@ If you're unsure of the exact category of a rule/action, you can refer to their From here onwards, JavaScript is used to explain suppression comments, and the `lint` category is used. ::: - ### Inline suppressions They disable a lint rule for the **next line** of code. @@ -115,4 +117,24 @@ In the above code: - The `f == g` statement raises a diagnostic because the rule `noDoubleEquals` isn't suppressed anymore. - The comment `// biome-ignore-end lint/suspicious/noDebugger: reason` at line 10 terminates the suppression of `noDebugger` that was started by the suppression comment at line 2. +### Plugin suppressions + +They disable diagnostics emitted by [linter plugins](/linter/plugins). + +Use `lint/plugin` to suppress diagnostics from all plugins, or `lint/plugin/` to suppress diagnostics from one plugin. The `` is the plugin's file name without the `.grit` extension. + +In the following example, the suppression comment `biome-ignore lint/plugin/preferObjectSpread: reason` will disable diagnostics emitted by `preferObjectSpread.grit` for the next line: + +```js title="file.js" ins={1} +// biome-ignore lint/plugin/preferObjectSpread: reason +Object.assign({}, foo); +``` + +To suppress diagnostics from all plugins, omit the plugin name: + +```js title="file.js" ins={1} +// biome-ignore lint/plugin: reason +Object.assign({}, foo); +``` +Plugin suppressions can also be authored as [top-level](#top-level-suppressions) and [range](#range-suppressions) suppressions. diff --git a/src/content/docs/linter/plugins.mdx b/src/content/docs/linter/plugins.mdx index ac366b280..8bacff8a7 100644 --- a/src/content/docs/linter/plugins.mdx +++ b/src/content/docs/linter/plugins.mdx @@ -47,6 +47,9 @@ $ biome lint 14 │ } ``` +You can suppress plugin diagnostics with `lint/plugin` suppression comments. See +[plugin suppressions](/analyzer/suppressions#plugin-suppressions) for details. + Plugins can also suggest code rewrites using the `=>` operator: ```grit title="no-console.grit"