biome
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBiome
Biome
Fast, unified linting, formatting, and import organization for JavaScript, TypeScript, JSX, CSS, and GraphQL. Biome 2.4 provides type-aware linting without the TypeScript compiler, GritQL plugins for custom rules, and domain-based rule grouping. Single binary, zero config by default, 97% Prettier compatibility.
针对JavaScript、TypeScript、JSX、CSS和GraphQL的快速、统一lint、格式化与导入整理工具。Biome 2.4无需TypeScript编译器即可提供类型感知lint能力,支持用于自定义规则的GritQL插件,以及基于领域的规则分组。单二进制文件,默认零配置,与Prettier兼容性达97%。
Critical Rules
关键规则
files.ignore
DOES NOT EXIST - use files.includes
with negation
files.ignorefiles.includesfiles.ignore
不存在 - 请使用带否定模式的files.includes
files.ignorefiles.includesBiome 2.x only supports (with an ). There is NO , NO (without ), NO . Using any of these will throw errors.
files.includessfiles.ignorefiles.includesfiles.excludeFound an unknown keyThe only valid keys under are: , , , .
filesincludesmaxSizeignoreUnknownexperimentalScannerIgnoresTo exclude files (generated code, vendored files, etc.), use negation patterns in :
files.includesjson
{
"files": {
"includes": ["**", "!**/routeTree.gen.ts", "!**/generated/**"]
}
}Do NOT use with to skip generated files - that approach is fragile (easy to miss a subsystem like assists/import organizer) and unnecessarily complex. Just exclude via .
overrideslinter/formatter/assists: { enabled: false }files.includesBiome 2.x仅支持(末尾带s)。不存在、(末尾不带s)、这类配置项,使用任何不存在的配置项都会抛出错误。
files.includesfiles.ignorefiles.includefiles.excludeFound an unknown keyfilesincludesmaxSizeignoreUnknownexperimentalScannerIgnores如果需要排除文件(生成的代码、外部引入的vendored文件等),请在中使用否定模式:
files.includesjson
{
"files": {
"includes": ["**", "!**/routeTree.gen.ts", "!**/generated/**"]
}
}请勿通过配置来跳过生成文件,这种方式非常脆弱(很容易漏掉assists/导入整理这类子系统)且不必要的复杂。直接通过排除即可。
overrideslinter/formatter/assists: { enabled: false }files.includesAlways use biome check
, not separate lint + format
biome check始终使用biome check
,不要分开调用lint和format命令
biome checkbiome checkbiome lintbiome formatbiome checkbiome cibiome checkbiome lintbiome formatbiome checkbiome cibiome.json lives at project root
biome.json需放在项目根目录
Every project needs one at the root. Monorepo packages use nested configs with to inherit from root. Never use relative paths like .
biome.json"extends": "//""extends": ["../../biome.json"]每个项目都需要在根目录放置一个。Monorepo的子包可以使用嵌套配置,通过继承根目录的配置,不要使用这类相对路径。
biome.json"extends": "//""extends": ["../../biome.json"]Use --write
to apply fixes, not --fix
--write--fix使用--write
参数应用修复,不要用--fix
--write--fixbash
biome check --write . # Apply safe fixes
biome check --write --unsafe . # Apply all fixes (review changes)bash
biome check --write . # 应用安全修复
biome check --write --unsafe . # 应用所有修复(请review修改内容)Pin exact versions and migrate after upgrades
锁定精确版本,升级后执行迁移命令
bash
pnpm add --save-dev --save-exact @biomejs/biome@latest
pnpm biome migrate --writebash
pnpm add --save-dev --save-exact @biomejs/biome@latest
pnpm biome migrate --writeQuick Start
快速开始
bash
pnpm add --save-dev --save-exact @biomejs/biome
pnpm biome init # Creates default biome.json with recommended rulesbash
pnpm add --save-dev --save-exact @biomejs/biome
pnpm biome init # 生成带推荐规则的默认biome.jsonIDE Setup
IDE配置
VS Code - Install extension:
biomejs.biomejson
{
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
}
}Zed - Biome extension available natively. The feature (v2.4) lets editors override rules without affecting :
inline_configbiome.jsonjson
{
"formatter": { "language_server": { "name": "biome" } },
"lsp": {
"biome": {
"settings": {
"inline_config": {
"linter": { "rules": { "suspicious": { "noConsole": "off" } } }
}
}
}
}
}VS Code - 安装扩展:
biomejs.biomejson
{
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
}
}Zed - 原生支持Biome扩展。v2.4新增的特性允许编辑器覆盖规则,不会影响配置:
inline_configbiome.jsonjson
{
"formatter": { "language_server": { "name": "biome" } },
"lsp": {
"biome": {
"settings": {
"inline_config": {
"linter": { "rules": { "suspicious": { "noConsole": "off" } } }
}
}
}
}
}CI Integration
CI集成
bash
pnpm biome ci . # No writes, non-zero exit on errors
pnpm biome ci --reporter=default --reporter=github . # GitHub Actions annotationsbash
pnpm biome ci . # 不写入文件,出现错误时返回非0退出码
pnpm biome ci --reporter=default --reporter=github . # 生成GitHub Actions注解Configuration (biome.json)
配置(biome.json)
Recommended config for React/TypeScript projects
React/TypeScript项目推荐配置
json
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"includes": [
"src/**/*.ts", "src/**/*.tsx",
"tests/**/*.ts", "**/*.config.ts", "**/*.json",
"!**/generated", "!**/components/ui"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 120
},
"linter": {
"enabled": true,
"rules": { "recommended": true },
"domains": { "react": "recommended" }
},
"javascript": {
"formatter": { "quoteStyle": "double" }
},
"assist": {
"enabled": true,
"actions": {
"source": { "organizeImports": "on" }
}
}
}json
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"includes": [
"src/**/*.ts", "src/**/*.tsx",
"tests/**/*.ts", "**/*.config.ts", "**/*.json",
"!**/generated", "!**/components/ui"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 120
},
"linter": {
"enabled": true,
"rules": { "recommended": true },
"domains": { "react": "recommended" }
},
"javascript": {
"formatter": { "quoteStyle": "double" }
},
"assist": {
"enabled": true,
"actions": {
"source": { "organizeImports": "on" }
}
}
}Formatter options
格式化选项
Key options: (/), , , (/), . JS-specific: , , , , .
indentStyle"space""tab"indentWidthlineWidthlineEnding"lf""crlf"trailingNewlinequoteStyletrailingCommassemicolonsarrowParenthesesbracketSpacing核心选项:(/)、、、(/)、。JS专属选项:、、、、。
indentStyle"space""tab"indentWidthlineWidthlineEnding"lf""crlf"trailingNewlinequoteStyletrailingCommassemicolonsarrowParenthesesbracketSpacingLinter rule configuration
Lint规则配置
Rules use severity levels , , , or . Some accept options:
"error""warn""info""off"json
{
"linter": {
"rules": {
"recommended": true,
"style": {
"noRestrictedGlobals": {
"level": "error",
"options": {
"deniedGlobals": {
"Buffer": "Use Uint8Array for browser compatibility."
}
}
},
"useComponentExportOnlyModules": "off"
}
}
}
}规则支持、、、四种严重级别,部分规则支持自定义参数:
"error""warn""info""off"json
{
"linter": {
"rules": {
"recommended": true,
"style": {
"noRestrictedGlobals": {
"level": "error",
"options": {
"deniedGlobals": {
"Buffer": "Use Uint8Array for browser compatibility."
}
}
},
"useComponentExportOnlyModules": "off"
}
}
}
}Import organizer
导入整理
The import organizer (Biome Assist) merges duplicates, sorts by distance, and supports custom grouping:
json
{
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": {
"level": "on",
"options": {
"groups": [
{ "source": "builtin" },
{ "source": "external" },
{ "source": "internal", "match": "@company/*" },
{ "source": "relative" }
]
}
}
}
}
}
}导入整理功能(Biome Assist)会合并重复导入、按路径距离排序,支持自定义分组:
json
{
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": {
"level": "on",
"options": {
"groups": [
{ "source": "builtin" },
{ "source": "external" },
{ "source": "internal", "match": "@company/*" },
{ "source": "relative" }
]
}
}
}
}
}
}Per-subsystem includes
子系统级别的includes配置
Each subsystem (, , ) has its own for fine-grained scoping. Applied after - can only narrow, not widen.
linterformatterassistincludesfiles.includesjson
{
"files": {
"includes": ["**", "!**/dist"]
},
"linter": {
"includes": ["**", "!**/components/ui"]
},
"formatter": {
"includes": ["**", "!**/components/ui"]
}
}This lints and formats everything except and , while assists (import organizer) still run on .
dist/components/uicomponents/ui每个子系统(、、)都有独立的配置用于细粒度控制作用范围,该配置会在之后生效,只能缩小范围不能扩大。
linterformatterassistincludesfiles.includesjson
{
"files": {
"includes": ["**", "!**/dist"]
},
"linter": {
"includes": ["**", "!**/components/ui"]
},
"formatter": {
"includes": ["**", "!**/components/ui"]
}
}上述配置会对除了和之外的所有文件执行lint和格式化,而导入整理(assist)仍然会对生效。
dist/components/uicomponents/uiOverrides
Overrides配置
Overrides apply different settings to specific file patterns. Use for per-file rule tweaks (e.g., relaxing rules for vendored/shadcn components). The field is (with ).
includessjson
{
"overrides": [
{
"includes": ["**/components/ui/**"],
"linter": {
"rules": {
"suspicious": { "noDocumentCookie": "off" },
"style": { "useComponentExportOnlyModules": "off" }
}
}
},
{
"includes": ["**/*.test.ts"],
"linter": {
"rules": {
"suspicious": { "noConsole": "off" }
}
}
}
]
}Overrides可以为特定文件模式应用不同的配置,用于针对单个文件调整规则(比如放宽对外部引入/shadcn组件的规则限制)。对应的配置项是(末尾带s)。
includesjson
{
"overrides": [
{
"includes": ["**/components/ui/**"],
"linter": {
"rules": {
"suspicious": { "noDocumentCookie": "off" },
"style": { "useComponentExportOnlyModules": "off" }
}
}
},
{
"includes": ["**/*.test.ts"],
"linter": {
"rules": {
"suspicious": { "noConsole": "off" }
}
}
}
]
}Monorepo configuration
Monorepo配置
Root holds shared config. Package configs inherit with :
biome.json"extends": "//"json
{
"$schema": "../../node_modules/@biomejs/biome/configuration_schema.json",
"extends": "//"
}Override specific rules per package by adding a section alongside .
linter.rules"extends": "//"根目录的存放共享配置,子包的配置通过继承根配置:
biome.json"extends": "//"json
{
"$schema": "../../node_modules/@biomejs/biome/configuration_schema.json",
"extends": "//"
}可以在旁新增配置,为单个子包覆盖特定规则。
"extends": "//"linter.rulesConfiguration file discovery (v2.4)
配置文件查找顺序(v2.4)
Search order: -> -> -> -> platform config home ( on Linux, on macOS).
biome.jsonbiome.jsonc.biome.json.biome.jsonc~/.config/biome~/Library/Application Support/biome查找顺序: -> -> -> -> 平台配置目录(Linux下为,macOS下为)。
biome.jsonbiome.jsonc.biome.json.biome.jsonc~/.config/biome~/Library/Application Support/biomeDomains
领域规则
Domains group lint rules by technology. Enable only what your stack needs:
json
{
"linter": {
"domains": {
"react": "recommended",
"next": "recommended",
"test": "recommended",
"types": "all"
}
}
}| Domain | Purpose | Auto-detected |
|---|---|---|
| React hooks, JSX patterns | |
| Next.js-specific rules | |
| Solid.js rules | |
| Testing best practices (any framework) | - |
| Playwright test rules | |
| Cross-file analysis (noImportCycles, noUnresolvedImports) | - |
| Type inference rules (noFloatingPromises, noMisusedPromises) | - |
Activation levels: (stable rules only), (includes nursery), (disable).
"recommended""all""none"The domain enables rules needing the module graph. The domain (v2.4) enables rules requiring type inference. Both trigger a file scan that adds a small overhead.
projecttypes领域规则按技术栈对lint规则进行分组,你可以只启用你技术栈需要的规则:
json
{
"linter": {
"domains": {
"react": "recommended",
"next": "recommended",
"test": "recommended",
"types": "all"
}
}
}| 领域 | 用途 | 自动检测条件 |
|---|---|---|
| React hooks、JSX规范检查 | 存在 |
| Next.js专属规则 | 存在 |
| Solid.js规则 | 存在 |
| 通用测试最佳实践(兼容所有测试框架) | - |
| Playwright测试规则 | 存在 |
| 跨文件分析(noImportCycles、noUnresolvedImports) | - |
| 类型推导规则(noFloatingPromises、noMisusedPromises) | - |
启用级别: (仅启用稳定规则)、(包含实验性nursery规则)、(禁用)。
"recommended""all""none"projecttypesType-Aware Linting
类型感知Lint
Biome 2.0 introduced type-aware linting without the TypeScript compiler. Biome has its own type inference engine in Rust - no dependency needed.
typescriptBiome 2.0引入了无需TypeScript编译器的类型感知lint能力,Biome使用Rust自研的类型推导引擎,不需要依赖包。
typescriptHow it works
工作原理
Enable the domain to activate file scanning and type inference. Performance impact is minimal compared to typescript-eslint because inference runs natively.
types启用领域即可激活文件扫描和类型推导,相比typescript-eslint,由于推导是原生执行的,性能影响极小。
typesKey rules
核心规则
| Rule | What it catches |
|---|---|
| Unhandled promises (missing await/return/void) |
| Promises in conditionals, array callbacks |
| Awaiting non-thenable values |
| Conditions that are always true/false |
| |
| |
| |
| 规则 | 检查内容 |
|---|---|
| 未处理的promise(缺少await/return/void标记) |
| 在条件判断、数组回调中错误使用promise |
| 对非thenable的值使用await |
| 永远为真/假的条件判断 |
| 应该使用 |
| 应该使用 |
| 调用 |
noFloatingPromises
noFloatingPromises
The most impactful type-aware rule. Detects unhandled promises:
ts
// ERROR: floating promise
async function loadData() {
fetch("/api/data");
}
// VALID: awaited
async function loadData() {
await fetch("/api/data");
}
// VALID: explicitly voided (fire-and-forget)
async function loadData() {
void fetch("/api/data");
}Detects ~75% of cases compared to typescript-eslint, improving each release.
最有价值的类型感知规则,可以检测未处理的promise:
ts
// 报错:floating promise
async function loadData() {
fetch("/api/data");
}
// 合法:加了await
async function loadData() {
await fetch("/api/data");
}
// 合法:显式void标记(发后不管场景)
async function loadData() {
void fetch("/api/data");
}相比typescript-eslint,该规则可以检测约75%的场景,每个版本都会持续优化。
Limitations vs typescript-eslint
与typescript-eslint相比的局限
- Complex generic type inference may miss some cases
- Not a full type checker - handles common patterns, not every edge case
- Rules still in nursery - expect improvements with each release
- Major performance advantage: fraction of tsc-based linting time
- 复杂的泛型推导可能会漏掉部分场景
- 不是完整的类型检查器,仅覆盖常见场景,不会处理所有边界case
- 规则仍在迭代中,每个版本都会持续优化
- 巨大的性能优势:耗时仅为基于tsc的lint的几分之一
GritQL Custom Rules
GritQL自定义规则
GritQL is a declarative pattern-matching language for custom lint rules. Create files and register them as plugins.
.gritjson
{ "plugins": ["./lint-rules/no-object-assign.grit"] }GritQL是用于编写自定义lint规则的声明式模式匹配语言,你可以创建文件并将其注册为插件。
.gritjson
{ "plugins": ["./lint-rules/no-object-assign.grit"] }Examples
示例
Ban :
Object.assigngrit
`$fn($args)` where {
$fn <: `Object.assign`,
register_diagnostic(
span = $fn,
message = "Prefer object spread instead of `Object.assign()`"
)
}CSS - enforce color classes:
grit
language css;
`$selector { $props }` where {
$props <: contains `color: $color` as $rule,
not $selector <: r"\.color-.*",
register_diagnostic(
span = $rule,
message = "Don't set explicit colors. Use `.color-*` classes instead."
)
}禁止使用:
Object.assigngrit
`$fn($args)` where {
$fn <: `Object.assign`,
register_diagnostic(
span = $fn,
message = "Prefer object spread instead of `Object.assign()`"
)
}CSS - 强制使用颜色类:
grit
language css;
`$selector { $props }` where {
$props <: contains `color: $color` as $rule,
not $selector <: r"\.color-.*",
register_diagnostic(
span = $rule,
message = "Don't set explicit colors. Use `.color-*` classes instead."
)
}Plugin API
插件API
register_diagnostic()- -
severity,"hint","info","warn"(default:"error")"error" - (required) - diagnostic message
message - (required) - syntax node to highlight
span
Supported target languages: JavaScript (default), CSS, JSON (v2.4). Profile with .
biome lint --profile-rules .register_diagnostic()- -
severity、"hint"、"info"、"warn"(默认:"error")"error" - (必填) - 诊断提示信息
message - (必填) - 需要高亮的语法节点
span
支持的目标语言:JavaScript(默认)、CSS、JSON(v2.4新增)。可以通过分析规则性能。
biome lint --profile-rules .Suppression Patterns
忽略规则的方式
Single-line
单行忽略
ts
// biome-ignore lint/suspicious/noConsole: needed for debugging
console.log("debug info");ts
// biome-ignore lint/suspicious/noConsole: 用于调试
console.log("debug info");File-level
整个文件忽略
ts
// biome-ignore-all lint/suspicious/noConsole: logger modulets
// biome-ignore-all lint/suspicious/noConsole: 日志模块Range
范围忽略
ts
// biome-ignore-start lint/style/useConst: legacy code
let x = 1;
let y = 2;
// biome-ignore-end lint/style/useConst
const a = 4; // this line IS checkedbiome-ignore-endts
// biome-ignore-start lint/style/useConst: 遗留代码
let x = 1;
let y = 2;
// biome-ignore-end lint/style/useConst
const a = 4; // 该行仍会被检查biome-ignore-endMigration
迁移指南
From ESLint
从ESLint迁移
bash
pnpm biome migrate eslint --write
pnpm biome migrate eslint --write --include-inspired # Include non-identical rulesSupports legacy and flat configs, resolution, plugins (typescript-eslint, react, jsx-a11y, unicorn), .
extends.eslintignorebash
pnpm biome migrate eslint --write
pnpm biome migrate eslint --write --include-inspired # 包含非完全等价的规则支持legacy和flat配置、解析、插件(typescript-eslint、react、jsx-a11y、unicorn)、文件。
extends.eslintignoreFrom Prettier
从Prettier迁移
bash
pnpm biome migrate prettier --writeMaps -> , -> , -> , -> .
tabWidthindentWidthuseTabsindentStylesingleQuotequoteStyletrailingCommatrailingCommasbash
pnpm biome migrate prettier --write自动映射配置: -> 、 -> 、 -> 、 -> 。
tabWidthindentWidthuseTabsindentStylesingleQuotequoteStyletrailingCommatrailingCommasFrom ESLint + Prettier combo
从ESLint + Prettier组合迁移
bash
pnpm biome migrate eslint --write
pnpm biome migrate prettier --write
pnpm remove eslint prettier eslint-config-prettier eslint-plugin-prettier \
@typescript-eslint/parser @typescript-eslint/eslint-plugin
rm .eslintrc* .prettierrc* .eslintignore .prettierignoreEnable VCS integration since ESLint respects gitignore by default:
json
{ "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true } }bash
pnpm biome migrate eslint --write
pnpm biome migrate prettier --write
pnpm remove eslint prettier eslint-config-prettier eslint-plugin-prettier \
@typescript-eslint/parser @typescript-eslint/eslint-plugin
rm .eslintrc* .prettierrc* .eslintignore .prettierignore由于ESLint默认会遵循gitignore,所以请开启VCS集成:
json
{ "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true } }CLI Reference
CLI参考
biome check (primary command)
biome check(核心命令)
bash
biome check . # Check all files
biome check --write . # Apply safe fixes
biome check --write --unsafe . # Apply all fixes
biome check --changed . # Only VCS-changed files
biome check --staged . # Only staged filesbash
biome check . # 检查所有文件
biome check --write . # 应用安全修复
biome check --write --unsafe . # 应用所有修复
biome check --changed . # 仅检查VCS修改过的文件
biome check --staged . # 仅检查暂存区的文件biome ci (CI mode)
biome ci(CI模式)
bash
biome ci . # No writes, exit code on errors
biome ci --reporter=github . # GitHub annotations
biome ci --reporter=sarif --reporter-file=report.sarif . # SARIF outputbash
biome ci . # 不写入文件,出现错误时返回非0退出码
biome ci --reporter=github . # 生成GitHub注解
biome ci --reporter=sarif --reporter-file=report.sarif . # 输出SARIF格式报告biome lint
biome lint
bash
biome lint --only=suspicious/noDebugger . # Single rule
biome lint --skip=project . # Skip domain
biome lint --only=types . # Only type-aware rules
biome lint --error-on-warnings . # Warnings become errorsbash
biome lint --only=suspicious/noDebugger . # 仅执行单个规则
biome lint --skip=project . # 跳过指定领域的规则
biome lint --only=types . # 仅执行类型感知规则
biome lint --error-on-warnings . # 将警告视为错误Other commands
其他命令
bash
biome format --write . # Format only
biome search '`console.$method($args)`' . # GritQL pattern search
biome rage # Debug info for bug reports
biome explain noFloatingPromises # Explain a rulebash
biome format --write . # 仅执行格式化
biome search '`console.$method($args)`' . # 执行GritQL模式搜索
biome rage # 导出用于提交bug报告的调试信息
biome explain noFloatingPromises # 查看规则说明Best Practices
最佳实践
- Use as your single command - combines format, lint, and import organization
biome check - Start with - disable individual rules as needed
recommended: true - Enable relevant domains - ,
react,next,testbased on your stacktypes - Enable VCS integration - respects , enables
.gitignore/--changed--staged - Use in pipelines - never writes files, clear exit codes
biome ci - Pin exact versions - avoid surprise rule changes between releases
- Run after every upgrade
biome migrate --write - Use in pre-commit hooks:
--stagedbiome check --staged --write --no-errors-on-unmatched . - Profile slow rules with (v2.4)
biome lint --profile-rules - Use GritQL plugins for project-specific patterns instead of disabling rules globally
- 使用作为统一命令 - 整合了格式化、lint和导入整理功能
biome check - 从开始 - 按需禁用单个规则即可
recommended: true - 启用相关领域规则 - 根据你的技术栈启用、
react、next、test等领域types - 开启VCS集成 - 自动遵循,支持
.gitignore/--changed参数--staged - 在CI流程中使用- 不会写入文件,退出码清晰
biome ci - 锁定精确版本 - 避免版本升级带来的规则意外变更
- 每次升级后执行
biome migrate --write - 在pre-commit钩子中使用参数:
--stagedbiome check --staged --write --no-errors-on-unmatched . - 使用分析慢规则(v2.4新增)
biome lint --profile-rules - 使用GritQL插件实现项目专属规则,不要全局禁用规则
Gotchas
注意事项
These are real mistakes that have caused broken configs, dirty working trees, and wasted debugging time. Read before writing any Biome config.
-
,
files.ignore,files.includedo not exist. Onlyfiles.exclude(withfiles.includes). Biome will throwsfor anything else. See the first critical rule above.Found an unknown key -
is NOT a top-level config key. In Biome 2.x it moved under
organizeImports. Using it at the top level is a config error.assist.actions.source.organizeImports -
that disable
overrides+linterstill runformatter. If you use overrides to skip a generated file, the import organizer (an assist action) will still rewrite it. This silently dirties your working tree. Useassistnegation to fully exclude a file instead.files.includes -
field is
overrides(withincludes), nots. Same naming asinclude.files.includes -
runs formatter + linter + assists in one pass. Any of these three can modify files. If a generated file keeps getting dirtied after
biome check --write, check which subsystem is touching it - it's often the import organizer (assist), not the formatter or linter.check --write -
does not exist. The flag is
--fix.--writewill silently do nothing or error.--fix
这些都是实际出现过的错误,会导致配置失效、工作区被意外修改、浪费调试时间,编写Biome配置前请仔细阅读。
-
、
files.ignore、files.include不存在,仅支持files.exclude(末尾带s),使用其他配置项Biome会抛出files.includes错误,参考上文第一条关键规则。Found an unknown key -
不是顶层配置项,在Biome 2.x中该配置已经移动到
organizeImports下,在顶层使用会触发配置错误。assist.actions.source.organizeImports -
禁用和
linter的formatter配置仍然会执行overrides,如果你使用overrides跳过生成文件,导入整理(assist动作)仍然会修改该文件,会悄无声息地污染你的工作区。请使用assist否定模式来完全排除文件。files.includes -
的匹配字段是
overrides(末尾带s),不是includes,命名规则和include一致。files.includes -
会一次执行格式化、lint和assist,三个子系统都可能修改文件。如果某个生成文件在执行
biome check --write后总是被修改,请检查是哪个子系统修改了它,通常是导入整理(assist)而不是格式化或lint。check --write -
参数不存在,对应的参数是
--fix,使用--write会静默无响应或者报错。--fix
Resources
参考资源
- Biome Docs: https://biomejs.dev/
- Biome GitHub: https://github.com/biomejs/biome
- GritQL Docs: https://docs.grit.io/
- Biome v2 Blog: https://biomejs.dev/blog/biome-v2/
- Biome v2.4 Blog: https://biomejs.dev/blog/biome-v2-4/
- Migration Guide: https://biomejs.dev/guides/migrate-eslint-prettier/
- Rules Reference: https://biomejs.dev/linter/javascript/rules/
- Domains: https://biomejs.dev/linter/domains/
- Plugins: https://biomejs.dev/linter/plugins/
For detailed lint rules by category with code examples, see rules-reference.md.
- Biome官方文档: https://biomejs.dev/
- Biome GitHub仓库: https://github.com/biomejs/biome
- GritQL文档: https://docs.grit.io/
- Biome v2发布博客: https://biomejs.dev/blog/biome-v2/
- Biome v2.4发布博客: https://biomejs.dev/blog/biome-v2-4/
- 迁移指南: https://biomejs.dev/guides/migrate-eslint-prettier/
- 规则参考: https://biomejs.dev/linter/javascript/rules/
- 领域规则: https://biomejs.dev/linter/domains/
- 插件文档: https://biomejs.dev/linter/plugins/
如需查看按分类整理的带代码示例的lint规则详情,请参考rules-reference.md。