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. At the moment, Biome only supports Git. The integration is opt-in*. You have to enable vcs.enabled and set vcs.clientKind in the Biome configuration file:

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

This configuration doesn’t do anything per se. You need to opt-in the features you want.

Enable vcs.useIgnoreFile, to allow Biome to ignore all the files and directories listed in your VCS ignore file. For now, Biome only takes the ignore file in the working directory into account.

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

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

First, you have to update your configuration file and tell Biome what’s the default branch via the 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.