@canonical/biome-config

中文文档
0.44.0发布于 2026/10/23LGPL-3.0零依赖构建来源已验证近 30 天下载 3816

This is a Biome configuration that provides a set of default configurations for Biome projects.

原始使用文档
文档目录4 节
  1. Install
  2. Consume
  3. Configuration
  4. Caveats

@canonical/biome-config

This is a Biome configuration that provides a set of default configurations for Biome projects.

Install

  1. Install Biome: bun add -d @biomejs/biome
  2. Install configuration: bun add -d @canonical/biome-config

Consume

Create biome.json in the root of your project and extend this configuration.

{
  "$schema": "https://biomejs.dev/schemas/2.5.11/schema.json",
  "extends": [
    "@canonical/biome-config"
  ],
  "files": {
    "include": [
      "src",
      "*.json"
    ]
  }
}

Run biome commands as usual. The base configuration will be applied.

Example package.json scripts are provided below.

{
  "scripts": {
    "check": "biome check",
    "format": "biome format",
    "lint": "biome lint"
  }
}

Configuration

This configuration enables the following behavior:

  1. Formatting Rules
    1. Two-space indentation
    2. Double-quote strings
  2. Organized imports
  3. Apply Biome's recommended linting rules by default
  4. Disable version control integration: no interaction with Git
    1. Ignores .gitignore: Explicitly includes all files unless they are ignored manually or other files are included explicitly.
    2. Ignores Git add status: No need to stage files before running biome check or biome format.
  5. Ignores checking all files in node_modules and dist directories. Please note that if you specify your own ignored files using files.ignore in biome.json, you will override this behavior.

Caveats

Monorepos

Biome does not yet fully support monorepos. Biome and IDE plugins that use it may not work as expected if you are working in a monorepo. As a work-around, Biome suggests including a biome.json at the root of a monorepository, and using overrides to specify any exceptions for sub-packages.

Language support

Biome is still in development and may not support all languages or features. We recommend checking the Biome supported languages list to ensure that your project is supported.

Svelte

We include Svelte-specific overrides because Biome does not yet support "cross-language" lint behavior, which can produce false positives for noUnusedVariables, noUnusedImports, useImportType, and useConst.

These lint overrides are temporary and should be removed once biomejs/biome#8590 is resolved.

We keep these overrides directly in @canonical/biome-config (rather than in a separate Svelte-specific config package) because Biome config extension is not transitive. For additional context, see PR #449.

版本与发布记录

@canonical/biome-config 共发布 57 个版本,首次发布于 2024/11/09;过去 12 个月发布了 35 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.44.0latest2026/10/2317 天前
0.43.02026/10/011 个月前
0.43.0-experimental.0experimental2026/09/291 个月前
0.42.02026/09/281 个月前
0.40.02026/09/211 个月前
0.38.02026/09/161 个月前

关于 @canonical/biome-config 的常见问题

@canonical/biome-config 是什么?

This is a Biome configuration that provides a set of default configurations for Biome projects.

如何安装 @canonical/biome-config?

在项目目录运行 npm install @canonical/biome-config,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@biomejs/biome(2.5.15)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@canonical/biome-config 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/canonical__biome-config 是否存在。

@canonical/biome-config 可以商用吗?

@canonical/biome-config 使用 LGPL-3.0 许可。弱 Copyleft:作为库被调用时通常不要求开源你自己的代码,但修改库本身需以 LGPL 开源;前端打包合并后的适用边界存在不同理解。以上为概括,不构成法律意见,请以许可原文为准。

@canonical/biome-config 的下载量有多少?

根据 npm 官方下载统计,@canonical/biome-config 在 2026/10/09 – 2026/11/07 这 30 天内被下载 3,816 次,日均约 127 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@canonical/biome-config 还在维护吗?

最新版本 0.44.0 发布于 2026/10/23(17 天前);至今共发布 57 个版本,其中过去 12 个月发布了 35 个;首次发布于 2024/11/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。