Skip to content

Publish packages

When several projects use the same plugins or the same configuration, you can publish them once as an npm package and install it everywhere. Your package lists the plugin rules, rule presets, and configurations it exports in a manifest named biome-manifest.json or biome-manifest.jsonc, and Biome loads them from node_modules/.

Manifests require Biome v2.6 or later. To share a configuration with projects that use an earlier version, see Support Biome versions before v2.6.

  1. Create biome-manifest.json at the root of your package. Set the required version field, and map the name of each rule to its file in plugins.rules:

    biome-manifest.json
    {
    "version": 1,
    "plugins": {
    "rules": [
    { "useCompanyLogger": "./rules/useCompanyLogger.grit" }
    ]
    }
    }

    A rule file can be a GritQL plugin or a JavaScript plugin.

  2. In package.json, add the manifest and the rule files to files, and map the biome entry of exports to the manifest:

    package.json
    {
    "name": "@org/biome-plugins",
    "version": "1.0.0",
    "files": [
    "biome-manifest.json",
    "rules"
    ],
    "exports": {
    "biome": "./biome-manifest.json"
    }
    }
  3. Publish the package, and install it in the project that uses the rules. Then enable a rule by adding <PACKAGE_NAME>/<RULE_NAME> to plugins:

    biome.json
    {
    "plugins": ["@org/biome-plugins/useCompanyLogger"]
    }

A preset enables several rules at once. Declare presets in plugins.presets, each with the names of the rules it enables. This manifest defines a recommended and a strict preset:

biome-manifest.json
{
"version": 1,
"plugins": {
"rules": [
{ "useCompanyLogger": "./rules/useCompanyLogger.grit" },
{ "noLegacyLibrary": "./rules/noLegacyLibrary.ts" }
],
"presets": {
"recommended": ["useCompanyLogger"],
"strict": ["useCompanyLogger", "noLegacyLibrary"]
}
}
}

To enable a preset, add <PACKAGE_NAME>/presets/<PRESET_NAME> to plugins:

biome.json
{
"plugins": ["@org/biome-plugins/presets/recommended"]
}

Your package can also export rules and presets that come from one of its dependencies. Projects then enable them through your package name, so their configuration and suppression comments keep working if you replace the underlying rule later.

In plugins.rules, an object maps a name to a file in your package, and a string re-exports a rule or a preset from a dependency. This manifest re-exports the noExternalLinks rule and the minimal preset of a hypothetical biome-ux-plugins package, and adds noExternalLinks to its own recommended preset:

biome-manifest.json
{
"version": 1,
"plugins": {
"rules": [
"biome-ux-plugins/noExternalLinks",
"biome-ux-plugins/presets/minimal",
{ "useCompanyLogger": "./rules/useCompanyLogger.grit" },
{ "noLegacyLibrary": "./rules/noLegacyLibrary.ts" }
],
"presets": {
"recommended": [
"useCompanyLogger",
"biome-ux-plugins/noExternalLinks"
],
"strict": ["useCompanyLogger", "noLegacyLibrary"]
}
}
}

The rules of biome-ux-plugins are now available under @org/biome-plugins. This configuration enables the recommended preset, and useAnimationFallback, a rule from the re-exported minimal preset:

biome.json
{
"plugins": [
"@org/biome-plugins/presets/recommended",
"@org/biome-plugins/useAnimationFallback"
]
}
  1. Create biome-manifest.json at the root of your package. Set the required version field, and map the name of each configuration to its file in configs:

    biome-manifest.json
    {
    "version": 1,
    "configs": [
    { "recommended": "./configs/recommended.json" },
    { "strict": "./configs/strict.json" }
    ]
    }
  2. In package.json, add the manifest and the configuration files to files, and map the biome entry of exports to the manifest:

    package.json
    {
    "name": "@org/biome-configs",
    "version": "1.0.0",
    "files": [
    "biome-manifest.json",
    "configs"
    ],
    "exports": {
    "biome": "./biome-manifest.json"
    }
    }
  3. Publish the package, and install it in the project that uses the configuration. Then extend a configuration by adding <PACKAGE_NAME>/configs/<CONFIG_NAME> to extends:

    biome.json
    {
    "extends": ["@org/biome-configs/configs/strict"]
    }

Re-export configurations from another package

Section titled “Re-export configurations from another package”

Like rules, configurations can come from a dependency. Projects then extend them through your package name, so their configuration keeps working if you replace the underlying configuration later.

To re-export a configuration, add its path as a string to configs. This manifest re-exports the nuxt and astro configurations of the hypothetical biome-ux-plugins package:

biome-manifest.json
{
"version": 1,
"configs": [
"biome-ux-plugins/configs/nuxt",
"biome-ux-plugins/configs/astro",
{ "recommended": "./configs/recommended.json" },
{ "strict": "./configs/strict.json" }
]
}

To extend the nuxt configuration, add @org/biome-configs/configs/nuxt to extends:

biome.json
{
"extends": ["@org/biome-configs/configs/nuxt"]
}

Add the biome-plugin keyword to package.json, so that people can find your package when they search npm:

package.json
{
"name": "@org/biome-configs",
"version": "1.0.0",
"keywords": ["biome-plugin"]
}

Biome versions before v2.6 do not read manifests, but they can extend a configuration that a package exports directly. Use this method only if your package must support those versions.

  1. In package.json, map a ./biome entry of exports to the configuration file. This example exports @org/shared-configs/biome:

    package.json
    {
    "name": "@org/shared-configs",
    "type": "module",
    "exports": {
    "./biome": "./biome.json"
    }
    }
  2. Install @org/shared-configs in the project that uses the configuration, and add @org/shared-configs/biome to extends:

    biome.json
    {
    "extends": ["@org/shared-configs/biome"]
    }

Biome resolves @org/shared-configs from the working directory. For CLI commands, this is the directory where you run the command, usually the one that contains package.json. For the language server, it is the project root.