Skip to content

Oxfmt 的配置选项。

🌐 Configuration options for the Oxfmt.

大多数选项与 Prettier 的选项相同,但并非全部。此外,有些选项是我们自己的扩展。

🌐 Most options are the same as Prettier's options, but not all of them. In addition, some options are our own extensions.

arrowParens

类型:"always" | "avoid"

🌐 type: "always" | "avoid"

在单个箭头函数参数周围加上括号。

🌐 Include parentheses around a sole arrow function parameter.

  • 默认:"always"

bracketSameLine

类型:boolean

🌐 type: boolean

将多行 HTML(HTML、JSX、Vue、Angular)元素的 > 放在最后一行的末尾,而不是单独放在下一行(不适用于自闭合元素)。

🌐 Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line, instead of being alone on the next line (does not apply to self closing elements).

  • 默认:false

bracketSpacing

类型:boolean

🌐 type: boolean

在对象字面量的括号之间打印空格。

🌐 Print spaces between brackets in object literals.

  • 默认:true

embeddedLanguageFormatting

类型:"auto" | "off"

🌐 type: "auto" | "off"

控制是否格式化文件中的嵌入部分(例如,CSS-in-JS 或 JS-in-Vue 等)。

🌐 Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file.

注意:XXX-in-JS 支持不完整。 JS-in-XXX完全支持,但仍由Prettier负责。

🌐 NOTE: XXX-in-JS support is incomplete. JS-in-XXX is fully supported but still be handled by Prettier.

  • 默认:"auto"

endOfLine

类型:"lf" | "crlf" | "cr"

🌐 type: "lf" | "crlf" | "cr"

要应用哪种行结束符。

🌐 Which end of line characters to apply.

注意:不支持 "auto"

🌐 NOTE: "auto" is not supported.

  • 默认:"lf"
  • 覆盖“.editorconfig.end_of_line”

experimentalSortImports

类型:object

🌐 type: object

实验性功能:排序导入语句。

🌐 Experimental: Sort import statements.

使用与 eslint-plugin-perfectionist/sort-imports 类似的算法。详情请参阅各字段的文档。

🌐 Using the similar algorithm as eslint-plugin-perfectionist/sort-imports. For details, see each field's documentation.

  • 默认:已禁用

experimentalSortImports.customGroups

类型:array

🌐 type: array

为匹配非常特定的导入定义你自己的分组。

🌐 Define your own groups for matching very specific imports.

customGroups 列表是有序的:第一个与某个元素匹配的定义将被使用。自定义组的优先级高于任何预定义组。

🌐 The customGroups list is ordered: The first definition that matches an element will be used. Custom groups have a higher priority than any predefined group.

如果你希望预定义组优先于自定义组,你必须编写一个自定义组定义,其功能与预定义组相同,并将其放在列表的最前面。

🌐 If you want a predefined group to take precedence over a custom group, you must write a custom group definition that does the same as what the predefined group does, and put it first in the list.

  • 默认:[]

experimentalSortImports.customGroups[n]

类型:object

🌐 type: object

experimentalSortImports.customGroups[n].elementNamePattern

类型:string[]

🌐 type: string[]

默认:[]

🌐 default: []

此组要匹配的导入名称前缀列表。

🌐 List of import name prefixes to match for this group.

experimentalSortImports.customGroups[n].groupName

类型:string

🌐 type: string

默认:""

🌐 default: ""

自定义组的名称,用于“groups”选项。

🌐 Name of the custom group, used in the groups option.

experimentalSortImports.groups

类型:array

🌐 type: array

指定用于排序的预定义导入组列表。

🌐 Specifies a list of predefined import groups for sorting.

每个导入将被分配到 groups 选项中指定的单个组(如果没有匹配,将分配到 unknown 组)。 groups 选项中项目的顺序决定了组的排序方式。

🌐 Each import will be assigned a single group specified in the groups option (or the unknown group if no match is found). The order of items in the groups option determines how groups are ordered.

在给定的组内,成员将根据类型、顺序、忽略大小写等选项进行排序。

🌐 Within a given group, members will be sorted according to the type, order, ignoreCase, etc. options.

可以通过将各个组放入一个数组来将它们组合在一起。数组中组的顺序无关紧要。数组中所有组的成员将会被一起排序,就好像它们属于同一个组一样。

