跳转到内容

Upgrade Biome

此内容尚不支持你的语言。

This page explains how to upgrade Biome in your project, lists the upgrade guides for each major version, and describes what each kind of release can change. For every change in each release, see the changelog.

  1. Install the latest version of Biome with the same method you used to install it:

    npm i -D -E @biomejs/biome@latest

    When you run biome upgrade, Biome detects whether it was installed through Homebrew or as a plain binary and upgrades accordingly. If the detection is wrong, set the BIOME_DISTRIBUTION environment variable. If you installed Biome through Winget or pacman, update it with that tool instead.

  2. Run the migrate command to update the configuration:

    npx biome migrate --write
  3. Check the output of the command. The migrate command updates your configuration to mitigate possible breaking changes, but in some cases you need to perform some manual steps. If so, the command points them out to you.

If you use Renovate to update your dependencies, it can also keep the $schema version in your Biome configuration files up to date. Add the customManagers:biomeVersions preset to the extends list of your Renovate configuration:

renovate.json
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["customManagers:biomeVersions"]
}

Each major version comes with an upgrade guide that explains its breaking changes and how to update your project:

Biome follows semantic versioning. Even patch releases can change your formatting or linting results, so pin the exact version of Biome in your project.

Because Biome is a toolchain, it is not always clear whether a change is major, minor, or patch. The Biome team classifies changes as follows.

Patch releases fix bugs and make internal improvements. They increase the last number of the version, for example from 2.6.7 to 2.6.8. You do not need to change your configuration, but your formatting or linting results can still change slightly.

Patch releases include changes such as:

  • Fixing false positives in lint rules, and incorrect code suggestions.
  • Fixing formatting that produces invalid code or changes how the program behaves.
  • Making internal changes, such as refactors and performance improvements.

Minor releases add new features. They increase the middle number of the version, for example from 2.5.3 to 2.6.0. A minor release can report new lint errors, for example when it adds a recommended rule.

Minor releases include changes such as:

  • Adding new rules, or promoting rules from the nursery group to a stable group.
  • Supporting new language features.
  • Adding configuration options that do not change your results by default.

Major releases include breaking changes that can require updates to your configuration. They increase the first number of the version, for example from 1.9.4 to 2.0.0. Each major release comes with an upgrade guide.

Major releases include changes such as:

  • Changing configuration options or their default values in a way that changes your results.
  • Changing Biome’s public API.

Fixes to lint rules and formatting layouts can make your scripts fail, and even patch releases can produce slightly different formatting or linting results. Save the exact version of Biome in your package.json instead of using a range operator, so that every team member and your CI environments use the same version, and your scripts do not fail unexpectedly.