Skip to content

配置

允许将路径传递给 JSON 模式文件。

¥Allows to pass a path to a JSON schema file.

我们发布了 biome.json 的 JSON 模式文件。

¥We publish a JSON schema file for the biome.json.

如果 @biomejs/biome 安装在 node_modules 文件夹中,你可以指定 @biomejs/biome npm 包架构的相对路径:

¥You can specify a relative path to the schema of the @biomejs/biome npm package if @biomejs/biome is installed in the node_modules folder:

biome.json
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json"
}

如果你在解析物理文件时遇到问题,可以使用此站点中发布的文件:

¥If you have problems with resolving the physical file, you can use the one published in this site:

biome.json
{
"$schema": "https://biome.nodejs.cn/schemas/1.8.3/schema.json"
}

其他 JSON 文件的路径列表。Biome 解析并应用 extends 列表中包含的文件的选项,并最终应用 biome.json 文件中包含的选项。

¥A list of paths to other JSON files. Biome resolves and applies the options of the files contained in the extends list, and eventually applies the options contained in the biome.json file.

源代码文件的最大允许大小(以字节为单位)。出于性能原因,超过此限制的文件将被忽略。

¥The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reasons.

默认:1048576(1024*1024, 1MB)

¥Default: 1048576 (1024*1024, 1MB)

Unix shell 样式模式列表。Biome 忽略与这些模式匹配的文件和文件夹。

¥A list of Unix shell style patterns. Biome ignores files and folders that match these patterns.

biome.json
{
"files": {
"ignore": ["scripts/*.js"]
}
}

Unix shell 样式模式列表。Biome 仅处理与这些模式匹配的文件和文件夹。

¥A list of Unix shell style patterns. Biome handles only the files and folders that match these patterns.

biome.json
{
"files": {
"include": ["scripts/*.js"]
}
}

给出以下示例:

¥Given the following example:

biome.json
{
"files": {
"include": ["scripts/**/*.js", "src/**/*.js"],
"ignore": ["scripts/**/*.js"]
}
}

仅处理与模式 src/**/*.js 匹配的文件,而忽略与模式 scripts/**/*.js 匹配的文件。

¥Only the files that match the pattern src/**/*.js will be handled, while the files that match the pattern scripts/**/*.js will be ignored.

如果遇到无法处理的文件,Biome 将不会发出诊断信息。

¥Biome won’t emit diagnostics if it encounters files that can’t handle.

biome.json
{
"files": {
"ignoreUnknown": true
}
}

默认:false

¥Default: false

将 Biome 与 VCS 软件集成的属性集。

¥Set of properties to integrate Biome with a VCS software.

Biome 是否应该将自身与 VCS 客户端集成

¥Whether Biome should integrate itself with the VCS client

默认:false

¥Default: false

客户端类型。

¥The kind of client.

值:

¥Values:

  • "git"

Biome 是否应该使用 VCS 忽略文件。当 true 时,Biome 将忽略忽略文件中指定的文件。

¥Whether Biome should use the VCS ignore file. When true, Biome will ignore the files specified in the ignore file.

Biome 应检查 VCS 文件的文件夹。默认情况下,Biome 将使用找到 biome.json 的同一文件夹。

¥The folder where Biome should check for VCS files. By default, Biome will use the same folder where biome.json was found.

如果 Biome 找不到配置,它将尝试使用当前工作目录。如果找不到当前工作目录,Biome 将不会使用 VCS 集成,并且将发出诊断

¥If Biome can’t find the configuration, it will attempt to use the current working directory. If no current working directory can’t be found, Biome won’t use the VCS integration, and a diagnostic will be emitted

项目的主分支。Biome 将在评估更改的文件时使用此分支。

¥The main branch of the project. Biome will use this branch when evaluating the changed files.

启用 Biome 的 linter

¥Enables Biome’s linter

默认:true

¥Default: true

Unix shell 样式模式数组。

¥An array of Unix shell style patterns.

biome.json
{
"linter": {
"ignore": ["scripts/*.js"]
}
}

Unix shell 样式模式列表。Biome 仅处理与这些模式匹配的文件和文件夹。

¥A list of Unix shell style patterns. Biome handles only the files and folders that match these patterns.

