Skip to content

Configuration

$schema

Allows to pass a path to a JSON schema file.

We publish a JSON schema file for the biome.json.

You can specify a relative path to the schema of the @biomejs/biome npm package if @biomejs/biome is installed in the node_modules folder:

biome.json
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json"
}

If you have problems with resolving the physical file, you can use the one published in this site:

biome.json
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json"
}

extends

A list of paths to other JSON files that will extend the current configuration file.

biome.json
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"extends": ["./formatter.json", "./linter.json"]
}
formatter.json
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"formatter": {
"indentSize": 2
},
"javascript": {
"formatter": {
"semicolons": "asNeeded"
}
}
}
linter.json
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"linter": {
"rules": {
"complexity": {
"noUselessConstructor": "off"
}
}
}
}

The files defined in this array:

  • must exist in the file system;
  • are resolved from the path where the biome.json file is defined;
  • must be relative paths. Paths to libraries are not resolved;
  • must be reachable by Biome, e.g. symbolic links might not be resolved by Biome;
  • will be processed in order: from the first one to the last one;
  • can override the same properties, but ultimately only the last one will be used by Biome;

files

files.maxSize

The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reasons.

Default: 1024*1024 (1MB)

files.ignore

A list of Unix shell style patterns. Biome ignores files and folders that match these patterns.

biome.json
{
"files": {
"ignore": ["scripts/*.js"]
}
}

files.include

A list of Unix shell style patterns. Biome handles only the files and folders that match these patterns.

biome.json
{
"files": {
"include": ["scripts/*.js"]
}
}

Given the following example:

biome.json
{
"files": {
"include": ["scripts/**/*.js", "src/**/*.js"],
"ignore": ["scripts/**/*.js"]
}
}

Only the files that match the pattern src/**/*.js will be handled, while the files that match the pattern scripts/**/*.js will be ignored.

files.ignoreUnknown

Biome won’t emit diagnostics if it encounters files that can’t handle.

biome.json
{
"files": {
"ignoreUnknown": true
}
}

Default: false

vcs

Set of properties to integrate Biome with a VCS software.

vcs.enabled

Whether Biome should integrate itself with the VCS client

Default: false

vcs.clientKind

The kind of client.

Values:

  • "git"

vcs.useIgnoreFile

Whether Biome should use the VCS ignore file. When true, Biome will ignore the files specified in the ignore file.

vcs.root

The folder where Biome should check for VCS files. By default, Biome will use the same folder where biome.json was found.

If Biome can’t find the configuration, it will attempt to use the current working directory. If no current working directory can’t be found, Biome won’t use the VCS integration, and a diagnostic will be emitted

linter

linter.enabled

Enables Biome’s linter

Default: true

linter.ignore

An array of Unix shell style patterns.

biome.json
{
"linter": {
"ignore": ["scripts/*.js"]
}
}

linter.include

A list of Unix shell style patterns. Biome handles only the files and folders that match these patterns.

biome.json
{
"linter": {
"include": ["scripts/*.js"]
}
}

Given the following example:

biome.json
{
"linter": {
"include": ["scripts/**/*.js", "src/**/*.js"],
"ignore": ["scripts/**/*.js"]
}
}

Only the files that match the patter src/**/*.js will be linted, while the files that match the pattern scripts/**/*.js will be ignored.

linter.rules.recommended

Enables the recommended rules for all groups.

Default: true

linter.rules.all

Enable or disable all rules for all groups.

If recommended and all are both true, Biome will emit a diagnostic and fallback to its defaults.

biome.json
{
"linter": {
"enabled": true,
"rules": {
"all": true
}
}
}

It’s also possible to combine this flag to enable/disable different rule groups:

biome.json
{
"linter": {
"enabled": true,
"rules": {
"all": true,
"style": {
"all": false
},
"complexity": {
"all": false
}
}
}
}

In the previous example, Biome will enable all rules, exception for rules that belong to the style and complexity groups.

linter.rules.[group]