🌐 Individual groups can be combined together by placing them in an array. The order of groups in that array does not matter. All members of the groups in the array will be sorted together as if they were part of a single group.

预定义的组由一个选择器和可能的多个修饰符组成。你可以按任意顺序输入修饰符,但选择器必须始终放在最后。

🌐 Predefined groups are characterized by a single selector and potentially multiple modifiers. You may enter modifiers in any order, but the selector must always come at the end.

选择器列表按重要性从高到低排序:

🌐 The list of selectors is sorted from most to least important:

  • type — TypeScript 类型导入。
  • side-effect-style — 副作用风格的导入。
  • side-effect — 副作用导入。
  • style — 样式导入。
  • index — 当前目录下的主文件。
  • sibling — 来自同一目录的模块。
  • parent — 来自父目录的模块。
  • subpath — Node.js 子路径导入。
  • internal — 你的内部模块。
  • builtin — Node.js 内置模块。
  • external — 项目中安装的外部模块。
  • import — 任何导入。

修饰符列表按重要性从高到低排序:

🌐 The list of modifiers is sorted from most to least important:

  • side-effect — 副作用导入。
  • type — TypeScript 类型导入。
  • value — 价值导入。
  • default — 包含默认导入的导入语句。
  • wildcard — 包含通配符 (* as) 说明符的导入。
  • named — 包含至少一个命名导入的导入语句。
  • multiline — 多行导入。
  • singleline — 单行导入。

详情请参见 https://perfectionist.dev/rules/sort-imports#groups

  • 默认:见下文
json
[
  "type-import",
  ["value-builtin", "value-external"],
  "type-internal",
  "value-internal",
  ["type-parent", "type-sibling", "type-index"],
  ["value-parent", "value-sibling", "value-index"],
  "unknown"
]

experimentalSortImports.groups[n]

类型:array | string

🌐 type: array | string

experimentalSortImports.groups[n][n]

类型:string

🌐 type: string

experimentalSortImports.ignoreCase

类型:boolean

🌐 type: boolean

指定排序是否区分大小写。

🌐 Specifies whether sorting should be case-sensitive.

  • 默认:true

experimentalSortImports.internalPattern

类型:string[]

🌐 type: string[]

指定用于识别内部导入的前缀。

🌐 Specifies a prefix for identifying internal imports.

这有助于区分你自己的模块与外部依赖。

🌐 This is useful for distinguishing your own modules from external dependencies.

  • 默认:["~/", "@/"]

experimentalSortImports.newlinesBetween

类型:boolean

🌐 type: boolean

指定是否在组之间添加换行符。

🌐 Specifies whether to add newlines between groups.

false 时,各组之间不会添加换行符。

🌐 When false, no newlines are added between groups.

  • 默认:true

experimentalSortImports.order

类型:"asc" | "desc"

🌐 type: "asc" | "desc"

指定是否按升序或降序对项目进行排序。

🌐 Specifies whether to sort items in ascending or descending order.

  • 默认:"asc"

experimentalSortImports.partitionByComment

类型:boolean

🌐 type: boolean

允许使用注释将导入分隔为逻辑组。

🌐 Enables the use of comments to separate imports into logical groups.

true 时,所有注释将被视为分隔符,从而创建分区。

🌐 When true, all comments will be treated as delimiters, creating partitions.

js
import { b1, b2 } from "b";
// PARTITION
import { a } from "a";
import { c } from "c";
  • 默认:false

experimentalSortImports.partitionByNewline

类型:boolean

🌐 type: boolean

启用空行将导入分隔为逻辑组。

🌐 Enables the empty line to separate imports into logical groups.

true 时,如果导入之间有空行,格式化程序将不会对导入进行排序。这有助于保持逻辑上分组成员的定义顺序。

🌐 When true, formatter will not sort imports if there is an empty line between them. This helps maintain the defined order of logically separated groups of members.

js
import { b1, b2 } from "b";

import { a } from "a";
import { c } from "c";
  • 默认:false

experimentalSortImports.sortSideEffects

类型:boolean

🌐 type: boolean

指定是否应对有副作用的导入进行排序。

🌐 Specifies whether side effect imports should be sorted.

默认情况下,出于安全原因,侧面导入的排序被禁用。