biome.json
{
"linter": {
"include": ["scripts/*.js"]
}
}

给出以下示例:

¥Given the following example:

biome.json
{
"linter": {
"include": ["scripts/**/*.js", "src/**/*.js"],
"ignore": ["scripts/**/*.js"]
}
}

仅对与模式 src/**/*.js 匹配的文件进行 linted,而忽略与模式 scripts/**/*.js 匹配的文件。

¥Only the files that match the patter src/**/*.js will be linted, while the files that match the pattern scripts/**/*.js will be ignored.

为所有组启用 推荐规则

¥Enables the recommended rules for all groups.

默认:true

¥Default: true

为所有组启用或禁用所有 rules

¥Enable or disable all rules for all groups.

如果 recommendedall 都是 true,Biome 将发出诊断并恢复到其默认值。

¥If recommended and all are both true, Biome will emit a diagnostic and fallback to its defaults.

biome.json
{
"linter": {
"enabled": true,
"rules": {
"all": true
}
}
}

也可以组合此标志来启用/禁用不同的规则组:

¥It’s also possible to combine this flag to enable/disable different rule groups:

biome.json
{
"linter": {
"enabled": true,
"rules": {
"all": true,
"style": {
"all": false
},
"complexity": {
"all": false
}
}
}
}

在前面的例子中,Biome 将启用所有规则,但属于 stylecomplexity 组的规则除外。

¥In the previous example, Biome will enable all rules, exception for rules that belong to the style and complexity groups.

影响单个组规则的选项。Biome 支持以下组:

