Skip to content

Integrate Biome with your VCS

The VCS (Version Control System) integration is meant to take advantage of additional features that only a VCS can provide, allowing to customise your development experience even further.

The integration is opt-in*, and it requires two mandatory fields. The vcs.enabled field, and the vcs.clientKind field, both in the configuration file:

biome.json
{
"vcs": {
"enabled": true,
"clientKind": "git"
}
}

This configuration doesn’t do anything per se. You have to opt-in new features.

This is a feature that allows Biome to read the ignore file of the VCS and ignore all the files and folders that were specified in it. For now, Biome only takes the ignore file in the working directory into account. This is an opt-in feature, and you have to enable the vcs.useIgnoreFile field:

biome.json
{
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
}
}

This is a feature that is available only via CLI, and allows to process only the files that changed from one revision and another.

First, you have to update your configuration file and tell Biome what’s the default branch via vcs.defaultBranch field:

biome.json
{
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "main"
}
}

Then, add the --changed option to your command, to process only those files that your VCS acknowledged as “changed”. Biome, with the help of the VCS, will determine the changed file from the branch main and your current revision:

Terminal window
biome check --changed

Alternatively, you can use the option --since to specify an arbitrary branch. This option takes precedence over the option vcs.defaultBranch. For example, you might want to check your changes against the next branch:

Terminal window
biome check --changed --since=next

Before committing your changes, you may want to check the formatting and lints files that have been added to the index, also known as staged files. Add the --staged option to your command, to process only those files:

Terminal window
biome check --staged

The --staged' option is not available on the ci’ command because you are not expected to commit changes in a CI environment.