Back to Biomejs

useBiomeIgnoreFolder

src/content/docs/linter/rules/use-biome-ignore-folder.mdx

latest1.8 KB
Original Source

import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs> <TabItem label="JSON (and super languages)" icon="seti:json"> ## Summary - Rule available since: `v2.2.0` - Diagnostic Category: [`lint/suspicious/useBiomeIgnoreFolder`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule has a [**safe**](/linter/#safe-fixes) fix. - The default severity of this rule is [**warning**](/reference/diagnostics#warning). ## How to configure ```json title="biome.json" { "linter": { "rules": { "suspicious": { "useBiomeIgnoreFolder": "error" } } } }
## Description
Promotes the correct usage for ignoring folders in the configuration file.

Starting Biome v2.2, ignoring folders doesn't require the use of the trailing `/**`.
When using the pattern `/**`, you tell Biome to ignore **all files** inside a folder, but the folder is still crawled. This pattern
can lead to poor performance, especially if the folder contains many files.

If the intention is to ignore specific files inside a folder, the trailing pattern `/**` shouldn't be used.

## Examples

### Invalid

```json
{
    "files": {
        "includes": ["**", "!dist/**", "!**/dist/**"]
    }
}

Valid

json
{
    "files": {
        "includes": ["**", "!dist", "!**/dist"]
    }
}
</TabItem> </Tabs>