Options that influence the rules of a single group. Biome supports the following groups:

  • accessibility: Rules focused on preventing accessibility problems.
  • complexity: Rules that focus on inspecting complex code that could be simplified.
  • correctness: Rules that detect code that is guaranteed to be incorrect or useless.
  • performance: Rules catching ways your code could be written to run faster, or generally be more efficient.
  • security: Rules that detect potential security flaws.
  • style: Rules enforcing a consistent and idiomatic way of writing your code.
  • suspicious: Rules that detect code that is likely to be incorrect or useless.
  • nursery: New rules that are still under development. Nursery rules require explicit opt-in via configuration on stable versions because they may still have bugs or performance problems. They are enabled by default on nightly builds, but as they are unstable their diagnostic severity may be set to either error or warning, depending on whether we intend for the rule to be recommended or not when it eventually gets stabilized. Nursery rules get promoted to other groups once they become stable or may be removed. Rules that belong to this group are not subject to semantic version.
  • linter.rules.[group].recommended

    Enables the recommended rules for a single group.

    Example:

    biome.json
    {
    "linter": {
    "enabled": true,
    "rules": {
    "nursery": {
    "recommended": true
    }
    }
    }
    }

    linter.rules.[group].all

    Enables all rules for a single group.

    Example:

    biome.json
    {
    "linter": {
    "enabled": true,
    "rules": {
    "nursery": {
    "all": true
    }
    }
    }
    }

    formatter

    These options apply to all languages. There are additional language-specific formatting options below.

    formatter.enabled

    Enables Biome’s formatter

    Default: true

    formatter.ignore

    An array of Unix shell style patterns.

    biome.json
    {
    "formatter": {
    "ignore": ["scripts/*.js"]
    }
    }

    formatter.include

    A list of Unix shell style patterns. Biome handles only the files and folders that match these patterns.

    biome.json
    {
    "formatter": {
    "include": ["scripts/*.js"]
    }
    }

    Given the following example:

    biome.json
    {
    "formatter": {
    "include": ["scripts/**/*.js", "src/**/*.js"],
    "ignore": ["scripts/**/*.js"]
    }
    }

    Only the files that match the patter src/**/*.js will be formatted, while the files that match the pattern scripts/**/*.js will be ignored.

    formatter.formatWithErrors

    Allows to format a document that has syntax errors.

    biome.json
    {
    "formatter": {
    "formatWithErrors": true
    }
    }

    Default: false

    formatter.indentStyle

    The style of the indentation. It can be "tab" or "space".

    Default: tab

    formatter.indentSize

    How big the indentation should be.

    Default: 2

    formatter.indentWidth

    How big the indentation should be.

    Default: 2

    formatter.lineEnding

    The type of line ending.

    • lf, Line Feed only (\n), common on Linux and macOS as well as inside git repos
    • crlf Carriage Return + Line Feed characters (\r\n), common on Windows
    • cr Carriage Return character only (\r), used very rarely

    Default: lf

    formatter.lineWidth

    How many characters can be written on a single line.

    Default: 80

    organizeImports

    organizeImports.enabled

    Enables Biome’s sort imports.

    Default: true

    organizeImports.ignore

    A list of Unix shell style patterns. Biome ignores files and folders that match these patterns.

    biome.json
    {
    "organizeImports": {
    "ignore": ["scripts/*.js"]
    }
    }

    organizeImports.include

    A list of Unix shell style patterns. Biome handles only the files and folders that match these patterns.

    biome.json
    {
    "organizeImports": {
    "include": ["scripts/*.js"]
    }
    }

    Given the following example:

    biome.json
    {
    "organizeImports": {
    "include": ["scripts/**/*.js", "src/**/*.js"],
    "ignore": ["scripts/**/*.js"]
    }
    }

    Only the files that match the patter src/**/*.js will have their imports sorted, while the files that match the pattern scripts/**/*.js will be ignored.

    javascript

    These options apply only to JavaScript (and TypeScript) files.

    javascript.parser.unsafeParameterDecoratorsEnabled

    Allows to support the unsafe/experimental parameter decorators.

    biome.json
    {
    "javascript": {
    "parser": {
    "unsafeParameterDecoratorsEnabled": true
    }
    }
    }

    Default: false

    javascript.formatter.quoteStyle

    The type of quote used when representing string literals. It can be single or double.

    Default: double

    javascript.formatter.jsxQuoteStyle

    The type of quote used when representing jsx string literals. It can be single or double.

    Default: double

    javascript.formatter.quoteProperties

    When properties inside objects should be quoted. It can be asNeeded or preserve.

    Default: asNeeded

    javascript.formatter.trailingComma

    Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Possible values:

    • all, the trailing comma is always added
    • es5, the trailing comma is added only in places where it’s supported by older version of JavaScript
    • none, trailing commas are never added

    Default: all

    javascript.formatter.semicolons

    It configures where the formatter prints semicolons:

    • always, the semicolons is always added at the end of each statement;
    • asNeeded, the semicolons are added only in places where it’s needed, to protect from ASI

    Default: always

    Example:

    biome.json
    {
    "javascript": {
    "formatter": {
    "semicolons": "asNeeded"
    }
    }
    }

    javascript.formatter.arrowParentheses

    Whether to add non-necessary parentheses to arrow functions:

    • always, the parentheses are always added;
    • asNeeded, the parentheses are added only when they are needed;

    Default: always

    javascript.formatter.enabled

    Enables Biome’s formatter for JavaScript (and its super languages) files.

    Default: true

    javascript.formatter.indentStyle

    The style of the indentation for JavaScript (and its super languages) files. It can be "tab" or "space".

    Default: tab

    javascript.formatter.indentSize

    How big the indentation should be for JavaScript (and its super languages) files.

    Default: 2

    javascript.formatter.lineEnding

    The type of line ending for JavaScript (and its super languages) files.

    • lf, Line Feed only (\n), common on Linux and macOS as well as inside git repos
    • crlf Carriage Return + Line Feed characters (\r\n), common on Windows
    • cr Carriage Return character only (\r), used very rarely

    Default: lf

    javascript.formatter.lineWidth

    How many characters can be written on a single line in JavaScript (and its super languages) files.

    Default: 80

    javascript.globals

    A list of global names that Biome should ignore (analyzer, linter, etc.)

    biome.json
    {
    "javascript": {
    "globals": ["$", "_", "externalVariable"]
    }
    }

    json

    Options applied to the JSON files.

    json.parser.allowComments

    Enables the parsing of comments in JSON files.

    biome.json
    {
    "json": {
    "parser": {
    "allowComments": true
    }
    }
    }

    json.parser.allowTrailingCommas

    Enables the parsing of trailing Commas in JSON files.

    biome.json
    {
    "json": {
    "parser": {
    "allowTrailingCommas": true
    }
    }
    }

    json.formatter.enabled

    Enables Biome’s formatter for JSON (and its super languages) files.

    Default: true

    json.formatter.indentStyle

    The style of the indentation for JSON (and its super languages) files. It can be "tab" or "space".

    Default: tab

    json.formatter.indentSize

    How big the indentation should be for JSON (and its super languages) files.

    Default: 2

    json.formatter.lineEnding

    The type of line ending for JSON (and its super languages) files.

    • lf, Line Feed only (\n), common on Linux and macOS as well as inside git repos
    • crlf Carriage Return + Line Feed characters (\r\n), common on Windows
    • cr Carriage Return character only (\r), used very rarely

    Default: lf

    json.formatter.lineWidth

    How many characters can be written on a single line in JSON (and its super languages) files.

    Default: 80

    overrides

    A list of patterns.

    Use this configuration to change the behaviour of the tools for certain files.

    When a file is matched against an override pattern, the configuration specified in that pattern will be override the top-level configuration.

    The order of the patterns matter. If a file can match three patterns, only the first one is used.

    overrides.<ITEM>.ignore

    A list of Unix shell style patterns. Biome will not apply the override to files that match the pattern.

    biome.json
    {
    "overrides": [{
    "ignore": ["scripts/*.js"]
    }]
    }

    overrides.<ITEM>.include

    A list of Unix shell style patterns. Biome will apply the override only to files that match the pattern.

    biome.json
    {
    "overrides": [{
    "include": ["scripts/*.js"]
    }]
    }

    overrides.<ITEM>.formatter

    It will include the options of top level formatter configuration, minus ignore and include.

    Examples

    For example, it’s possible to modify the formatter lineWidth, indentStyle for certain files that are included in the glob path generated/**:

    biome.json
    {
    "formatter": {
    "lineWidth": 100
    },
    "overrides": [
    {
    "include": ["generated/**"],
    "formatter": {
    "lineWidth": 160,
    "indentStyle": "space"
    }
    }
    ]
    }

    overrides.<ITEM>.linter

    It will include the options of top level linter configuration, minus ignore and include.

    Examples

    You can disable certain rules for certain glob paths, and disable the linter for other glob paths:

    biome.json
    {
    "linter": {
    "enabled": true,
    "rules": {
    "recommended": true
    }
    },
    "overrides": [
    {
    "include": ["lib/**"],
    "linter": {
    "rules": {
    "suspicious": {
    "noDebugger": "off"
    }
    }
    }
    },
    {
    "include": ["shims/**"],
    "linter": {
    "enabled": false
    }
    }
    ]
    }

    overrides.<ITEM>.organizeImports

    It will include the options of top level organize imports, minus ignore and include.

    overrides.<ITEM>.javascript

    It will include the options of top level javascript configuration.

    Examples

    You can change the formatting behaviour of JavaScript files in certain folders:

    biome.json
    {
    "formatter": {
    "lineWidth": 120
    },
    "javascript": {
    "formatter": {
    "quoteStyle": "single"
    }
    },
    "overrides": [
    {
    "include": ["lib/**"],
    "javascript": {
    "formatter": {
    "quoteStyle": "double"
    }
    }
    }
    ]
    }

    overrides.<ITEM>.json

    It will include the options of top level json configuration.

    Examples

    You can enable parsing features for certain JSON files:

    biome.json
    {
    "linter": {
    "enabled": true,
    "rules": {
    "recommended": true
    }
    },
    "overrides": [
    {
    "include": [".vscode/**"],
    "json": {
    "parser": {
    "allowComments": true,
    "allowTrailingComma": true
    }
    }
    }
    ]
    }