🌐 By default, sorting side-effect imports is disabled for security reasons.

  • 默认:false

experimentalSortPackageJson

类型:object | boolean

🌐 type: object | boolean

试验性功能:排序 package.json 键。

🌐 Experimental: Sort package.json keys.

该算法与 prettier-plugin-sort-packagejson 不兼容。但我们认为它更清晰,更易于导航。详情请参阅各字段的文档。

🌐 The algorithm is NOT compatible with prettier-plugin-sort-packagejson. But we believe it is clearer and easier to navigate. For details, see each field's documentation.

  • 默认:true

experimentalSortPackageJson.sortScripts

类型:boolean

🌐 type: boolean

按字母顺序排序 scripts 字段。

🌐 Sort the scripts field alphabetically.

  • 默认:false

experimentalTailwindcss

类型:object

🌐 type: object

实验性:排序Tailwind CSS类。

🌐 Experimental: Sort Tailwind CSS classes.

使用与 prettier-plugin-tailwindcss 相同的算法。选项名称省略了原插件中使用的 tailwind 前缀(例如,使用 config 而不是 tailwindConfig)。详情请参阅各字段的文档。

🌐 Using the same algorithm as prettier-plugin-tailwindcss. Option names omit the tailwind prefix used in the original plugin (e.g., config instead of tailwindConfig). For details, see each field's documentation.

  • 默认:已禁用

experimentalTailwindcss.attributes

类型:string[]

🌐 type: string[]

包含 Tailwind CSS 类的属性前缀列表。

🌐 List of attribute prefixes that contain Tailwind CSS classes.

注意:尚不支持正则表达式模式。

🌐 NOTE: Regex patterns are not yet supported.

  • 默认:["class", "className"]
  • 示例:["myClassProp", ":class"]

experimentalTailwindcss.config

类型:string

🌐 type: string

Tailwind CSS 配置文件的路径 (v3)。

🌐 Path to your Tailwind CSS configuration file (v3).

注意:路径是相对于 Oxfmt 配置文件解析的。

🌐 NOTE: Paths are resolved relative to the Oxfmt configuration file.

  • 默认:自动查找 "tailwind.config.js"

experimentalTailwindcss.functions

类型:string[]

🌐 type: string[]

包含 Tailwind CSS 类的自定义函数名称前缀列表。

🌐 List of custom function name prefixes that contain Tailwind CSS classes.

注意:尚不支持正则表达式模式。

🌐 NOTE: Regex patterns are not yet supported.

  • 默认:[]
  • 示例:["clsx", "cn", "cva", "tw"]

experimentalTailwindcss.preserveDuplicates

类型:boolean

🌐 type: boolean

保留重复的职业。

🌐 Preserve duplicate classes.

  • 默认:false

experimentalTailwindcss.preserveWhitespace

类型:boolean

🌐 type: boolean

保留类周围的空白。

🌐 Preserve whitespace around classes.

  • 默认:false

experimentalTailwindcss.stylesheet

类型:string

🌐 type: string

Tailwind CSS 样式表的路径 (v4)。

🌐 Path to your Tailwind CSS stylesheet (v4).

注意:路径是相对于 Oxfmt 配置文件解析的。

🌐 NOTE: Paths are resolved relative to the Oxfmt configuration file.

  • 默认:已安装 Tailwind CSS 的 theme.css

htmlWhitespaceSensitivity

类型:"css" | "strict" | "ignore"

🌐 type: "css" | "strict" | "ignore"

为 HTML、Vue、Angular 和 Handlebars 指定全局空白符敏感性。

🌐 Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.

  • 默认:"css"

ignorePatterns

类型:string[]

🌐 type: string[]

忽略匹配这些通配符模式的文件。模式是基于 Oxfmt 配置文件的位置。

🌐 Ignore files matching these glob patterns. Patterns are based on the location of the Oxfmt configuration file.

  • 默认:[]

insertFinalNewline

类型:boolean

🌐 type: boolean

是否在文件末尾插入一个最终换行符。

🌐 Whether to insert a final newline at the end of the file.

  • 默认:true
  • 覆盖 .editorconfig.insert_final_newline

jsxSingleQuote

类型:boolean

🌐 type: boolean

在 JSX 中使用单引号而不是双引号。

🌐 Use single quotes instead of double quotes in JSX.

  • 默认:false

