配置
$schema
Section titled “$schema”允许传递一个JSON模式文件的路径。
我们为 biome.json/biome.jsonc 文件发布了一个JSON模式文件。
如果 @biomejs/biome 安装在 node_modules 文件夹中,你可以指定一个相对路径到 @biomejs/biome npm包的模式:
{  "$schema": "./node_modules/@biomejs/biome/configuration_schema.json"}如果你在解析物理文件时遇到问题,你可以使用在这个网站发布的文件:
{  "$schema": "https://biomejs.dev/schemas/2.0.5/schema.json"}extends
Section titled “extends”一个指向其他 Biome 配置文件的路径列表。Biome 解析并应用 extends 列表中包含的文件的配置设置,最终应用此 biome.json/biome.jsonc 文件中包含的选项。
扩展路径的顺序从最不相关到最相关。
从v2开始,此选项接受必须匹配值 "//" 的字符串,可用于设置单体仓库
此配置是否应被视为根配置。默认情况下,任何配置文件都被视为根配置。
当配置文件是”嵌套配置”时,必须设置 "root": false,否则会抛出错误。
这是必需的,以便Biome可以同时在CLI和编辑器中协调多个文件。
默认值:
true
files.includes
Section titled “files.includes”要处理的文件的glob模式列表。
如果文件夹匹配glob模式,该文件夹内的所有文件都将被处理。
以下示例匹配 src 文件夹内所有扩展名为 .js 的文件:
{  "files": {    "includes": ["src/**/*.js"]  }}* 用于匹配文件夹中的所有文件,而 ** 递归地匹配文件夹中的所有文件和子文件夹。有关glob的更多信息,请参阅glob语法参考
includes 也支持否定模式或例外。这些是以 ! 开头的模式,可用于指示Biome处理所有文件除了匹配否定模式的文件。使用否定模式时,应始终首先指定 ** 以匹配所有文件和文件夹,否则否定模式将不匹配任何文件。
请注意,例外按顺序处理,允许你指定例外的例外。
考虑以下示例:
{  "files": {    "includes": ["**", "!**/*.test.js", "**/special.test.js", "!test"]  }}此示例指定:
- 所有(子)文件夹内的所有文件都会被处理,这要归功于 
**模式… - … 除了那些扩展名为 
.test.js的文件… - … 但文件 
special.test.ts仍然会被处理… - … 除了当它出现在名为 
test的文件夹中时,因为该文件夹内的所有文件都不会被处理。 
这意味着:
src/app.js会被处理。src/app.test.js不会被处理。src/special.test.js会被处理。test/special.test.js不会被处理。
关于Biome扫描器的说明
Section titled “关于Biome扫描器的说明”Biome有一个扫描器,负责发现 .gitignore 文件以及在启用项目域的任何规则时索引项目。
扫描器大多遵循 files.includes 设置,但有一些例外。有关更多信息,请参阅扫描器文档。
files.ignoreUnknown
Section titled “files.ignoreUnknown”如果为 true,当Biome遇到无法处理的文件时,它不会发出诊断信息。
{  "files": {    "ignoreUnknown": true  }}默认值:
false
files.maxSize
Section titled “files.maxSize”源代码文件的最大允许大小(字节)。超过此限制的文件将出于性能原因被忽略。
默认值:
1048576(1024*1024, 1MB)
files.experimentalScannerIgnores
Section titled “files.experimentalScannerIgnores”扫描器在爬取过程中应忽略的文字路径数组。被忽略的文件不会被索引,这意味着这些文件不会成为模块图的一部分,也不会从中推断类型。
在以下示例中,文件夹 lodash 和 dist 以及文件 RedisCommander.d.ts 将被忽略:
{  "files" : {    "experimentalScannerIgnores": [      "lodash",      "dist",      "RedisCommander.d.ts"    ]  }}你应该只在 Biome 需要很长时间来检查你的项目的情况下,才开启该配置作为兜底方案。该配置不支持(Glob)路径,只匹配基本名称。
有关更多信息,请参阅扫描器文档。
一组用于将 Biome 与 VCS(版本控制软件)集成的属性。
vcs.enabled
Section titled “vcs.enabled”是否应让Biome与VCS客户端集成
默认值:
false
vcs.clientKind
Section titled “vcs.clientKind”客户端种类。
值:
"git"
vcs.useIgnoreFile
Section titled “vcs.useIgnoreFile”Biome是否应使用项目的VCS忽略文件。当 true 时,Biome将忽略VCS忽略文件中指定的文件以及 .ignore 文件中指定的文件。
vcs.root
Section titled “vcs.root”Biome应检查VCS文件的文件夹。默认情况下,Biome将使用找到 biome.json 的同一文件夹。
如果Biome找不到配置,它将尝试使用当前工作目录。如果找不到当前工作目录,Biome将不使用VCS集成,并将发出诊断。
vcs.defaultBranch
Section titled “vcs.defaultBranch”项目的主分支。Biome在评估更改的文件时将使用此分支。
linter
Section titled “linter”linter.enabled
Section titled “linter.enabled”启用Biome的linter
默认值:
true
linter.includes
Section titled “linter.includes”要lint的文件的glob模式列表。
以下示例lint src 文件夹内所有扩展名为 .js 的文件:
{  "linter": {    "includes": ["src/**/*.js"]  }}* 用于匹配文件夹中的所有文件,而 ** 递归地匹配文件夹中的所有文件和子文件夹。有关glob的更多信息,请参阅glob语法参考
includes 也支持否定模式或例外。这些是以 ! 开头的模式,可用于指示Biome处理所有文件除了匹配否定模式的文件。
请注意,例外按顺序处理,允许你指定例外的例外。
考虑以下示例:
{  "linter": {    "includes": ["**", "!**/*.test.js", "**/special.test.js"]  }}此示例指定:
- 所有(子)文件夹内的所有文件都会被lint,这要归功于 
**模式… - … 除了那些扩展名为 
.test.js的文件… - … 但文件 
special.test.ts仍然会被lint。 
这意味着:
src/app.js会被 lint 校验。src/app.test.js不会被lint。src/special.test.js会被lint。
请注意,linter.includes 在 files.includes 之后应用。这意味着任何不匹配 files.includes 的文件都不能再匹配 linter.includes。这意味着以下示例不起作用:
{  "files": {    "includes": "src/**"  },  "linter": {    // 这不匹配任何内容,因为与 `files.includes` 没有重叠:    "includes": "scripts/**"  }}如果未指定 linter.includes,则所有匹配 files.includes 的文件都会被lint。
linter.rules.recommended
Section titled “linter.rules.recommended”启用所有组的推荐规则。
默认值:
true
linter.rules.[group]
Section titled “linter.rules.[group]”影响单个组规则的选项。Biome支持以下组:
- accessibility: 专注于防止可访问性问题的规则。
 - complexity: 专注于检查可以简化的复杂代码的规则。
 - correctness: 检测保证不正确或无用的代码的规则。
 - nursery: 仍在开发中的新规则。由于nursery规则可能仍有错误或性能问题,因此在稳定版本上需要通过配置明确选择加入。它们在nightly构建上默认启用,但由于它们不稳定,其诊断严重性可能设置为错误或警告,这取决于我们在规则最终稳定时是否打算将其推荐。nursery规则一旦稳定就会被提升到其他组,或者可能被删除。属于此组的规则不受语义版本的约束。
 - performance: 捕获代码可以运行得更快或通常更高效的方式的规则。
 - security: 检测潜在安全漏洞的规则。
 - style: 强制一致和惯用的代码编写方式的规则。
 - suspicious: 检测可能不正确或无用的代码的规则。
 
每个组可以接受一个表示严重性的字符串作为值,或者一个可以配置每个规则的对象。
当传递严重性时,你可以控制属于一个组的所有规则发出的严重性。
例如,你可以配置 a11y 组发出信息诊断:
{  "linter": {    "rules": {      "a11y": "info"    }  }}以下是接受的值:
"on": 属于该组的每个规则将发出具有该规则默认严重性的诊断。请参阅规则的文档,或使用explain命令:Terminal window biome explain noDebugger"off": 属于该组的所有规则都不会发出任何诊断。"info": 属于该组的所有规则将发出信息严重性的诊断。"warn": 属于该组的所有规则将发出警告严重性的诊断。"error": 属于该组的所有规则将发出错误严重性的诊断。
linter.rules.[group].recommended
Section titled “linter.rules.[group].recommended”启用单个组的推荐规则。
例子:
{  "linter": {    "enabled": true,    "rules": {      "nursery": {        "recommended": true      }    }  }}formatter
Section titled “formatter”这些选项适用于所有语言。以下还有一些特定于语言的格式化选项。
formatter.enabled
Section titled “formatter.enabled”启用Biome的格式化器
默认值:
true
formatter.includes
Section titled “formatter.includes”要格式化的文件的glob模式列表。
以下示例格式化 src 文件夹内所有扩展名为 .js 的文件:
{  "formatter": {    "includes": ["src/**/*.js"]  }}* 用于匹配文件夹中的所有文件,而 ** 递归地匹配文件夹中的所有文件和子文件夹。有关glob的更多信息,请参阅glob语法参考
includes 也支持否定模式或例外。这些是以 ! 开头的模式,可用于指示Biome处理所有文件除了匹配否定模式的文件。
请注意,例外按顺序处理,允许你指定例外的例外。
考虑以下示例:
{  "formatter": {    "includes": ["**", "!**/*.test.js", "**/special.test.js"]  }}此示例指定:
- 所有(子)文件夹内的所有文件都会被格式化,这要归功于 
**模式… - … 除了那些扩展名为 
.test.js的文件… - … 但文件 
special.test.ts仍然会被格式化。 
这意味着:
src/app.js会被格式化。src/app.test.js不会被格式化。src/special.test.js会被格式化。
请注意,formatter.includes 在 files.includes 之后应用。这意味着任何不匹配 files.includes 的文件都不能再匹配 formatter.includes。这意味着以下示例不起作用:
{  "files": {    "includes": "src/**"  },  "formatter": {    // 这不匹配任何内容,因为与 `files.includes` 没有重叠:    "includes": "scripts/**"  }}如果未指定 formatter.includes,则所有匹配 files.includes 的文件都会被格式化。
formatter.formatWithErrors
Section titled “formatter.formatWithErrors”允许格式化包含语法错误的文档。
{  "formatter": {    "formatWithErrors": true  }}默认值:
false
formatter.indentStyle
Section titled “formatter.indentStyle”缩进的样式。可以是"tab"或"space"。
默认值:
"tab"
formatter.indentWidth
Section titled “formatter.indentWidth”缩进应该是多大。
默认值:
2
formatter.lineEnding
Section titled “formatter.lineEnding”行结束的类型。
"lf", 仅换行符(\n),在Linux和macOS以及git仓库内部常见;"crlf", 回车 + 换行字符(\r\n),在Windows上常见;"cr", 仅回车字符(\r),非常罕见。
默认值:
"lf"
formatter.lineWidth
Section titled “formatter.lineWidth”一行可以写多少个字符。
默认值:
80
formatter.attributePosition
Section titled “formatter.attributePosition”HTMLish语言中的属性位置样式。
"auto", 属性会自动格式化,只有在达到某些标准时才会在多行中折叠;"multiline", 如果使用了多于1个属性,属性将在多行中折叠。
默认值:
"auto"
formatter.bracketSpacing
Section titled “formatter.bracketSpacing”选择是否在括号和内部值之间添加空格。
默认值:
true
formatter.expand
Section titled “formatter.expand”是否在多行上展开数组和对象。
"auto", 如果第一个属性有换行符,对象字面量将在多行上格式化, 如果数组字面量适合一行,则在单行上格式化。"always", 这些字面量将在多行上格式化,无论列表的长度如何。"never", 如果这些字面量适合一行,则在单行上格式化。
格式化 package.json 时,Biome将使用 always,除非另有配置。
默认值:
"auto"
formatter.useEditorconfig
Section titled “formatter.useEditorconfig”Biome是否应使用 .editorconfig 文件来确定格式化选项。
配置文件 .editorconfig 和 biome.json 将遵循以下规则:
biome.json中的格式化设置始终优先于.editorconfig文件。- 在层次结构中比 
biome.json文件更高的.editorconfig文件已经被忽略。这是为了避免将某人的主目录中的格式化设置加载到带有biome.json文件的项目中。 - 当前不支持嵌套的 
.editorconfig文件。 
默认值:
false
javascript
Section titled “javascript”这些选项仅适用于JavaScript (和TypeScript) 文件。
javascript.parser.unsafeParameterDecoratorsEnabled
Section titled “javascript.parser.unsafeParameterDecoratorsEnabled”允许支持不安全/实验性参数装饰器。
{  "javascript": {    "parser": {      "unsafeParameterDecoratorsEnabled": true    }  }}默认值:
false
javascript.parser.jsxEverywhere
Section titled “javascript.parser.jsxEverywhere”当设置为 true 时,允许在 .js 文件中解析JSX语法。当设置为 false 时,Biome将在遇到 .js 文件中的JSX语法时发出诊断信息。
默认值:
true
{  "javascript": {    "parser": {      "jsxEverywhere": false    }  }}javascript.formatter.quoteStyle
Section titled “javascript.formatter.quoteStyle”表示字符串字面值时使用的引号类型。可以是 "single" 或 "double"。
默认值:
"double"
javascript.formatter.jsxQuoteStyle
Section titled “javascript.formatter.jsxQuoteStyle”表示jsx字符串字面值时使用的引号类型。可以是 "single" 或 "double"。
默认值:
"double"
{  "javascript": {    "formatter": {      "jsxQuoteStyle": "single"    }  }}javascript.formatter.quoteProperties
Section titled “javascript.formatter.quoteProperties”对象内属性何时应该被引号包围。可以是 "asNeeded" 或 "preserve"。
默认值:
"asNeeded"
{  "javascript": {    "formatter": {      "quoteProperties": "preserve"    }  }}javascript.formatter.trailingCommas
Section titled “javascript.formatter.trailingCommas”在多行逗号分隔的语法结构中尽可能地打印尾随逗号。可能的值:
"all", 尾随逗号总是被添加;"es5", 尾随逗号只在旧版本的JavaScript支持的地方被添加;"none", 尾随逗号从不被添加。
默认值:
"all"
javascript.formatter.semicolons
Section titled “javascript.formatter.semicolons”配置格式化器在哪里打印分号:
"always", 在每个语句的末尾总是添加分号;"asNeeded", 只在需要的地方添加分号,以防止ASI。
默认值:
"always"
例子:
{  "javascript": {    "formatter": {      "semicolons": "asNeeded"    }  }}javascript.formatter.arrowParentheses
Section titled “javascript.formatter.arrowParentheses”是否在箭头函数中添加非必须的括号:
"always", 括号总是被添加;"asNeeded", 只在需要时添加括号。
默认值:
"always"
javascript.formatter.enabled
Section titled “javascript.formatter.enabled”启用Biome的格式化器用于JavaScript (和其超级语言) 文件。
默认值:
true
javascript.formatter.indentStyle
Section titled “javascript.formatter.indentStyle”JavaScript (和其超级语言) 文件的缩进样式。可以是"tab"或"space"。
默认值:
"tab"
javascript.formatter.indentWidth
Section titled “javascript.formatter.indentWidth”JavaScript (和其超级语言) 文件的缩进应该是多大。
默认值:
2
javascript.formatter.lineEnding
Section titled “javascript.formatter.lineEnding”JavaScript (和其超级语言) 文件的行结束类型。
"lf", 仅换行符(\n),在Linux和macOS以及git仓库内部常见;"crlf", 回车 + 换行字符(\r\n),在Windows上常见;"cr", 仅回车字符(\r),非常罕见。
默认值:
"lf"
javascript.formatter.lineWidth
Section titled “javascript.formatter.lineWidth”在JavaScript (和其超级语言) 文件中一行可以写多少个字符。
默认值:
80
javascript.formatter.bracketSameLine
Section titled “javascript.formatter.bracketSameLine”选择多行JSX元素的结束 > 是否应该在最后一个属性行上
默认值:
false
javascript.formatter.bracketSpacing
Section titled “javascript.formatter.bracketSpacing”选择是否在括号和内部值之间添加空格。
默认值:
true
javascript.formatter.attributePosition
Section titled “javascript.formatter.attributePosition”jsx元素中的属性位置样式。
"auto", 不强制每行单个属性。"multiline", 强制每行单个属性。
默认值:
"auto"
javascript.formatter.expand
Section titled “javascript.formatter.expand”是否在多行上展开数组和对象。
"auto", 如果第一个属性有换行符,对象字面量将在多行上格式化, 如果数组字面量适合一行,则在单行上格式化。"always", 这些字面量将在多行上格式化,无论列表的长度如何。"never", 如果这些字面量适合一行,则在单行上格式化。
默认值:
"auto"
javascript.globals
Section titled “javascript.globals”Biome应忽略的全局名称列表(分析器,linter等)
{  "javascript": {    "globals": ["$", "_", "externalVariable"]  }}javascript.jsxRuntime
Section titled “javascript.jsxRuntime”指示用于解释JSX的运行时或转换类型。
"transparent"— 表示现代或原生JSX环境,不需要Biome的特殊处理。"reactClassic"— 表示需要React导入的经典React环境。对应于TypeScript的tsconfig.json中jsx选项的react值。
{  "javascript": {    "jsxRuntime": "reactClassic"  }}有关旧版与新版JSX运行时的更多信息,请参阅: https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
默认值:
"transparent"
javascript.linter.enabled
Section titled “javascript.linter.enabled”启用Biome的linter用于JavaScript (和其超级语言) 文件。
默认值:
true
{  "javascript": {    "linter": {      "enabled": false    }  }}javascript.assist.enabled
Section titled “javascript.assist.enabled”启用Biome的assist用于JavaScript (和其超级语言) 文件。
默认值:
true
{  "javascript": {    "assist": {      "enabled": false    }  }}应用于JSON文件的选项。
json.parser.allowComments
Section titled “json.parser.allowComments”在JSON文件中启用注释的解析。
{  "json": {    "parser": {      "allowComments": true    }  }}json.parser.allowTrailingCommas
Section titled “json.parser.allowTrailingCommas”在JSON文件中启用尾随逗号的解析。
{  "json": {    "parser": {      "allowTrailingCommas": true    }  }}json.formatter.enabled
Section titled “json.formatter.enabled”启用Biome的格式化器用于JSON (和其超级语言) 文件。
默认值:
true
{  "json": {    "formatter": {      "enabled": false    }  }}json.formatter.indentStyle
Section titled “json.formatter.indentStyle”JSON (和其超级语言) 文件的缩进样式。可以是"tab"或"space"。
默认值:
"tab"
json.formatter.indentWidth
Section titled “json.formatter.indentWidth”JSON (和其超级语言) 文件的缩进应该是多大。
默认值:
2
json.formatter.lineEnding
Section titled “json.formatter.lineEnding”JSON (和其超级语言) 文件的行结束类型。
"lf", 仅换行符(\n),在Linux和macOS以及git仓库内部常见;"crlf", 回车 + 换行字符(\r\n),在Windows上常见;"cr", 仅回车字符(\r),非常罕见。
默认值:
"lf"
json.formatter.lineWidth
Section titled “json.formatter.lineWidth”在JSON (和其超级语言) 文件中一行可以写多少个字符。
默认值:
80
json.formatter.trailingCommas
Section titled “json.formatter.trailingCommas”在多行逗号分隔的语法结构中尽可能地打印尾随逗号。
允许的值:
"none": 尾随逗号被移除;"all": 尾随逗号被保留并且优先。
默认值:
"none"
json.formatter.bracketSpacing
Section titled “json.formatter.bracketSpacing”选择是否在括号和内部值之间添加空格。
默认值:
true
json.formatter.expand
Section titled “json.formatter.expand”是否在多行上展开数组和对象。
"auto", 如果第一个属性有换行符,对象字面量将在多行上格式化, 如果数组字面量适合一行,则在单行上格式化。"always", 这些字面量将在多行上格式化,无论列表的长度如何。"never", 如果这些字面量适合一行,则在单行上格式化。
格式化 package.json 时,Biome将使用 always,除非另有配置。
默认值:
"auto"
json.linter.enabled
Section titled “json.linter.enabled”启用Biome的格式化器用于JSON (和其超级语言) 文件。
默认值:
true
{  "json": {    "linter": {      "enabled": false    }  }}json.assist.enabled
Section titled “json.assist.enabled”启用Biome的assist用于JSON (和其超级语言) 文件。
默认值:
true
{  "json": {    "assist": {      "enabled": false    }  }}应用于CSS文件的选项。
css.parser.cssModules
Section titled “css.parser.cssModules”启用CSS模块的解析
默认值:
false
css.formatter.enabled
Section titled “css.formatter.enabled”启用Biome的格式化器用于CSS文件。
默认值:
false
{  "css": {    "formatter": {      "enabled": false    }  }}css.formatter.indentStyle
Section titled “css.formatter.indentStyle”CSS文件的缩进样式。可以是"tab"或"space"。
默认值:
"tab"
css.formatter.indentWidth
Section titled “css.formatter.indentWidth”CSS文件的缩进应该是多大。
默认值:
2
{  "css": {    "formatter": {      "indentWidth": 2    }  }}css.formatter.lineEnding
Section titled “css.formatter.lineEnding”CSS文件的行结束类型。
"lf", 仅换行符(\n),在Linux和macOS以及git仓库内部常见;"crlf", 回车 + 换行字符(\r\n),在Windows上常见;"cr", 仅回车字符(\r),非常罕见。
默认值:
"lf"
css.formatter.lineWidth
Section titled “css.formatter.lineWidth”在CSS文件中一行可以写多少个字符。
默认值:
80
css.formatter.quoteStyle
Section titled “css.formatter.quoteStyle”表示字符串字面值时使用的引号类型。可以是 "single" 或 "double"。
默认值:
"double"
css.linter.enabled
Section titled “css.linter.enabled”启用Biome的linter用于CSS文件。
默认值:
true
{  "css": {    "linter": {      "enabled": false    }  }}css.assist.enabled
Section titled “css.assist.enabled”启用Biome的assist用于CSS文件。
默认值:
true
{  "css": {    "assist": {      "enabled": false    }  }}graphql
Section titled “graphql”应用于GraphQL文件的选项。
graphql.formatter.enabled
Section titled “graphql.formatter.enabled”启用Biome的格式化器用于GraphQL文件。
默认值:
false
graphql.formatter.indentStyle
Section titled “graphql.formatter.indentStyle”GraphQL文件的缩进样式。可以是"tab"或"space"。
默认值:
"tab"
graphql.formatter.indentWidth
Section titled “graphql.formatter.indentWidth”GraphQL文件的缩进应该是多大。
默认值:
2
graphql.formatter.lineEnding
Section titled “graphql.formatter.lineEnding”GraphQL文件的行结束类型。
"lf", 仅换行符(\n),在Linux和macOS以及git仓库内部常见;"crlf", 回车 + 换行字符(\r\n),在Windows上常见;"cr", 仅回车字符(\r),非常罕见。
默认值:
"lf"
graphql.formatter.lineWidth
Section titled “graphql.formatter.lineWidth”在GraphQL文件中一行可以写多少个字符。
默认值:
80
graphql.formatter.quoteStyle
Section titled “graphql.formatter.quoteStyle”表示字符串字面值时使用的引号类型。可以是 "single" 或 "double"。
默认值:
"double"
graphql.linter.enabled
Section titled “graphql.linter.enabled”启用Biome的linter用于GraphQL文件。
默认值:
true
graphql.assist.enabled
Section titled “graphql.assist.enabled”启用Biome的assist用于GraphQL文件。
默认值:
true
应用于Grit文件的选项。
grit.formatter.enabled
Section titled “grit.formatter.enabled”启用Biome的格式化器用于Grit文件。
默认值:
false
grit.formatter.indentStyle
Section titled “grit.formatter.indentStyle”Grit文件的缩进样式。可以是"tab"或"space"。
默认值:
"tab"
grit.formatter.indentWidth
Section titled “grit.formatter.indentWidth”Grit文件的缩进应该是多大。
默认值:
2
grit.formatter.lineEnding
Section titled “grit.formatter.lineEnding”Grit文件的行结束类型。
"lf", 仅换行符(\n),在Linux和macOS以及git仓库内部常见;"crlf", 回车 + 换行字符(\r\n),在Windows上常见;"cr", 仅回车字符(\r),非常罕见。
默认值:
"lf"
grit.formatter.lineWidth
Section titled “grit.formatter.lineWidth”在Grit文件中一行可以写多少个字符。
默认值:
80
grit.formatter.quoteStyle
Section titled “grit.formatter.quoteStyle”表示字符串字面值时使用的引号类型。可以是 "single" 或 "double"。
默认值:
"double"
grit.linter.enabled
Section titled “grit.linter.enabled”启用Biome的linter用于Grit文件。
默认值:
true
{  "grit": {    "linter": {      "enabled": false    }  }}grit.assist.enabled
Section titled “grit.assist.enabled”启用Biome的assist用于Grit文件。
默认值:
true
{  "grit": {    "assist": {      "enabled": false    }  }}overrides
Section titled “overrides”模式列表。
使用此配置更改某些文件的工具行为。
当文件与覆盖模式匹配时,该模式中指定的配置将覆盖顶级配置。
模式的顺序很重要。如果一个文件可以匹配三个模式,只使用第一个。
overrides.<ITEM>.includes
Section titled “overrides.<ITEM>.includes”一个glob模式列表,用于应用自定义设置的文件。
{  "overrides": [{    "includes": ["scripts/*.js"],    // 只应用于includes字段中指定的文件的设置。  }]}overrides.<ITEM>.formatter
Section titled “overrides.<ITEM>.formatter”它将包括顶级格式化器配置的选项,减去 ignore 和 include。
例如,可以修改在glob路径 generated/** 包含的某些文件的格式化器 lineWidth,indentStyle:
{  "formatter": {    "lineWidth": 100  },  "overrides": [    {      "includes": ["generated/**"],      "formatter": {        "lineWidth": 160,        "indentStyle": "space"      }    }  ]}overrides.<ITEM>.linter
Section titled “overrides.<ITEM>.linter”它将包括顶级linter配置的选项,减去 ignore 和 include。
可以为某些glob路径禁用某些规则,并为其他glob路径禁用linter:
{  "linter": {    "enabled": true,    "rules": {      "recommended": true    }  },  "overrides": [    {      "includes": ["lib/**"],      "linter": {        "rules": {          "suspicious": {            "noDebugger": "off"          }        }      }    },    {      "includes": ["shims/**"],      "linter": {        "enabled": false      }    }  ]}overrides.<ITEM>.organizeImports
Section titled “overrides.<ITEM>.organizeImports”它将包括顶级组织导入的选项,减去 ignore 和 include。
overrides.<ITEM>.javascript
Section titled “overrides.<ITEM>.javascript”它将包括顶级javascript配置的选项。
可以更改某些文件夹中的JavaScript文件的格式化行为:
{  "formatter": {    "lineWidth": 120  },  "javascript": {    "formatter": {      "quoteStyle": "single"    }  },  "overrides": [    {      "includes": ["lib/**"],      "javascript": {        "formatter": {          "quoteStyle": "double"        }      }    }  ]}overrides.<ITEM>.json
Section titled “overrides.<ITEM>.json”它将包括顶级json配置的选项。
可以为某些JSON文件启用解析特性:
{  "linter": {    "enabled": true,    "rules": {      "recommended": true    }  },  "overrides": [    {      "includes": [".vscode/**"],      "json": {        "parser": {          "allowComments": true,          "allowTrailingCommas": true        }      }    }  ]}Glob语法参考
Section titled “Glob语法参考”Glob模式用于匹配文件和文件夹的路径。Biome支持glob中的以下语法:
*匹配零个或多个字符。它不能匹配路径分隔符/。**递归匹配目录和文件。此序列必须用作整个路径组件,因此**a和b**都是无效的,会导致错误。两个以上连续的*字符序列也是无效的。[...]匹配括号内的任何字符。 也可以指定字符范围,按Unicode排序,例如[0-9]指定0到9之间的任何字符(包括)。[!...]是[...]的否定,即它匹配不在括号中的任何字符。- 如果整个glob以 
!开头,它是所谓的否定模式。此glob仅在路径_不_匹配glob时匹配。否定模式不能单独使用,它们只能用作常规glob的例外。 
一些例子:
dist/**匹配dist/文件夹和其中的所有文件。**/test/**匹配任何名为test的文件夹下的所有文件,无论它们在哪里。例如dist/test,src/test。**/*.js匹配所有文件夹中所有以扩展名.js结尾的文件。
Copyright (c) 2023-present Biome Developers and Contributors.