Publish packages
Biome can resolve configurations and plugins from packages installed in node_modules/. This allows you to publish them once and reuse them across projects.
For Biome v2.6 and later, publish plugins and configurations through a manifest named biome-manifest.json or biome-manifest.jsonc.
A manifest can export plugin rules, rule presets, and configurations.
Publish Biome plugins
Section titled “Publish Biome plugins”Publish Biome plugins as npm packages by declaring their rules and presets in a Biome manifest.
Export a local lint rule
Section titled “Export a local lint rule”-
Create
biome-manifest.jsonin the root of your package. Set the requiredversionfield and add an emptyplugins.rulesarray:biome-manifest.json {"version": 1,"plugins": {"rules": []}} -
Add a sample rule named
useCompanyLoggerby mapping its name to the GritQL file inplugins.rules:biome-manifest.json {"version": 1,"plugins": {"rules": [{ "useCompanyLogger": "./rules/useCompanyLogger.grit" }]}}The
rulesarray accepts objects and strings. Use an object to map a rule name to a GritQL file in your package. Use a string to re-export a rule or preset from a dependency. -
Add the manifest and rule files to the
filesfield inpackage.json. Then add abiomeentry to theexportsfield that maps to the manifest:package.json {"name": "@org/biome-plugins","version": "1.0.0","files": ["biome-manifest.json","rules"],"exports": {"biome": "./biome-manifest.json"}} -
Publish the package, then install
@org/biome-pluginsas a dependency of the consuming project. To enable a rule, add<PACKAGE_NAME>/<RULE_NAME>toplugins:biome.json {"plugins": ["@org/biome-plugins/useCompanyLogger"]}
Export rule presets
Section titled “Export rule presets”Publish groups of related rules as presets by declaring them in a Biome manifest. Presets allow consumers to enable multiple rules together.
-
Add a
plugins.presetsfield. This example definesrecommendedandstrictpresets:biome-manifest.json {"version": 1,"plugins": {"rules": [{ "useCompanyLogger": "./rules/useCompanyLogger.grit" },{ "noLegacyLibrary": "./rules/noLegacyLibrary.grit" }],"presets": {"recommended": ["useCompanyLogger"],"strict": ["useCompanyLogger", "noLegacyLibrary"]}}} -
To enable a preset, add
<PACKAGE_NAME>/presets/<PRESET_NAME>toplugins. This example enables therecommendedpreset:biome.json {"plugins": ["@org/biome-plugins/presets/recommended"]}
Re-export rules from another package
Section titled “Re-export rules from another package”You can re-export rules from dependencies through your package.
The following example uses a hypothetical biome-ux-plugins package and re-exports its minimal preset and its noExternalLinks rule, which is not part of that preset.
-
Add
biome-ux-plugins/noExternalLinksandbiome-ux-plugins/presets/minimaltorules, then addbiome-ux-plugins/noExternalLinksto therecommendedpreset:biome-manifest.json {"version": 1,"plugins": {"rules": ["biome-ux-plugins/noExternalLinks","biome-ux-plugins/presets/minimal",{ "useCompanyLogger": "./rules/useCompanyLogger.grit" },{ "noLegacyLibrary": "./rules/noLegacyLibrary.grit" }],"presets": {"recommended": ["useCompanyLogger","biome-ux-plugins/noExternalLinks"],"strict": ["useCompanyLogger", "noLegacyLibrary"]}}} -
Consumers access re-exported rules through your package name. This keeps rule names and suppression comments stable if you replace the underlying rule.
The following configuration enables the package’s
recommendedpreset anduseAnimationFallback, a rule re-exported frombiome-ux-plugins/presets/minimal:biome.json {"plugins": ["@org/biome-plugins/presets/recommended","@org/biome-plugins/useAnimationFallback"]}
Publish Biome configurations
Section titled “Publish Biome configurations”Publish configurations as npm packages by declaring them in a Biome manifest. To support consumers using a Biome version earlier than v2.6, use the legacy method.
Export multiple configurations
Section titled “Export multiple configurations”-
Create
biome-manifest.jsonin the root of your package. Set the requiredversionfield and map each configuration name to its file inconfigs:biome-manifest.json {"version": 1,"configs": [{ "recommended": "./configs/recommended.json" },{ "strict": "./configs/strict.json" }]} -
Add the manifest and configuration files to the
filesfield inpackage.json. Then add abiomeentry to theexportsfield that maps to the manifest:package.json {"name": "@org/biome-configs","version": "1.0.0","files": ["biome-manifest.json","configs"],"exports": {"biome": "./biome-manifest.json"}} -
Publish the package, then install
@org/biome-configsas a dependency of the consuming project. To extend a configuration, add<PACKAGE_NAME>/configs/<CONFIG_NAME>toextends:biome.json {"extends": ["@org/biome-configs/configs/strict"]}
Re-export configurations from another package
Section titled “Re-export configurations from another package”You can re-export configurations from dependencies through your package.
The following example uses the same hypothetical biome-ux-plugins package and re-exports its nuxt and astro configurations.
-
Add
biome-ux-plugins/configs/nuxtandbiome-ux-plugins/configs/astrotoconfigs:biome-manifest.json {"version": 1,"configs": ["biome-ux-plugins/configs/nuxt","biome-ux-plugins/configs/astro",{ "recommended": "./configs/recommended.json" },{ "strict": "./configs/strict.json" }]} -
Consumers access re-exported configurations through your package name. This keeps configuration references stable if you replace the underlying configuration.
In this example, the configurations from
biome-ux-pluginsare available under@org/biome-configs. To extend thenuxtconfiguration, add@org/biome-configs/configs/nuxt:biome.json {"extends": ["@org/biome-configs/configs/nuxt"]}
Publish and share a configuration (legacy)
Section titled “Publish and share a configuration (legacy)”-
Add a
./biomeentry to theexportsfield that maps to the shared configuration. This example publishes@org/shared-configs/biome:package.json {"name": "@org/shared-configs","type": "module","exports": {"./biome": "./biome.json"}} -
Install
@org/shared-configsin the consuming project, then add@org/shared-configs/biometoextendsinbiome.json:biome.json {"extends": ["@org/shared-configs/biome"]}
Biome resolves @org/shared-configs from the working directory. For CLI commands, this is the directory where the command runs, usually the directory containing package.json. For the Biome Language Server, this is the project root.
Copyright (c) 2023-present Biome Developers and Contributors.