objectWrap

类型:"preserve" | "collapse"

🌐 type: "preserve" | "collapse"

当对象字面量可以放在一行或跨多行时,如何进行换行封装。

🌐 How to wrap object literals when they could fit on one line or span multiple lines.

默认情况下,如果在第一个属性之前有换行符,则将对象格式化为多行。作者可以使用此启发式方法根据上下文提高可读性,尽管它也有一些缺点。

🌐 By default, formats objects as multi-line if there is a newline prior to the first property. Authors can use this heuristic to contextually improve readability, though it has some downsides.

  • 默认:"preserve"

覆盖

🌐 overrides

类型:array

🌐 type: array

文件特定的覆盖设置。 当一个文件匹配多个覆盖时,后面的覆盖设置优先(数组顺序很重要)。

🌐 File-specific overrides. When a file matches multiple overrides, the later override takes precedence (array order matters).

  • 默认:[]

覆盖[n]

🌐 overrides[n]

类型:object

🌐 type: object

overrides[n].excludeFiles

类型:string[]

🌐 type: string[]

从此覆盖中排除的通配符模式。

🌐 Glob patterns to exclude from this override.

overrides[n].files

类型:string[]

🌐 type: string[]

用于此覆盖匹配文件的全局模式。所有模式都相对于 Oxfmt 配置文件。

🌐 Glob patterns to match files for this override. All patterns are relative to the Oxfmt configuration file.

overrides[n].options

类型:object

🌐 type: object

overrides[n].options.arrowParens

类型:"always" | "avoid"

🌐 type: "always" | "avoid"

在单个箭头函数参数周围加上括号。

🌐 Include parentheses around a sole arrow function parameter.

  • 默认:"always"
overrides[n].options.bracketSameLine

类型:boolean

🌐 type: boolean

将多行 HTML(HTML、JSX、Vue、Angular)元素的 > 放在最后一行的末尾,而不是单独放在下一行(不适用于自闭合元素)。

🌐 Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line, instead of being alone on the next line (does not apply to self closing elements).

  • 默认:false
overrides[n].options.bracketSpacing

类型:boolean

🌐 type: boolean

在对象字面量的括号之间打印空格。

🌐 Print spaces between brackets in object literals.

  • 默认:true
overrides[n].options.embeddedLanguageFormatting

类型:"auto" | "off"

🌐 type: "auto" | "off"

控制是否格式化文件中的嵌入部分(例如,CSS-in-JS 或 JS-in-Vue 等)。

🌐 Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file.

注意:XXX-in-JS 支持不完整。 JS-in-XXX完全支持,但仍由Prettier负责。

🌐 NOTE: XXX-in-JS support is incomplete. JS-in-XXX is fully supported but still be handled by Prettier.

  • 默认:"auto"
overrides[n].options.endOfLine

类型:"lf" | "crlf" | "cr"

🌐 type: "lf" | "crlf" | "cr"

要应用哪种行结束符。

🌐 Which end of line characters to apply.

注意:不支持 "auto"

🌐 NOTE: "auto" is not supported.

  • 默认:"lf"
  • 覆盖“.editorconfig.end_of_line”
overrides[n].options.experimentalSortImports

类型:object

🌐 type: object

实验性功能:排序导入语句。

🌐 Experimental: Sort import statements.

使用与 eslint-plugin-perfectionist/sort-imports 类似的算法。详情请参阅各字段的文档。

🌐 Using the similar algorithm as eslint-plugin-perfectionist/sort-imports. For details, see each field's documentation.

  • 默认:已禁用
overrides[n].options.experimentalSortImports.customGroups

类型:array

🌐 type: array

为匹配非常特定的导入定义你自己的分组。

🌐 Define your own groups for matching very specific imports.

customGroups 列表是有序的:第一个与某个元素匹配的定义将被使用。自定义组的优先级高于任何预定义组。

🌐 The customGroups list is ordered: The first definition that matches an element will be used. Custom groups have a higher priority than any predefined group.

如果你希望预定义组优先于自定义组,你必须编写一个自定义组定义,其功能与预定义组相同,并将其放在列表的最前面。

🌐 If you want a predefined group to take precedence over a custom group, you must write a custom group definition that does the same as what the predefined group does, and put it first in the list.

  • 默认:[]