¥Options that influence the rules of a single group. Biome supports the following groups:

  • accessibility: Rules focused on preventing accessibility problems.
  • complexity: Rules that focus on inspecting complex code that could be simplified.
  • correctness: Rules that detect code that is guaranteed to be incorrect or useless.
  • nursery: New rules that are still under development. Nursery rules require explicit opt-in via configuration on stable versions because they may still have bugs or performance problems. They are enabled by default on nightly builds, but as they are unstable their diagnostic severity may be set to either error or warning, depending on whether we intend for the rule to be recommended or not when it eventually gets stabilized. Nursery rules get promoted to other groups once they become stable or may be removed. Rules that belong to this group are not subject to semantic version.
  • performance: Rules catching ways your code could be written to run faster, or generally be more efficient.
  • security: Rules that detect potential security flaws.
  • style: Rules enforcing a consistent and idiomatic way of writing your code.
  • suspicious: Rules that detect code that is likely to be incorrect or useless.
  • linter.rules.[group].recommended

    Section titled linter.rules.[group].recommended

    为单个组启用推荐规则。

    ¥Enables the recommended rules for a single group.

    示例:

    ¥Example:

    biome.json
    {
    "linter": {
    "enabled": true,
    "rules": {
    "nursery": {
    "recommended": true
    }
    }
    }
    }

    为单个组启用所有规则。

    ¥Enables all rules for a single group.

    示例:

    ¥Example:

    biome.json
    {
    "linter": {
    "enabled": true,
    "rules": {
    "nursery": {
    "all": true
    }
    }
    }
    }

    这些选项适用于所有语言。下面还有其他特定于语言的格式选项。

    ¥These options apply to all languages. There are additional language-specific formatting options below.

    启用 Biome 的格式化程序

    ¥Enables Biome’s formatter

    默认:true

    ¥Default: true

    Unix shell 样式模式数组。

    ¥An array of Unix shell style patterns.

    biome.json
    {
    "formatter": {
    "ignore": ["scripts/*.js"]
    }
    }

    Unix shell 样式模式列表。Biome 仅处理与这些模式匹配的文件和文件夹。

    ¥A list of Unix shell style patterns. Biome handles only the files and folders that match these patterns.

    biome.json
    {
    "formatter": {
    "include": ["scripts/*.js"]
    }
    }

    给出以下示例:

    ¥Given the following example:

    biome.json
    {
    "formatter": {
    "include": ["scripts/**/*.js", "src/**/*.js"],
    "ignore": ["scripts/**/*.js"]
    }
    }

    仅格式化与模式 src/**/*.js 匹配的文件,而忽略与模式 scripts/**/*.js 匹配的文件。

    ¥Only the files that match the patter src/**/*.js will be formatted, while the files that match the pattern scripts/**/*.js will be ignored.

    允许格式化有语法错误的文档。

    ¥Allows to format a document that has syntax errors.

    biome.json
    {
    "formatter": {
    "formatWithErrors": true
    }
    }

    默认:false

    ¥Default: false

    缩进样式。它可以是 "tab""space"

    ¥The style of the indentation. It can be "tab" or "space".

    默认:"tab"

    ¥Default: "tab"

    此选项已弃用,请改用 formatter.indentWidth

    ¥This option is deprecated, please use formatter.indentWidth instead.

    Deprecated

    缩进应该有多大。

    ¥How big the indentation should be.

    默认:2

    ¥Default: 2

    缩进应该有多大。

    ¥How big the indentation should be.

    默认:2

    ¥Default: 2

    行尾类型。

    ¥The type of line ending.

    • "lf",仅换行符(\n),在 Linux 和 macOS 以及 git repos 内部很常见;

      ¥"lf", Line Feed only (\n), common on Linux and macOS as well as inside git repos;

    • "crlf",回车符 + 换行符(\r\n),在 Windows 上很常见;

      ¥"crlf", Carriage Return + Line Feed characters (\r\n), common on Windows;

    • "cr",仅回车符(\r),很少使用。

      ¥"cr", Carriage Return character only (\r), used very rarely.

    默认:"lf"

    ¥Default: "lf"

    一行可以写多少个字符。

    ¥How many characters can be written on a single line.

    默认:80

    ¥Default: 80

    HTMLish 语言中的属性位置样式。

    ¥The attribute position style in HTMLish languages.

    • "auto",属性会自动格式化,只有当它们符合某些条件时,它们才会折叠在多行中;

      ¥"auto", the attributes are automatically formatted, and they will collapse in multiple lines only when they hit certain criteria;

    • "multiline",无论如何,属性总是格式化为多行。

      ¥"multiline", the attributes are always formatted on multiple lines, regardless.

    默认:"auto"

    ¥Default: "auto"

    启用 Biome 的排序导入。

    ¥Enables Biome’s sort imports.

    默认:true

    ¥Default: true

    Unix shell 样式模式列表。Biome 忽略与这些模式匹配的文件和文件夹。

    ¥A list of Unix shell style patterns. Biome ignores files and folders that match these patterns.

    biome.json
    {
    "organizeImports": {
    "ignore": ["scripts/*.js"]
    }
    }

    Unix shell 样式模式列表。Biome 仅处理与这些模式匹配的文件和文件夹。

    ¥A list of Unix shell style patterns. Biome handles only the files and folders that match these patterns.

    biome.json
    {
    "organizeImports": {
    "include": ["scripts/*.js"]
    }
    }

    给出以下示例:

    ¥Given the following example:

    biome.json
    {
    "organizeImports": {
    "include": ["scripts/**/*.js", "src/**/*.js"],
    "ignore": ["scripts/**/*.js"]
    }
    }

    仅对与模式 src/**/*.js 匹配的文件进行导入排序,而忽略与模式 scripts/**/*.js 匹配的文件。

    ¥Only the files that match the patter src/**/*.js will have their imports sorted, while the files that match the pattern scripts/**/*.js will be ignored.

    这些选项仅适用于 JavaScript(和 TypeScript)文件。

    ¥These options apply only to JavaScript (and TypeScript) files.

    javascript.parser.unsafeParameterDecoratorsEnabled

    Section titled javascript.parser.unsafeParameterDecoratorsEnabled

    允许支持不安全/实验性参数装饰器。

    ¥Allows to support the unsafe/experimental parameter decorators.

    biome.json
    {
    "javascript": {
    "parser": {
    "unsafeParameterDecoratorsEnabled": true
    }
    }
    }

    默认:false

    ¥Default: false

    javascript.formatter.quoteStyle

    Section titled javascript.formatter.quoteStyle

    表示字符串文字时使用的引号类型。它可以是 "single""double"

    ¥The type of quote used when representing string literals. It can be "single" or "double".

    默认:"double"

    ¥Default: "double"

    javascript.formatter.jsxQuoteStyle

    Section titled javascript.formatter.jsxQuoteStyle

    表示 jsx 字符串文字时使用的引号类型。它可以是 "single""double"

    ¥The type of quote used when representing jsx string literals. It can be "single" or "double".

    默认:"double"

    ¥Default: "double"

    javascript.formatter.quoteProperties

    Section titled javascript.formatter.quoteProperties

    对象内的属性应何时用引号引起来。它可以是 "asNeeded""preserve"

    ¥When properties inside objects should be quoted. It can be "asNeeded" or "preserve".

    默认:"asNeeded"

    ¥Default: "asNeeded"

    javascript.formatter.trailingComma

    Section titled javascript.formatter.trailingComma

    此选项已弃用,请改用 javascript.formatter.trailingCommas

    ¥This option is deprecated, please use javascript.formatter.trailingCommas instead.

    Deprecated

    在多行逗号分隔的语法结构中尽可能打印尾随逗号。可能的值:

    ¥Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Possible values:

    • "all",始终添加尾随逗号;

      ¥"all", the trailing comma is always added;

    • "es5",仅在旧版本 JavaScript 支持的地方添加尾随逗号;

      ¥"es5", the trailing comma is added only in places where it’s supported by older version of JavaScript;

    • "none",从不添加尾随逗号。

      ¥"none", trailing commas are never added.

    默认:"all"

    ¥Default: "all"

    javascript.formatter.trailingCommas

    Section titled javascript.formatter.trailingCommas

    在多行逗号分隔的语法结构中尽可能打印尾随逗号。可能的值:

    ¥Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Possible values:

    • "all",始终添加尾随逗号;

      ¥"all", the trailing comma is always added;

    • "es5",仅在旧版本 JavaScript 支持的地方添加尾随逗号;

      ¥"es5", the trailing comma is added only in places where it’s supported by older version of JavaScript;

    • "none",从不添加尾随逗号。

      ¥"none", trailing commas are never added.

    默认:"all"

    ¥Default: "all"

    javascript.formatter.semicolons

    Section titled javascript.formatter.semicolons

    它配置格式化程序打印分号的位置:

    ¥It configures where the formatter prints semicolons:

    • "always",分号始终添加在每个语句的末尾;

      ¥"always", the semicolons is always added at the end of each statement;

    • "asNeeded",仅在需要的地方添加分号,以防止 ASI

      ¥"asNeeded", the semicolons are added only in places where it’s needed, to protect from ASI.

    默认:"always"

    ¥Default: "always"

    示例:

    ¥Example:

    biome.json
    {
    "javascript": {
    "formatter": {
    "semicolons": "asNeeded"
    }
    }
    }

    javascript.formatter.arrowParentheses

    Section titled javascript.formatter.arrowParentheses

    是否向箭头函数添加不必要的括号:

    ¥Whether to add non-necessary parentheses to arrow functions:

    • "always",始终添加括号;

      ¥"always", the parentheses are always added;

    • "asNeeded",只有在需要时才添加括号。

      ¥"asNeeded", the parentheses are added only when they are needed.

    默认:"always"

    ¥Default: "always"

    为 JavaScript(及其超级语言)文件启用 Biome 的格式化程序。

    ¥Enables Biome’s formatter for JavaScript (and its super languages) files.

    默认:true

    ¥Default: true

    javascript.formatter.indentStyle

    Section titled javascript.formatter.indentStyle

    JavaScript(及其超级语言)文件的缩进样式。它可以是 "tab""space"

    ¥The style of the indentation for JavaScript (and its super languages) files. It can be "tab" or "space".

    默认:"tab"

    ¥Default: "tab"

    javascript.formatter.indentSize

    Section titled javascript.formatter.indentSize

    此选项已弃用,请改用 javascript.formatter.indentWidth

    ¥This option is deprecated, please use javascript.formatter.indentWidth instead.

    Deprecated

    JavaScript(及其超级语言)文件的缩进应该有多大。

    ¥How big the indentation should be for JavaScript (and its super languages) files.

    默认:2

    ¥Default: 2

    javascript.formatter.indentWidth

    Section titled javascript.formatter.indentWidth

    JavaScript(及其超级语言)文件的缩进应该有多大。

    ¥How big the indentation should be for JavaScript (and its super languages) files.

    默认:2

    ¥Default: 2

    javascript.formatter.lineEnding

    Section titled javascript.formatter.lineEnding

    JavaScript(及其超级语言)文件的行尾类型。

    ¥The type of line ending for JavaScript (and its super languages) files.

    • "lf",仅换行符(\n),在 Linux 和 macOS 以及 git repos 内部很常见;

      ¥"lf", Line Feed only (\n), common on Linux and macOS as well as inside git repos;

    • "crlf",回车符 + 换行符(\r\n),在 Windows 上很常见;

      ¥"crlf", Carriage Return + Line Feed characters (\r\n), common on Windows;

    • "cr",仅回车符(\r),很少使用。

      ¥"cr", Carriage Return character only (\r), used very rarely.

    默认:"lf"

    ¥Default: "lf"

    javascript.formatter.lineWidth

    Section titled javascript.formatter.lineWidth

    JavaScript(及其超级语言)文件中的一行可以写多少个字符。

    ¥How many characters can be written on a single line in JavaScript (and its super languages) files.

    默认:80

    ¥Default: 80

    javascript.formatter.bracketSameLine

    Section titled javascript.formatter.bracketSameLine

    选择是否应在括号和内部值之间添加空格

    ¥Choose whether the ending > of a multi-line JSX element should be on the last attribute line or not

    默认:false

    ¥Default: false

    javascript.formatter.bracketSpacing

    Section titled javascript.formatter.bracketSpacing

    检查断言函数(例如 )是否放置在 函数调用中。

    ¥Choose whether spaces should be added between brackets and inner values

    默认:true

    ¥Default: true

    javascript.formatter.attributePosition

    Section titled javascript.formatter.attributePosition

    jsx 元素中的属性位置样式。

    ¥The attribute position style in jsx elements.

    • "auto",属性会自动格式化,只有当它们符合某些条件时,它们才会折叠在多行中;

      ¥"auto", the attributes are automatically formatted, and they will collapse in multiple lines only when they hit certain criteria;

    • "multiline",无论如何,属性总是格式化为多行。

      ¥"multiline", the attributes are always formatted on multiple lines, regardless.

    默认:"auto"

    ¥Default: "auto"

    Biome 应忽略的全局名称列表(分析器、linter 等)

    ¥A list of global names that Biome should ignore (analyzer, linter, etc.)

    biome.json
    {
    "javascript": {
    "globals": ["$", "_", "externalVariable"]
    }
    }

    表示用于解释 JSX 的运行时或转换的类型。

    ¥Indicates the type of runtime or transformation used for interpreting JSX.

    • "transparent" — 表示现代或原生 JSX 环境,不需要 Biome 进行特殊处理。

      ¥"transparent" — Indicates a modern or native JSX environment, that doesn’t require special handling by Biome.

    • "reactClassic" — 表示需要 React 导入的经典 React 环境。对应于 TypeScript 的 tsconfig.jsonjsx 选项的 react 值。

      ¥"reactClassic" — Indicates a classic React environment that requires the React import. Corresponds to the react value for the jsx option in TypeScript’s tsconfig.json.

    biome.json
    {
    "javascript": {
    "jsxRuntime": "reactClassic"
    }
    }

    有关旧 JSX 运行时与新 JSX 运行时的更多信息,请参阅:https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html

    ¥For more information about the old vs. new JSX runtime, please see: https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html

    默认:"transparent"

    ¥Default: "transparent"

    为 JavaScript(及其超级语言)文件启用 Biome 的格式化程序。

    ¥Enables Biome’s formatter for JavaScript (and its super languages) files.

    默认:true

    ¥Default: true

    应用于 JSON 文件的选项。

    ¥Options applied to the JSON files.

    启用 JSON 文件中注释的解析。

    ¥Enables the parsing of comments in JSON files.

    biome.json
    {
    "json": {
    "parser": {
    "allowComments": true
    }
    }
    }

    json.parser.allowTrailingCommas

    Section titled json.parser.allowTrailingCommas

    启用 JSON 文件中尾随逗号的解析。

    ¥Enables the parsing of trailing Commas in JSON files.

    biome.json
    {
    "json": {
    "parser": {
    "allowTrailingCommas": true
    }
    }
    }

    为 JSON(及其超级语言)文件启用 Biome 的格式化程序。

    ¥Enables Biome’s formatter for JSON (and its super languages) files.

    默认:true

    ¥Default: true

    JSON(及其超级语言)文件的缩进样式。它可以是 "tab""space"

    ¥The style of the indentation for JSON (and its super languages) files. It can be "tab" or "space".

    默认:"tab"

    ¥Default: "tab"

    此选项已弃用,请改用 json.formatter.indentWidth

    ¥This option is deprecated, please use json.formatter.indentWidth instead.

    Deprecated

    JSON(及其超级语言)文件的缩进应该有多大。

    ¥How big the indentation should be for JSON (and its super languages) files.

    默认:2

    ¥Default: 2

    JSON(及其超级语言)文件的缩进应该有多大。

    ¥How big the indentation should be for JSON (and its super languages) files.

    默认:2

    ¥Default: 2

    JSON(及其超级语言)文件的行尾类型。

    ¥The type of line ending for JSON (and its super languages) files.

    • "lf",仅换行符(\n),在 Linux 和 macOS 以及 git repos 内部很常见;

      ¥"lf", Line Feed only (\n), common on Linux and macOS as well as inside git repos;

    • "crlf",回车符 + 换行符(\r\n),在 Windows 上很常见;

      ¥"crlf", Carriage Return + Line Feed characters (\r\n), common on Windows;

    • "cr",仅回车符(\r),很少使用。

      ¥"cr", Carriage Return character only (\r), used very rarely.

    默认:"lf"

    ¥Default: "lf"

    JSON(及其超级语言)文件中的一行可以写多少个字符。

    ¥How many characters can be written on a single line in JSON (and its super languages) files.

    默认:80

    ¥Default: 80

    在多行逗号分隔的语法结构中尽可能打印尾随逗号。

    ¥Print trailing commas wherever possible in multi-line comma-separated syntactic structures.

    允许的值:

    ¥Allowed values:

    • "none":尾随逗号被删除;

      ¥"none": the trailing comma is removed;

    • "all":保留尾随逗号并优先使用。

      ¥"all": the trailing comma is kept and preferred.

    默认:"none"

    ¥Default: "none"

    为 JSON(及其超级语言)文件启用 Biome 的格式化程序。

    ¥Enables Biome’s formatter for JSON (and its super languages) files.

    默认:true

    ¥Default: true

    应用于 CSS 文件的选项。

    ¥Options applied to the CSS files.

    启用 CSS 模块 的解析

    ¥Enables parsing of CSS modules

    默认:false

    ¥Default: false

    为 CSS(及其超级语言)文件启用 Biome 的格式化程序。

    ¥Enables Biome’s formatter for CSS (and its super languages) files.

    默认:false

    ¥Default: false

    CSS(及其超级语言)文件的缩进样式。它可以是 "tab""space"

    ¥The style of the indentation for CSS (and its super languages) files. It can be "tab" or "space".

    默认:"tab"

    ¥Default: "tab"

    CSS(及其超级语言)文件的缩进应该有多大。

    ¥How big the indentation should be for CSS (and its super languages) files.

    默认:2

    ¥Default: 2

    CSS(及其超级语言)文件的行尾类型。

    ¥The type of line ending for CSS (and its super languages) files.

    • "lf",仅换行符(\n),在 Linux 和 macOS 以及 git repos 内部很常见;

      ¥"lf", Line Feed only (\n), common on Linux and macOS as well as inside git repos;

    • "crlf",回车符 + 换行符(\r\n),在 Windows 上很常见;

      ¥"crlf", Carriage Return + Line Feed characters (\r\n), common on Windows;

    • "cr",仅回车符(\r),很少使用。

      ¥"cr", Carriage Return character only (\r), used very rarely.

    默认:"lf"

    ¥Default: "lf"

    JSON(及其超级语言)文件中的一行可以写多少个字符。

    ¥How many characters can be written on a single line in JSON (and its super languages) files.

    默认:80

    ¥Default: 80

    表示字符串文字时使用的引号类型。它可以是 "single""double"

    ¥The type of quote used when representing string literals. It can be "single" or "double".

    默认:"double"

    ¥Default: "double"

    启用 Biome 的 CSS(及其超级语言)文件的 linter。

    ¥Enables Biome’s linter for CSS (and its super languages) files.

    默认:false

    ¥Default: false

    模式列表。

    ¥A list of patterns.

    使用此配置更改工具对某些文件的行为。

    ¥Use this configuration to change the behaviour of the tools for certain files.

    当文件与覆盖模式匹配时,该模式中指定的配置将覆盖顶层配置。

    ¥When a file is matched against an override pattern, the configuration specified in that pattern will be override the top-level configuration.

    模式的顺序很重要。如果文件可以匹配三种模式,则仅使用第一个模式。

    ¥The order of the patterns matter. If a file can match three patterns, only the first one is used.

    Unix shell 样式模式列表。Biome 不会将覆盖应用于与模式匹配的文件。

    ¥A list of Unix shell style patterns. Biome will not apply the override to files that match the pattern.

    biome.json
    {
    "overrides": [{
    "ignore": ["scripts/*.js"]
    }]
    }

    Unix shell 样式模式列表。Biome 将仅将覆盖应用于与模式匹配的文件。

    ¥A list of Unix shell style patterns. Biome will apply the override only to files that match the pattern.

    biome.json
    {
    "overrides": [{
    "include": ["scripts/*.js"]
    }]
    }

    它将包括 顶层格式化程序 配置的选项,减去 ignoreinclude

    ¥It will include the options of top level formatter configuration, minus ignore and include.

    ¥Examples

    例如,可以修改 glob 路径 generated/** 中包含的某些文件的格式化程序 lineWidthindentStyle

    ¥For example, it’s possible to modify the formatter lineWidth, indentStyle for certain files that are included in the glob path generated/**:

    biome.json
    {
    "formatter": {
    "lineWidth": 100
    },
    "overrides": [
    {
    "include": ["generated/**"],
    "formatter": {
    "lineWidth": 160,
    "indentStyle": "space"
    }
    }
    ]
    }

    它将包括 顶层 linter 配置的选项,减去 ignoreinclude

    ¥It will include the options of top level linter configuration, minus ignore and include.

    ¥Examples

    你可以禁用某些 glob 路径的某些规则,并禁用其他 glob 路径的 linter:

    ¥You can disable certain rules for certain glob paths, and disable the linter for other glob paths:

    biome.json
    {
    "linter": {
    "enabled": true,
    "rules": {
    "recommended": true
    }
    },
    "overrides": [
    {
    "include": ["lib/**"],
    "linter": {
    "rules": {
    "suspicious": {
    "noDebugger": "off"
    }
    }
    }
    },
    {
    "include": ["shims/**"],
    "linter": {
    "enabled": false
    }
    }
    ]
    }

    它将包括 顶层组织导入 的选项,减去 ignoreinclude

    ¥It will include the options of top level organize imports, minus ignore and include.

    它将包括 顶层 javascript 配置的选项。

    ¥It will include the options of top level javascript configuration.

    ¥Examples

    你可以更改某些文件夹中 JavaScript 文件的格式行为:

    ¥You can change the formatting behaviour of JavaScript files in certain folders:

    biome.json
    {
    "formatter": {
    "lineWidth": 120
    },
    "javascript": {
    "formatter": {
    "quoteStyle": "single"
    }
    },
    "overrides": [
    {
    "include": ["lib/**"],
    "javascript": {
    "formatter": {
    "quoteStyle": "double"
    }
    }
    }
    ]
    }

    它将包括 顶层 json 配置的选项。

    ¥It will include the options of top level json configuration.

    ¥Examples

    你可以为某些 JSON 文件启用解析功能:

    ¥You can enable parsing features for certain JSON files:

    biome.json
    {
    "linter": {
    "enabled": true,
    "rules": {
    "recommended": true
    }
    },
    "overrides": [
    {
    "include": [".vscode/**"],
    "json": {
    "parser": {
    "allowComments": true,
    "allowTrailingCommas": true
    }
    }
    }
    ]
    }