@codacy/tools-biome-2

中文文档
0.28.0发布于 2026/11/09MITTypeScriptCommonJS近 30 天下载 1.2万

Biome adapter — CLI-mode JavaScript/TypeScript/CSS/JSON linter

原始使用文档
文档目录6 节
  1. Table of Contents
  2. Overview
  3. Updating patterns
  4. Updating the Biome version
  5. Development
  6. Notes for maintainers

@codacy/tools-biome-2

Table of Contents


Overview

JavaScript/TypeScript/CSS/JSON linter using the Biome binary. Biome is a fast web toolchain written in Rust that provides linting, formatting, and import sorting. Uses the CLI execution strategy. The binary comes from the @biomejs/biome npm package, which is an on-demand payload rather than a dependency: install runs npm ci against the committed payload/package-lock.json, so npm picks the right platform binary (including musl) on the machine that runs it.

PropertyValue
Tool IDBiome
Codacy UUID934a97f8-835c-42fc-a6d1-02bdfca3bdfa
StrategyCLI (npm payload, installed on demand)
LanguagesJavaScript, TypeScript, JSX, TSX, JSON, CSS
Binary@biomejs/biome npm package
File patterns**/*.js, **/*.jsx, **/*.ts, **/*.tsx, **/*.json, **/*.css
Pattern count~466

Updating patterns

# Re-fetch pattern metadata from the Codacy API
pnpm prefetch

# Commit the result
git add src/patterns.json

Pattern IDs follow the format Biome_lint_suspicious_noDoubleEquals, Biome_lint_correctness_noUnusedVariables, etc.

Updating the Biome version

  1. Update preferredVersion in src/metadata.ts
  2. Update the @biomejs/biome version in devDependencies of package.json
  3. Run pnpm install to get the new binary
  4. Run pnpm generate-payloads biome-2 from the repo root to re-pin payload/package.json and regenerate its lockfile
  5. Run pnpm prefetch — Biome adds new rules frequently
  6. Run pnpm test to verify compatibility
  7. If the major version changes, create a new adapter package (biome-3/)

Development

pnpm build    # Build with tsup
pnpm test     # Run tests (the payload is a devDependency, so no install is needed)

Notes for maintainers

  • Preset mappings (src/pattern-mappings.json): tags only — Biome's pattern IDs are lint/<group>/<rule> and carry no framework in the path, so the tag is the only signal. drizzle-orm and turborepo were added for the three nursery rules that name those tools. The test- and a11y-tagged rules are deliberately left universal: they only match test or JSX syntax, so they are inert rather than noisy in a repo that has neither.

  • Biome is a standalone Rust binary distributed via the @biomejs/biome npm package with platform-specific optionalDependencies (@biomejs/cli-darwin-arm64, @biomejs/cli-linux-x64, etc.).

  • The adapter resolves the binary from @biomejs/biome/bin/biome (a JS wrapper) and invokes it via node.

  • JSON output via biome lint --reporter=json — the JSON is emitted to stdout, while stderr contains an unstable API warning (filtered by the adapter).

  • Exit code 0 = clean, 1 = issues found (normal), 2+ = error.

  • --config-path accepts a directory path (biome looks for biome.json inside it).

  • Critical gotcha: The generated biome.json must be written to a temp directory outside the repository. Biome 2.x treats any biome.json inside the repo hierarchy as a nested root configuration and errors out with "Found a nested root configuration" if there is already an implicit root at the repo level. Writing to os.tmpdir() avoids this.

  • When patterns are specified, a biome.json config is generated with recommended: false and only the requested rules enabled.

  • Config file search order: biome.json, biome.jsonc, .biome.json, .biome.jsonc.

  • Biome reports 1-based line and column numbers — no conversion needed.

  • File paths in JSON output are relative to the working directory.

版本与发布记录

@codacy/tools-biome-2 共发布 31 个版本,首次发布于 2026/04/10;过去 12 个月发布了 31 个版本。

版本发布日期距今
0.28.0latest2026/11/09今天
0.27.12026/11/054 天前
0.27.02026/11/036 天前
0.26.02026/10/3010 天前
0.25.02026/10/1921 天前
0.24.02026/09/251 个月前

关于 @codacy/tools-biome-2 的常见问题

@codacy/tools-biome-2 是什么?

Biome adapter — CLI-mode JavaScript/TypeScript/CSS/JSON linter

如何安装 @codacy/tools-biome-2?

在项目目录运行 npm install @codacy/tools-biome-2,或使用 pnpm add / yarn add / bun add。

@codacy/tools-biome-2 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@codacy/tools-biome-2 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@codacy/tools-biome-2 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@codacy/tools-biome-2 可以商用吗?

@codacy/tools-biome-2 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@codacy/tools-biome-2 的下载量有多少?

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

@codacy/tools-biome-2 还在维护吗?

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