####### overrides[n].options.experimentalSortImports.customGroups[n]

类型:object

🌐 type: object

######## overrides[n].options.experimentalSortImports.customGroups[n].elementNamePattern

类型:string[]

🌐 type: string[]

默认:[]

🌐 default: []

此组要匹配的导入名称前缀列表。

🌐 List of import name prefixes to match for this group.

######## overrides[n].options.experimentalSortImports.customGroups[n].groupName

类型:string

🌐 type: string

默认:""

🌐 default: ""

自定义组的名称,用于“groups”选项。

🌐 Name of the custom group, used in the groups option.

overrides[n].options.experimentalSortImports.groups

类型:array

🌐 type: array

指定用于排序的预定义导入组列表。

🌐 Specifies a list of predefined import groups for sorting.

每个导入将被分配到 groups 选项中指定的单个组(如果没有匹配,将分配到 unknown 组)。 groups 选项中项目的顺序决定了组的排序方式。

🌐 Each import will be assigned a single group specified in the groups option (or the unknown group if no match is found). The order of items in the groups option determines how groups are ordered.

在给定的组内,成员将根据类型、顺序、忽略大小写等选项进行排序。

🌐 Within a given group, members will be sorted according to the type, order, ignoreCase, etc. options.

可以通过将各个组放入一个数组来将它们组合在一起。数组中组的顺序无关紧要。数组中所有组的成员将会被一起排序,就好像它们属于同一个组一样。

🌐 Individual groups can be combined together by placing them in an array. The order of groups in that array does not matter. All members of the groups in the array will be sorted together as if they were part of a single group.

预定义的组由一个选择器和可能的多个修饰符组成。你可以按任意顺序输入修饰符,但选择器必须始终放在最后。

🌐 Predefined groups are characterized by a single selector and potentially multiple modifiers. You may enter modifiers in any order, but the selector must always come at the end.

选择器列表按重要性从高到低排序:

🌐 The list of selectors is sorted from most to least important:

  • type — TypeScript 类型导入。
  • side-effect-style — 副作用风格的导入。
  • side-effect — 副作用导入。
  • style — 样式导入。
  • index — 当前目录下的主文件。
  • sibling — 来自同一目录的模块。
  • parent — 来自父目录的模块。
  • subpath — Node.js 子路径导入。
  • internal — 你的内部模块。
  • builtin — Node.js 内置模块。
  • external — 项目中安装的外部模块。
  • import — 任何导入。

修饰符列表按重要性从高到低排序:

🌐 The list of modifiers is sorted from most to least important:

  • side-effect — 副作用导入。
  • type — TypeScript 类型导入。
  • value — 价值导入。
  • default — 包含默认导入的导入语句。
  • wildcard — 包含通配符 (* as) 说明符的导入。
  • named — 包含至少一个命名导入的导入语句。
  • multiline — 多行导入。
  • singleline — 单行导入。

详情请参见 https://perfectionist.dev/rules/sort-imports#groups

  • 默认:见下文
json
[
  "type-import",
  ["value-builtin", "value-external"],
  "type-internal",
  "value-internal",
  ["type-parent", "type-sibling", "type-index"],
  ["value-parent", "value-sibling", "value-index"],
  "unknown"
]

####### overrides[n].options.experimentalSortImports.groups[n]

类型:array | string

🌐 type: array | string

######## overrides[n].options.experimentalSortImports.groups[n][n]

类型:string

🌐 type: string

overrides[n].options.experimentalSortImports.ignoreCase

类型:boolean

🌐 type: boolean

指定排序是否区分大小写。

🌐 Specifies whether sorting should be case-sensitive.

  • 默认:true
overrides[n].options.experimentalSortImports.internalPattern

类型:string[]

🌐 type: string[]

指定用于识别内部导入的前缀。

🌐 Specifies a prefix for identifying internal imports.

这有助于区分你自己的模块与外部依赖。

🌐 This is useful for distinguishing your own modules from external dependencies.

  • 默认:["~/", "@/"]
overrides[n].options.experimentalSortImports.newlinesBetween

类型:boolean

🌐 type: boolean

指定是否在组之间添加换行符。

🌐 Specifies whether to add newlines between groups.

false 时,各组之间不会添加换行符。

🌐 When false, no newlines are added between groups.

  • 默认:true
overrides[n].options.experimentalSortImports.order

类型:"asc" | "desc"

🌐 type: "asc" | "desc"

指定是否按升序或降序对项目进行排序。

🌐 Specifies whether to sort items in ascending or descending order.

  • 默认:"asc"
overrides[n].options.experimentalSortImports.partitionByComment

类型:boolean

🌐 type: boolean

允许使用注释将导入分隔为逻辑组。

🌐 Enables the use of comments to separate imports into logical groups.

true 时,所有注释将被视为分隔符,从而创建分区。

🌐 When true, all comments will be treated as delimiters, creating partitions.

js
import { b1, b2 } from "b";
// PARTITION
import { a } from "a";
import { c } from "c";
  • 默认:false
overrides[n].options.experimentalSortImports.partitionByNewline

类型:boolean

🌐 type: boolean

启用空行将导入分隔为逻辑组。

🌐 Enables the empty line to separate imports into logical groups.

true 时,如果导入之间有空行,格式化程序将不会对导入进行排序。这有助于保持逻辑上分组成员的定义顺序。

🌐 When true, formatter will not sort imports if there is an empty line between them. This helps maintain the defined order of logically separated groups of members.

js
import { b1, b2 } from "b";

import { a } from "a";
import { c } from "c";
  • 默认:false
overrides[n].options.experimentalSortImports.sortSideEffects

类型:boolean

🌐 type: boolean

指定是否应对有副作用的导入进行排序。

🌐 Specifies whether side effect imports should be sorted.

默认情况下,出于安全原因,侧面导入的排序被禁用。

🌐 By default, sorting side-effect imports is disabled for security reasons.

  • 默认:false
overrides[n].options.experimentalSortPackageJson

类型:object | boolean

🌐 type: object | boolean

试验性功能:排序 package.json 键。

🌐 Experimental: Sort package.json keys.

该算法与 prettier-plugin-sort-packagejson 不兼容。但我们认为它更清晰,更易于导航。详情请参阅各字段的文档。

🌐 The algorithm is NOT compatible with prettier-plugin-sort-packagejson. But we believe it is clearer and easier to navigate. For details, see each field's documentation.

  • 默认:true
overrides[n].options.experimentalSortPackageJson.sortScripts

类型:boolean

🌐 type: boolean

按字母顺序排序 scripts 字段。

🌐 Sort the scripts field alphabetically.

  • 默认:false
overrides[n].options.experimentalTailwindcss

类型:object

🌐 type: object

实验性:排序Tailwind CSS类。

🌐 Experimental: Sort Tailwind CSS classes.

使用与 prettier-plugin-tailwindcss 相同的算法。选项名称省略了原插件中使用的 tailwind 前缀(例如,使用 config 而不是 tailwindConfig)。详情请参阅各字段的文档。

🌐 Using the same algorithm as prettier-plugin-tailwindcss. Option names omit the tailwind prefix used in the original plugin (e.g., config instead of tailwindConfig). For details, see each field's documentation.

  • 默认:已禁用
overrides[n].options.experimentalTailwindcss.attributes

类型:string[]

🌐 type: string[]

包含 Tailwind CSS 类的属性前缀列表。

🌐 List of attribute prefixes that contain Tailwind CSS classes.

注意:尚不支持正则表达式模式。

🌐 NOTE: Regex patterns are not yet supported.

  • 默认:["class", "className"]
  • 示例:["myClassProp", ":class"]
overrides[n].options.experimentalTailwindcss.config

类型:string

🌐 type: string

Tailwind CSS 配置文件的路径 (v3)。

🌐 Path to your Tailwind CSS configuration file (v3).

注意:路径是相对于 Oxfmt 配置文件解析的。

🌐 NOTE: Paths are resolved relative to the Oxfmt configuration file.

  • 默认:自动查找 "tailwind.config.js"
overrides[n].options.experimentalTailwindcss.functions

类型:string[]

🌐 type: string[]

包含 Tailwind CSS 类的自定义函数名称前缀列表。

🌐 List of custom function name prefixes that contain Tailwind CSS classes.

注意:尚不支持正则表达式模式。

🌐 NOTE: Regex patterns are not yet supported.

  • 默认:[]
  • 示例:["clsx", "cn", "cva", "tw"]
overrides[n].options.experimentalTailwindcss.preserveDuplicates

类型:boolean

🌐 type: boolean

保留重复的职业。

🌐 Preserve duplicate classes.

  • 默认:false
overrides[n].options.experimentalTailwindcss.preserveWhitespace

类型:boolean

🌐 type: boolean

保留类周围的空白。

🌐 Preserve whitespace around classes.

  • 默认:false
overrides[n].options.experimentalTailwindcss.stylesheet

类型:string

🌐 type: string

Tailwind CSS 样式表的路径 (v4)。

🌐 Path to your Tailwind CSS stylesheet (v4).

注意:路径是相对于 Oxfmt 配置文件解析的。

🌐 NOTE: Paths are resolved relative to the Oxfmt configuration file.

  • 默认:已安装 Tailwind CSS 的 theme.css
overrides[n].options.htmlWhitespaceSensitivity

类型:"css" | "strict" | "ignore"

🌐 type: "css" | "strict" | "ignore"

为 HTML、Vue、Angular 和 Handlebars 指定全局空白符敏感性。

🌐 Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.

  • 默认:"css"
overrides[n].options.insertFinalNewline

类型:boolean

🌐 type: boolean

是否在文件末尾插入一个最终换行符。

🌐 Whether to insert a final newline at the end of the file.

  • 默认:true
  • 覆盖 .editorconfig.insert_final_newline
overrides[n].options.jsxSingleQuote

类型:boolean

🌐 type: boolean

在 JSX 中使用单引号而不是双引号。

🌐 Use single quotes instead of double quotes in JSX.

  • 默认:false
overrides[n].options.objectWrap

类型:"preserve" | "collapse"

🌐 type: "preserve" | "collapse"

当对象字面量可以放在一行或跨多行时,如何进行换行封装。

🌐 How to wrap object literals when they could fit on one line or span multiple lines.

默认情况下,如果在第一个属性之前有换行符,则将对象格式化为多行。作者可以使用此启发式方法根据上下文提高可读性,尽管它也有一些缺点。

🌐 By default, formats objects as multi-line if there is a newline prior to the first property. Authors can use this heuristic to contextually improve readability, though it has some downsides.

  • 默认:"preserve"
overrides[n].options.printWidth

类型:integer

🌐 type: integer

指定打印机换行的行长度。

🌐 Specify the line length that the printer will wrap on.

如果你在格式化 Markdown 时不希望自动换行,可以设置 proseWrap 选项来禁用它。

🌐 If you don't want line wrapping when formatting Markdown, you can set the proseWrap option to disable it.

  • 默认:100
  • 覆盖 .editorconfig.max_line_length
overrides[n].options.proseWrap

类型:"always" | "never" | "preserve"

🌐 type: "always" | "never" | "preserve"

如何排版散文。

🌐 How to wrap prose.

默认情况下,格式化工具不会更改 Markdown 文本中的换行,因为某些服务使用对换行敏感的渲染器,例如 GitHub 评论和 BitBucket。 要将散文换行以适应打印宽度,请将此选项更改为“always”。 如果你想强制将所有散文块放在单行上,并依赖编辑器/查看器的软换行功能,则可以使用“never”。

🌐 By default, formatter will not change wrapping in markdown text since some services use a linebreak-sensitive renderer, e.g. GitHub comments and BitBucket. To wrap prose to the print width, change this option to "always". If you want to force all prose blocks to be on a single line and rely on editor/viewer soft wrapping instead, you can use "never".

  • 默认:"preserve"
overrides[n].options.quoteProps

类型:"as-needed" | "consistent" | "preserve"

🌐 type: "as-needed" | "consistent" | "preserve"

当对象中的属性被引用时更改。

🌐 Change when properties in objects are quoted.

  • 默认:"as-needed"
overrides[n].options.semi

类型:boolean

🌐 type: boolean

在语句末尾打印分号。

🌐 Print semicolons at the ends of statements.

  • 默认:true
overrides[n].options.singleAttributePerLine

类型:boolean

🌐 type: boolean

在 HTML、Vue 和 JSX 中强制每行只写一个属性。

🌐 Enforce single attribute per line in HTML, Vue, and JSX.

  • 默认:false
overrides[n].options.singleQuote

类型:boolean

🌐 type: boolean

使用单引号而不是双引号。

🌐 Use single quotes instead of double quotes.

对于 JSX,你可以设置 jsxSingleQuote 选项。

🌐 For JSX, you can set the jsxSingleQuote option.

  • 默认:false
overrides[n].options.tabWidth

类型:integer

🌐 type: integer

指定每个缩进级别的空格数。

🌐 Specify the number of spaces per indentation-level.

  • 默认:2
  • 覆盖 .editorconfig.indent_size
overrides[n].options.trailingComma

类型:"all" | "es5" | "none"

🌐 type: "all" | "es5" | "none"

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

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

例如,单行数组永远不会有尾随逗号。

🌐 A single-line array, for example, never gets trailing commas.

  • 默认:"all"
overrides[n].options.useTabs

类型:boolean

🌐 type: boolean

用制表符缩进行,而不是空格。

🌐 Indent lines with tabs instead of spaces.

  • 默认:false
  • 覆盖 .editorconfig.indent_style
overrides[n].options.vueIndentScriptAndStyle

类型:boolean

🌐 type: boolean

是否在 Vue 文件中的 <script><style> 标签内缩进代码。

🌐 Whether or not to indent the code inside <script> and <style> tags in Vue files.

  • 默认:false

printWidth

类型:integer

🌐 type: integer

指定打印机换行的行长度。

🌐 Specify the line length that the printer will wrap on.

如果你在格式化 Markdown 时不希望自动换行,可以设置 proseWrap 选项来禁用它。

🌐 If you don't want line wrapping when formatting Markdown, you can set the proseWrap option to disable it.

  • 默认:100
  • 覆盖 .editorconfig.max_line_length

proseWrap

类型:"always" | "never" | "preserve"

🌐 type: "always" | "never" | "preserve"

如何排版散文。

🌐 How to wrap prose.

默认情况下,格式化工具不会更改 Markdown 文本中的换行,因为某些服务使用对换行敏感的渲染器,例如 GitHub 评论和 BitBucket。 要将散文换行以适应打印宽度,请将此选项更改为“always”。 如果你想强制将所有散文块放在单行上,并依赖编辑器/查看器的软换行功能,则可以使用“never”。

🌐 By default, formatter will not change wrapping in markdown text since some services use a linebreak-sensitive renderer, e.g. GitHub comments and BitBucket. To wrap prose to the print width, change this option to "always". If you want to force all prose blocks to be on a single line and rely on editor/viewer soft wrapping instead, you can use "never".

  • 默认:"preserve"

quoteProps

类型:"as-needed" | "consistent" | "preserve"

🌐 type: "as-needed" | "consistent" | "preserve"

当对象中的属性被引用时更改。

🌐 Change when properties in objects are quoted.

  • 默认:"as-needed"

semi

类型:boolean

🌐 type: boolean

在语句末尾打印分号。

🌐 Print semicolons at the ends of statements.

  • 默认:true

singleAttributePerLine

类型:boolean

🌐 type: boolean

在 HTML、Vue 和 JSX 中强制每行只写一个属性。

🌐 Enforce single attribute per line in HTML, Vue, and JSX.

  • 默认:false

singleQuote

类型:boolean

🌐 type: boolean

使用单引号而不是双引号。

🌐 Use single quotes instead of double quotes.

对于 JSX,你可以设置 jsxSingleQuote 选项。

🌐 For JSX, you can set the jsxSingleQuote option.

  • 默认:false

tabWidth

类型:integer

🌐 type: integer

指定每个缩进级别的空格数。

🌐 Specify the number of spaces per indentation-level.

  • 默认:2
  • 覆盖 .editorconfig.indent_size

trailingComma

类型:"all" | "es5" | "none"

🌐 type: "all" | "es5" | "none"

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

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

例如,单行数组永远不会有尾随逗号。

🌐 A single-line array, for example, never gets trailing commas.

  • 默认:"all"

useTabs

类型:boolean

🌐 type: boolean

用制表符缩进行,而不是空格。

🌐 Indent lines with tabs instead of spaces.

  • 默认:false
  • 覆盖 .editorconfig.indent_style

vueIndentScriptAndStyle

类型:boolean

🌐 type: boolean

是否在 Vue 文件中的 <script><style> 标签内缩进代码。

🌐 Whether or not to indent the code inside <script> and <style> tags in Vue files.

  • 默认:false