mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
docs(oxfmt): simplify oxfmtrc docs (#27432)
This commit is contained in:
1 parent
c1adce3925
commit
408d87f628
4 files changed
+366
-414
No files matched your search
@@ -50,7 +50,7 @@ export type SvelteUserConfig = boolean | SvelteConfig;
|
||||
export type TrailingCommaConfig = "all" | "es5" | "none";
|
||||
|
||||
/**
|
||||
* Configuration options for the Oxfmt.
|
||||
* Configuration options for Oxfmt.
|
||||
*
|
||||
* Most options are the same as Prettier's options, but not all of them.
|
||||
* In addition, some options are our own extensions.
|
||||
@@ -66,21 +66,19 @@ export interface Oxfmtrc {
|
||||
/**
|
||||
* Options for `prettier-plugin-astro`.
|
||||
*
|
||||
* Pass `true` or an object to enable `.astro` file formatting,
|
||||
* or `false` (handy in overrides) / omit to disable.
|
||||
* Setting `true` resets to defaults — any options inherited from a parent scope are dropped.
|
||||
* Pass `true` or an object to enable `.astro` file formatting, `false` to disable (handy in overrides).
|
||||
* Setting `true` resets to defaults, dropping options inherited from a parent scope.
|
||||
*
|
||||
* NOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime,
|
||||
* but Oxfmt does NOT bundle or auto-install it.
|
||||
* You must install `@astrojs/compiler-rs` yourself in your project, formatting will fail at runtime otherwise.
|
||||
* NOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime.
|
||||
* Oxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.
|
||||
*
|
||||
* - Languages: Astro
|
||||
* - Default: Disabled
|
||||
*/
|
||||
astro?: AstroUserConfig;
|
||||
/**
|
||||
* 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).
|
||||
* Put the `>` of a multi-line element at the end of the last line,
|
||||
* instead of being alone on the next line (does not apply to self-closing elements).
|
||||
*
|
||||
* - Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro
|
||||
* - Default: `false`
|
||||
@@ -102,12 +100,12 @@ export interface Oxfmtrc {
|
||||
* - YAML-in-CSS/Markdown: front matter
|
||||
*
|
||||
* With `"off"`, these parts are kept as-is.
|
||||
* NOTE: Except for some languages:
|
||||
* - Svelte: formatting fails with "off", this is a limitation of `prettier-plugin-svelte`
|
||||
* - Astro: the frontmatter is still formatted, but by Prettier instead of Oxfmt
|
||||
* (use `astro.skipFrontmatter` to keep it as-is)
|
||||
*
|
||||
* - Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX (languages with embedded code)
|
||||
* NOTE: Some languages behave differently.
|
||||
* For Svelte, formatting fails with `"off"`, a limitation of `prettier-plugin-svelte`.
|
||||
* For Astro, the frontmatter is still formatted, but by Prettier instead of Oxfmt (use `astro.skipFrontmatter` to keep it as-is).
|
||||
*
|
||||
* - Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX
|
||||
* - Default: `"auto"`
|
||||
*/
|
||||
embeddedLanguageFormatting?: EmbeddedLanguageFormattingConfig;
|
||||
@@ -130,7 +128,7 @@ export interface Oxfmtrc {
|
||||
*/
|
||||
experimentalOperatorPosition?: OperatorPositionConfig;
|
||||
/**
|
||||
* Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.
|
||||
* Specify the global whitespace sensitivity.
|
||||
*
|
||||
* - Languages: HTML, Angular, Vue, Handlebars, Svelte
|
||||
* - Default: `"css"`
|
||||
@@ -155,11 +153,10 @@ export interface Oxfmtrc {
|
||||
/**
|
||||
* Enable JSDoc comment formatting.
|
||||
*
|
||||
* When enabled, JSDoc comments are normalized and reformatted:
|
||||
* tag aliases are canonicalized, descriptions are capitalized,
|
||||
* Normalizes JSDoc comments: tag aliases are canonicalized, descriptions are capitalized,
|
||||
* long lines are wrapped, and short comments are collapsed to single-line.
|
||||
*
|
||||
* Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
* Pass `true` or an object to enable, `false` to disable.
|
||||
*
|
||||
* - Languages: JS, JSX, TS, TSX
|
||||
* - Default: Disabled
|
||||
@@ -202,9 +199,11 @@ export interface Oxfmtrc {
|
||||
/**
|
||||
* How to wrap prose.
|
||||
*
|
||||
* 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".
|
||||
* - `"always"`: Wrap prose to the print width
|
||||
* - `"never"`: Put each prose block on a single line, relying on editor/viewer soft wrapping
|
||||
* - `"preserve"`: Keep wrapping as-is
|
||||
*
|
||||
* By default, wrapping is preserved, since some services use a linebreak-sensitive renderer (e.g. GitHub comments, BitBucket).
|
||||
*
|
||||
* - Languages: Markdown, MDX, YAML
|
||||
* - Default: `"preserve"`
|
||||
@@ -225,7 +224,7 @@ export interface Oxfmtrc {
|
||||
*/
|
||||
semi?: boolean;
|
||||
/**
|
||||
* Enforce single attribute per line in HTML, Vue, and JSX.
|
||||
* Enforce single attribute per line.
|
||||
*
|
||||
* - Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro
|
||||
* - Default: `false`
|
||||
@@ -244,10 +243,9 @@ export interface Oxfmtrc {
|
||||
/**
|
||||
* Sort import statements.
|
||||
*
|
||||
* Using the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
|
||||
* For details, see each field's documentation.
|
||||
* Uses a similar algorithm to [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
|
||||
*
|
||||
* Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
* Pass `true` or an object to enable, `false` to disable.
|
||||
*
|
||||
* - Languages: JS, JSX, TS, TSX
|
||||
* - Default: Disabled
|
||||
@@ -256,9 +254,8 @@ export interface Oxfmtrc {
|
||||
/**
|
||||
* Sort `package.json` keys.
|
||||
*
|
||||
* The algorithm is NOT compatible with [prettier-plugin-sort-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson).
|
||||
* But we believe it is clearer and easier to navigate.
|
||||
* For details, see each field's documentation.
|
||||
* The order is NOT compatible with [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson),
|
||||
* but we believe it is clearer and easier to navigate.
|
||||
*
|
||||
* - Languages: JSON (`package.json` only)
|
||||
* - Default: `true`
|
||||
@@ -267,11 +264,10 @@ export interface Oxfmtrc {
|
||||
/**
|
||||
* Sort Tailwind CSS classes.
|
||||
*
|
||||
* Using the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/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.
|
||||
* Uses the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).
|
||||
* Option names omit the `tailwind` prefix used in the original plugin (e.g. `config` instead of `tailwindConfig`).
|
||||
*
|
||||
* Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
* Pass `true` or an object to enable, `false` to disable.
|
||||
*
|
||||
* - Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro
|
||||
* - Default: Disabled
|
||||
@@ -280,13 +276,11 @@ export interface Oxfmtrc {
|
||||
/**
|
||||
* Options for `prettier-plugin-svelte`.
|
||||
*
|
||||
* Pass `true` or an object to enable `.svelte` file formatting,
|
||||
* or `false` (handy in overrides) / omit to disable.
|
||||
* Setting `true` resets to defaults — any options inherited from a parent scope are dropped.
|
||||
* Pass `true` or an object to enable `.svelte` file formatting, `false` to disable (handy in overrides).
|
||||
* Setting `true` resets to defaults, dropping options inherited from a parent scope.
|
||||
*
|
||||
* NOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime,
|
||||
* but Oxfmt does NOT bundle or auto-install it.
|
||||
* You must install `svelte` yourself in your project, formatting will fail at runtime otherwise.
|
||||
* NOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime.
|
||||
* Oxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.
|
||||
*
|
||||
* - Languages: Svelte
|
||||
* - Default: Disabled
|
||||
@@ -371,9 +365,11 @@ export interface JsdocConfig {
|
||||
/**
|
||||
* How to format comment blocks.
|
||||
*
|
||||
* - `"singleLine"` — Convert to single-line `/** content * /` when possible.
|
||||
* - `"multiline"` — Always use multi-line format.
|
||||
* - `"keep"` — Preserve original formatting.
|
||||
* - `"singleLine"`: Convert to single-line `/** content * /` when possible
|
||||
* - `"multiline"`: Always use multi-line format
|
||||
* - `"keep"`: Preserve original formatting
|
||||
*
|
||||
* By default, comments are collapsed to a single line when possible.
|
||||
*
|
||||
* - Default: `"singleLine"`
|
||||
*/
|
||||
@@ -399,8 +395,10 @@ export interface JsdocConfig {
|
||||
/**
|
||||
* Strategy for wrapping description lines at print width.
|
||||
*
|
||||
* - `"greedy"` — Always re-wrap text to fit within print width.
|
||||
* - `"balance"` — Preserve original line breaks if all lines fit within print width.
|
||||
* - `"greedy"`: Always re-wrap text to fit within print width
|
||||
* - `"balance"`: Preserve original line breaks if all lines fit within print width
|
||||
*
|
||||
* By default, description lines are always re-wrapped.
|
||||
*
|
||||
* - Default: `"greedy"`
|
||||
*/
|
||||
@@ -452,21 +450,19 @@ export interface FormatConfig {
|
||||
/**
|
||||
* Options for `prettier-plugin-astro`.
|
||||
*
|
||||
* Pass `true` or an object to enable `.astro` file formatting,
|
||||
* or `false` (handy in overrides) / omit to disable.
|
||||
* Setting `true` resets to defaults — any options inherited from a parent scope are dropped.
|
||||
* Pass `true` or an object to enable `.astro` file formatting, `false` to disable (handy in overrides).
|
||||
* Setting `true` resets to defaults, dropping options inherited from a parent scope.
|
||||
*
|
||||
* NOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime,
|
||||
* but Oxfmt does NOT bundle or auto-install it.
|
||||
* You must install `@astrojs/compiler-rs` yourself in your project, formatting will fail at runtime otherwise.
|
||||
* NOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime.
|
||||
* Oxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.
|
||||
*
|
||||
* - Languages: Astro
|
||||
* - Default: Disabled
|
||||
*/
|
||||
astro?: AstroUserConfig;
|
||||
/**
|
||||
* 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).
|
||||
* Put the `>` of a multi-line element at the end of the last line,
|
||||
* instead of being alone on the next line (does not apply to self-closing elements).
|
||||
*
|
||||
* - Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro
|
||||
* - Default: `false`
|
||||
@@ -488,12 +484,12 @@ export interface FormatConfig {
|
||||
* - YAML-in-CSS/Markdown: front matter
|
||||
*
|
||||
* With `"off"`, these parts are kept as-is.
|
||||
* NOTE: Except for some languages:
|
||||
* - Svelte: formatting fails with "off", this is a limitation of `prettier-plugin-svelte`
|
||||
* - Astro: the frontmatter is still formatted, but by Prettier instead of Oxfmt
|
||||
* (use `astro.skipFrontmatter` to keep it as-is)
|
||||
*
|
||||
* - Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX (languages with embedded code)
|
||||
* NOTE: Some languages behave differently.
|
||||
* For Svelte, formatting fails with `"off"`, a limitation of `prettier-plugin-svelte`.
|
||||
* For Astro, the frontmatter is still formatted, but by Prettier instead of Oxfmt (use `astro.skipFrontmatter` to keep it as-is).
|
||||
*
|
||||
* - Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX
|
||||
* - Default: `"auto"`
|
||||
*/
|
||||
embeddedLanguageFormatting?: EmbeddedLanguageFormattingConfig;
|
||||
@@ -516,7 +512,7 @@ export interface FormatConfig {
|
||||
*/
|
||||
experimentalOperatorPosition?: OperatorPositionConfig;
|
||||
/**
|
||||
* Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.
|
||||
* Specify the global whitespace sensitivity.
|
||||
*
|
||||
* - Languages: HTML, Angular, Vue, Handlebars, Svelte
|
||||
* - Default: `"css"`
|
||||
@@ -533,11 +529,10 @@ export interface FormatConfig {
|
||||
/**
|
||||
* Enable JSDoc comment formatting.
|
||||
*
|
||||
* When enabled, JSDoc comments are normalized and reformatted:
|
||||
* tag aliases are canonicalized, descriptions are capitalized,
|
||||
* Normalizes JSDoc comments: tag aliases are canonicalized, descriptions are capitalized,
|
||||
* long lines are wrapped, and short comments are collapsed to single-line.
|
||||
*
|
||||
* Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
* Pass `true` or an object to enable, `false` to disable.
|
||||
*
|
||||
* - Languages: JS, JSX, TS, TSX
|
||||
* - Default: Disabled
|
||||
@@ -573,9 +568,11 @@ export interface FormatConfig {
|
||||
/**
|
||||
* How to wrap prose.
|
||||
*
|
||||
* 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".
|
||||
* - `"always"`: Wrap prose to the print width
|
||||
* - `"never"`: Put each prose block on a single line, relying on editor/viewer soft wrapping
|
||||
* - `"preserve"`: Keep wrapping as-is
|
||||
*
|
||||
* By default, wrapping is preserved, since some services use a linebreak-sensitive renderer (e.g. GitHub comments, BitBucket).
|
||||
*
|
||||
* - Languages: Markdown, MDX, YAML
|
||||
* - Default: `"preserve"`
|
||||
@@ -596,7 +593,7 @@ export interface FormatConfig {
|
||||
*/
|
||||
semi?: boolean;
|
||||
/**
|
||||
* Enforce single attribute per line in HTML, Vue, and JSX.
|
||||
* Enforce single attribute per line.
|
||||
*
|
||||
* - Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro
|
||||
* - Default: `false`
|
||||
@@ -615,10 +612,9 @@ export interface FormatConfig {
|
||||
/**
|
||||
* Sort import statements.
|
||||
*
|
||||
* Using the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
|
||||
* For details, see each field's documentation.
|
||||
* Uses a similar algorithm to [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
|
||||
*
|
||||
* Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
* Pass `true` or an object to enable, `false` to disable.
|
||||
*
|
||||
* - Languages: JS, JSX, TS, TSX
|
||||
* - Default: Disabled
|
||||
@@ -627,9 +623,8 @@ export interface FormatConfig {
|
||||
/**
|
||||
* Sort `package.json` keys.
|
||||
*
|
||||
* The algorithm is NOT compatible with [prettier-plugin-sort-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson).
|
||||
* But we believe it is clearer and easier to navigate.
|
||||
* For details, see each field's documentation.
|
||||
* The order is NOT compatible with [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson),
|
||||
* but we believe it is clearer and easier to navigate.
|
||||
*
|
||||
* - Languages: JSON (`package.json` only)
|
||||
* - Default: `true`
|
||||
@@ -638,11 +633,10 @@ export interface FormatConfig {
|
||||
/**
|
||||
* Sort Tailwind CSS classes.
|
||||
*
|
||||
* Using the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/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.
|
||||
* Uses the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).
|
||||
* Option names omit the `tailwind` prefix used in the original plugin (e.g. `config` instead of `tailwindConfig`).
|
||||
*
|
||||
* Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
* Pass `true` or an object to enable, `false` to disable.
|
||||
*
|
||||
* - Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro
|
||||
* - Default: Disabled
|
||||
@@ -651,13 +645,11 @@ export interface FormatConfig {
|
||||
/**
|
||||
* Options for `prettier-plugin-svelte`.
|
||||
*
|
||||
* Pass `true` or an object to enable `.svelte` file formatting,
|
||||
* or `false` (handy in overrides) / omit to disable.
|
||||
* Setting `true` resets to defaults — any options inherited from a parent scope are dropped.
|
||||
* Pass `true` or an object to enable `.svelte` file formatting, `false` to disable (handy in overrides).
|
||||
* Setting `true` resets to defaults, dropping options inherited from a parent scope.
|
||||
*
|
||||
* NOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime,
|
||||
* but Oxfmt does NOT bundle or auto-install it.
|
||||
* You must install `svelte` yourself in your project, formatting will fail at runtime otherwise.
|
||||
* NOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime.
|
||||
* Oxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.
|
||||
*
|
||||
* - Languages: Svelte
|
||||
* - Default: Disabled
|
||||
@@ -701,14 +693,11 @@ export interface SortImportsConfig {
|
||||
/**
|
||||
* Define your own groups for matching very specific imports.
|
||||
*
|
||||
* 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.
|
||||
* The first matching definition is used, and custom groups take precedence over predefined groups.
|
||||
* To give a predefined group precedence, define an equivalent custom group and put it first.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* If you specify multiple conditions like `elementNamePattern`, `selector`, and `modifiers`,
|
||||
* all conditions must be met for an import to match the custom group (AND logic).
|
||||
* When multiple conditions (`elementNamePattern`, `selector`, `modifiers`) are specified,
|
||||
* all of them must match.
|
||||
*
|
||||
* NOTE: Predefined group names (e.g. `side_effect`, `external`) and `unknown` are reserved and cannot be used as `groupName`.
|
||||
*
|
||||
@@ -716,41 +705,40 @@ export interface SortImportsConfig {
|
||||
*/
|
||||
customGroups?: CustomGroupItemConfig[];
|
||||
/**
|
||||
* Specifies a list of predefined import groups for sorting.
|
||||
* List of import groups for sorting.
|
||||
*
|
||||
* 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.
|
||||
* Each import is assigned to a single group (or `unknown` if none matches), and groups are ordered as listed.
|
||||
* Within a group, imports are sorted according to `order`, `ignoreCase`, etc.
|
||||
*
|
||||
* Within a given group, members will be sorted according to the type, order, ignoreCase, etc. options.
|
||||
* A predefined group name is a single selector with optional modifiers, joined by `-` (e.g. `type-external`).
|
||||
* Modifiers can be in any order, but the selector must come last.
|
||||
*
|
||||
* 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.
|
||||
* Selectors, from most to least important:
|
||||
* - `type`: TypeScript type imports.
|
||||
* - `side_effect_style`: Side effect style imports.
|
||||
* - `side_effect`: Side effect imports.
|
||||
* - `style`: Style imports.
|
||||
* - `index`: Main file from the current directory.
|
||||
* - `sibling`: Modules from the same directory.
|
||||
* - `parent`: Modules from the parent directory.
|
||||
* - `subpath`: Node.js subpath imports.
|
||||
* - `internal`: Your internal modules.
|
||||
* - `builtin`: Node.js Built-in Modules.
|
||||
* - `external`: External modules installed in the project.
|
||||
* - `import`: Any import.
|
||||
*
|
||||
* 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.
|
||||
* Modifiers, from most to least important:
|
||||
* - `side_effect`: Side effect imports.
|
||||
* - `type`: TypeScript type imports.
|
||||
* - `value`: Value imports.
|
||||
* - `default`: Imports containing the default specifier.
|
||||
* - `wildcard`: Imports containing the wildcard (`* as`) specifier.
|
||||
* - `named`: Imports containing at least one named specifier.
|
||||
*
|
||||
* The list of selectors is sorted from most to least important:
|
||||
* - `type` — TypeScript type imports.
|
||||
* - `side_effect_style` — Side effect style imports.
|
||||
* - `side_effect` — Side effect imports.
|
||||
* - `style` — Style imports.
|
||||
* - `index` — Main file from the current directory.
|
||||
* - `sibling` — Modules from the same directory.
|
||||
* - `parent` — Modules from the parent directory.
|
||||
* - `subpath` — Node.js subpath imports.
|
||||
* - `internal` — Your internal modules.
|
||||
* - `builtin` — Node.js Built-in Modules.
|
||||
* - `external` — External modules installed in the project.
|
||||
* - `import` — Any import.
|
||||
* Wrap groups in an array to sort them together as a single group (order within the array does not matter).
|
||||
*
|
||||
* The list of modifiers is sorted from most to least important:
|
||||
* - `side_effect` — Side effect imports.
|
||||
* - `type` — TypeScript type imports.
|
||||
* - `value` — Value imports.
|
||||
* - `default` — Imports containing the default specifier.
|
||||
* - `wildcard` — Imports containing the wildcard (`* as`) specifier.
|
||||
* - `named` — Imports containing at least one named specifier.
|
||||
* To override `newlinesBetween` at a specific group boundary,
|
||||
* put a `{ "newlinesBetween": boolean }` marker object at that position.
|
||||
*
|
||||
* - Default: See below
|
||||
* ```json
|
||||
@@ -763,43 +751,36 @@ export interface SortImportsConfig {
|
||||
* "unknown"
|
||||
* ]
|
||||
* ```
|
||||
*
|
||||
* Also, you can override the global `newlinesBetween` setting for specific group boundaries
|
||||
* by including a `{ "newlinesBetween": boolean }` marker object in the `groups` list at the desired position.
|
||||
*/
|
||||
groups?: SortGroupItemConfig[];
|
||||
/**
|
||||
* Specifies whether sorting should be case-sensitive.
|
||||
* Ignore case when sorting.
|
||||
*
|
||||
* - Default: `true`
|
||||
*/
|
||||
ignoreCase?: boolean;
|
||||
/**
|
||||
* Specifies a prefix for identifying internal imports.
|
||||
*
|
||||
* This is useful for distinguishing your own modules from external dependencies.
|
||||
* Prefixes for identifying internal imports.
|
||||
*
|
||||
* - Default: `["~/", "@/", "#"]`
|
||||
*/
|
||||
internalPattern?: string[];
|
||||
/**
|
||||
* Specifies whether to add newlines between groups.
|
||||
*
|
||||
* When `false`, no newlines are added between groups.
|
||||
* Add newlines between groups.
|
||||
*
|
||||
* - Default: `true`
|
||||
*/
|
||||
newlinesBetween?: boolean;
|
||||
/**
|
||||
* Specifies whether to sort items in ascending or descending order.
|
||||
* Sort in ascending or descending order.
|
||||
*
|
||||
* - Default: `"asc"`
|
||||
*/
|
||||
order?: SortOrderConfig;
|
||||
/**
|
||||
* Enables the use of comments to separate imports into logical groups.
|
||||
* Use comments to separate imports into logical groups.
|
||||
*
|
||||
* When `true`, all comments will be treated as delimiters, creating partitions.
|
||||
* When `true`, all comments are treated as delimiters.
|
||||
*
|
||||
* ```js
|
||||
* import { b1, b2 } from 'b'
|
||||
@@ -812,10 +793,9 @@ export interface SortImportsConfig {
|
||||
*/
|
||||
partitionByComment?: boolean;
|
||||
/**
|
||||
* Enables the empty line to separate imports into logical groups.
|
||||
* Use empty lines to separate imports into logical groups.
|
||||
*
|
||||
* 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.
|
||||
* When `true`, imports are not sorted across an empty line.
|
||||
*
|
||||
* ```js
|
||||
* import { b1, b2 } from 'b'
|
||||
@@ -828,9 +808,9 @@ export interface SortImportsConfig {
|
||||
*/
|
||||
partitionByNewline?: boolean;
|
||||
/**
|
||||
* Specifies whether side effect imports should be sorted.
|
||||
* Sort side effect imports.
|
||||
*
|
||||
* By default, sorting side-effect imports is disabled for security reasons.
|
||||
* Disabled by default for safety reasons.
|
||||
*
|
||||
* - Default: `false`
|
||||
*/
|
||||
@@ -848,7 +828,7 @@ export interface CustomGroupItemConfig {
|
||||
groupName?: string;
|
||||
/**
|
||||
* Modifiers to match the import characteristics.
|
||||
* All specified modifiers must be present (AND logic).
|
||||
* All specified modifiers must match.
|
||||
*/
|
||||
modifiers?: ImportModifierConfig[];
|
||||
/**
|
||||
@@ -924,7 +904,7 @@ export interface SortTailwindcssConfig {
|
||||
}
|
||||
export interface SvelteConfig {
|
||||
/**
|
||||
* Whether to allow attribute shorthand if attribute name and expression are same.
|
||||
* Whether to allow attribute shorthand if attribute name and expression are the same.
|
||||
*
|
||||
* - Default: `true`
|
||||
*/
|
||||
@@ -937,8 +917,8 @@ export interface SvelteConfig {
|
||||
indentScriptAndStyle?: boolean;
|
||||
/**
|
||||
* The order in which Svelte component sections are printed.
|
||||
* Format: join the keywords `options`, `scripts`, `markup`, `styles` with a `-` in the order you want;
|
||||
* or `none` if you don't want to reorder anything.
|
||||
* Join `options`, `scripts`, `markup`, `styles` with `-` in the desired order,
|
||||
* or use `none` to keep the original order.
|
||||
*
|
||||
* - Default: `"options-scripts-markup-styles"`
|
||||
*/
|
||||
|
||||
+87
-101
@@ -8,7 +8,7 @@ use oxc_config::GlobSet;
|
||||
|
||||
use crate::core::utils;
|
||||
|
||||
/// Configuration options for the Oxfmt.
|
||||
/// Configuration options for Oxfmt.
|
||||
///
|
||||
/// Most options are the same as Prettier's options, but not all of them.
|
||||
/// In addition, some options are our own extensions.
|
||||
@@ -137,8 +137,8 @@ pub struct FormatConfig {
|
||||
/// - Default: `true`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub bracket_spacing: Option<bool>,
|
||||
/// 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).
|
||||
/// Put the `>` of a multi-line element at the end of the last line,
|
||||
/// instead of being alone on the next line (does not apply to self-closing elements).
|
||||
///
|
||||
/// - Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro
|
||||
/// - Default: `false`
|
||||
@@ -153,7 +153,7 @@ pub struct FormatConfig {
|
||||
/// - Default: `"preserve"`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub object_wrap: Option<ObjectWrapConfig>,
|
||||
/// Enforce single attribute per line in HTML, Vue, and JSX.
|
||||
/// Enforce single attribute per line.
|
||||
///
|
||||
/// - Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro
|
||||
/// - Default: `false`
|
||||
@@ -185,21 +185,23 @@ pub struct FormatConfig {
|
||||
/// - YAML-in-CSS/Markdown: front matter
|
||||
///
|
||||
/// With `"off"`, these parts are kept as-is.
|
||||
/// NOTE: Except for some languages:
|
||||
/// - Svelte: formatting fails with "off", this is a limitation of `prettier-plugin-svelte`
|
||||
/// - Astro: the frontmatter is still formatted, but by Prettier instead of Oxfmt
|
||||
/// (use `astro.skipFrontmatter` to keep it as-is)
|
||||
///
|
||||
/// - Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX (languages with embedded code)
|
||||
/// NOTE: Some languages behave differently.
|
||||
/// For Svelte, formatting fails with `"off"`, a limitation of `prettier-plugin-svelte`.
|
||||
/// For Astro, the frontmatter is still formatted, but by Prettier instead of Oxfmt (use `astro.skipFrontmatter` to keep it as-is).
|
||||
///
|
||||
/// - Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX
|
||||
/// - Default: `"auto"`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub embedded_language_formatting: Option<EmbeddedLanguageFormattingConfig>,
|
||||
|
||||
/// How to wrap prose.
|
||||
///
|
||||
/// 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".
|
||||
/// - `"always"`: Wrap prose to the print width
|
||||
/// - `"never"`: Put each prose block on a single line, relying on editor/viewer soft wrapping
|
||||
/// - `"preserve"`: Keep wrapping as-is
|
||||
///
|
||||
/// By default, wrapping is preserved, since some services use a linebreak-sensitive renderer (e.g. GitHub comments, BitBucket).
|
||||
///
|
||||
/// - Languages: Markdown, MDX, YAML
|
||||
/// - Default: `"preserve"`
|
||||
@@ -209,7 +211,7 @@ pub struct FormatConfig {
|
||||
// ============================================================================================
|
||||
// Prettier compatible options and only used by Prettier
|
||||
// ============================================================================================
|
||||
/// Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.
|
||||
/// Specify the global whitespace sensitivity.
|
||||
///
|
||||
/// - Languages: HTML, Angular, Vue, Handlebars, Svelte
|
||||
/// - Default: `"css"`
|
||||
@@ -235,10 +237,9 @@ pub struct FormatConfig {
|
||||
|
||||
/// Sort import statements.
|
||||
///
|
||||
/// Using the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
|
||||
/// For details, see each field's documentation.
|
||||
/// Uses a similar algorithm to [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
|
||||
///
|
||||
/// Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
/// Pass `true` or an object to enable, `false` to disable.
|
||||
///
|
||||
/// - Languages: JS, JSX, TS, TSX
|
||||
/// - Default: Disabled
|
||||
@@ -248,9 +249,8 @@ pub struct FormatConfig {
|
||||
|
||||
/// Sort `package.json` keys.
|
||||
///
|
||||
/// The algorithm is NOT compatible with [prettier-plugin-sort-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson).
|
||||
/// But we believe it is clearer and easier to navigate.
|
||||
/// For details, see each field's documentation.
|
||||
/// The order is NOT compatible with [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson),
|
||||
/// but we believe it is clearer and easier to navigate.
|
||||
///
|
||||
/// - Languages: JSON (`package.json` only)
|
||||
/// - Default: `true`
|
||||
@@ -260,11 +260,10 @@ pub struct FormatConfig {
|
||||
|
||||
/// Sort Tailwind CSS classes.
|
||||
///
|
||||
/// Using the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/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.
|
||||
/// Uses the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).
|
||||
/// Option names omit the `tailwind` prefix used in the original plugin (e.g. `config` instead of `tailwindConfig`).
|
||||
///
|
||||
/// Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
/// Pass `true` or an object to enable, `false` to disable.
|
||||
///
|
||||
/// - Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro
|
||||
/// - Default: Disabled
|
||||
@@ -274,11 +273,10 @@ pub struct FormatConfig {
|
||||
|
||||
/// Enable JSDoc comment formatting.
|
||||
///
|
||||
/// When enabled, JSDoc comments are normalized and reformatted:
|
||||
/// tag aliases are canonicalized, descriptions are capitalized,
|
||||
/// Normalizes JSDoc comments: tag aliases are canonicalized, descriptions are capitalized,
|
||||
/// long lines are wrapped, and short comments are collapsed to single-line.
|
||||
///
|
||||
/// Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
/// Pass `true` or an object to enable, `false` to disable.
|
||||
///
|
||||
/// - Languages: JS, JSX, TS, TSX
|
||||
/// - Default: Disabled
|
||||
@@ -287,13 +285,11 @@ pub struct FormatConfig {
|
||||
|
||||
/// Options for `prettier-plugin-svelte`.
|
||||
///
|
||||
/// Pass `true` or an object to enable `.svelte` file formatting,
|
||||
/// or `false` (handy in overrides) / omit to disable.
|
||||
/// Setting `true` resets to defaults — any options inherited from a parent scope are dropped.
|
||||
/// Pass `true` or an object to enable `.svelte` file formatting, `false` to disable (handy in overrides).
|
||||
/// Setting `true` resets to defaults, dropping options inherited from a parent scope.
|
||||
///
|
||||
/// NOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime,
|
||||
/// but Oxfmt does NOT bundle or auto-install it.
|
||||
/// You must install `svelte` yourself in your project, formatting will fail at runtime otherwise.
|
||||
/// NOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime.
|
||||
/// Oxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.
|
||||
///
|
||||
/// - Languages: Svelte
|
||||
/// - Default: Disabled
|
||||
@@ -302,13 +298,11 @@ pub struct FormatConfig {
|
||||
|
||||
/// Options for `prettier-plugin-astro`.
|
||||
///
|
||||
/// Pass `true` or an object to enable `.astro` file formatting,
|
||||
/// or `false` (handy in overrides) / omit to disable.
|
||||
/// Setting `true` resets to defaults — any options inherited from a parent scope are dropped.
|
||||
/// Pass `true` or an object to enable `.astro` file formatting, `false` to disable (handy in overrides).
|
||||
/// Setting `true` resets to defaults, dropping options inherited from a parent scope.
|
||||
///
|
||||
/// NOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime,
|
||||
/// but Oxfmt does NOT bundle or auto-install it.
|
||||
/// You must install `@astrojs/compiler-rs` yourself in your project, formatting will fail at runtime otherwise.
|
||||
/// NOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime.
|
||||
/// Oxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.
|
||||
///
|
||||
/// - Languages: Astro
|
||||
/// - Default: Disabled
|
||||
@@ -494,10 +488,9 @@ impl SortImportsUserConfig {
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)]
|
||||
#[serde(rename_all = "camelCase", default)]
|
||||
pub struct SortImportsConfig {
|
||||
/// Enables the empty line to separate imports into logical groups.
|
||||
/// Use empty lines to separate imports into logical groups.
|
||||
///
|
||||
/// 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.
|
||||
/// When `true`, imports are not sorted across an empty line.
|
||||
///
|
||||
/// ```js
|
||||
/// import { b1, b2 } from 'b'
|
||||
@@ -509,9 +502,9 @@ pub struct SortImportsConfig {
|
||||
/// - Default: `false`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub partition_by_newline: Option<bool>,
|
||||
/// Enables the use of comments to separate imports into logical groups.
|
||||
/// Use comments to separate imports into logical groups.
|
||||
///
|
||||
/// When `true`, all comments will be treated as delimiters, creating partitions.
|
||||
/// When `true`, all comments are treated as delimiters.
|
||||
///
|
||||
/// ```js
|
||||
/// import { b1, b2 } from 'b'
|
||||
@@ -523,72 +516,67 @@ pub struct SortImportsConfig {
|
||||
/// - Default: `false`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub partition_by_comment: Option<bool>,
|
||||
/// Specifies whether side effect imports should be sorted.
|
||||
/// Sort side effect imports.
|
||||
///
|
||||
/// By default, sorting side-effect imports is disabled for security reasons.
|
||||
/// Disabled by default for safety reasons.
|
||||
///
|
||||
/// - Default: `false`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sort_side_effects: Option<bool>,
|
||||
/// Specifies whether to sort items in ascending or descending order.
|
||||
/// Sort in ascending or descending order.
|
||||
///
|
||||
/// - Default: `"asc"`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub order: Option<SortOrderConfig>,
|
||||
/// Specifies whether sorting should be case-sensitive.
|
||||
/// Ignore case when sorting.
|
||||
///
|
||||
/// - Default: `true`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub ignore_case: Option<bool>,
|
||||
/// Specifies whether to add newlines between groups.
|
||||
///
|
||||
/// When `false`, no newlines are added between groups.
|
||||
/// Add newlines between groups.
|
||||
///
|
||||
/// - Default: `true`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub newlines_between: Option<bool>,
|
||||
/// Specifies a prefix for identifying internal imports.
|
||||
///
|
||||
/// This is useful for distinguishing your own modules from external dependencies.
|
||||
/// Prefixes for identifying internal imports.
|
||||
///
|
||||
/// - Default: `["~/", "@/", "#"]`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub internal_pattern: Option<Vec<String>>,
|
||||
/// Specifies a list of predefined import groups for sorting.
|
||||
/// List of import groups for sorting.
|
||||
///
|
||||
/// 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.
|
||||
/// Each import is assigned to a single group (or `unknown` if none matches), and groups are ordered as listed.
|
||||
/// Within a group, imports are sorted according to `order`, `ignoreCase`, etc.
|
||||
///
|
||||
/// Within a given group, members will be sorted according to the type, order, ignoreCase, etc. options.
|
||||
/// A predefined group name is a single selector with optional modifiers, joined by `-` (e.g. `type-external`).
|
||||
/// Modifiers can be in any order, but the selector must come last.
|
||||
///
|
||||
/// 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.
|
||||
/// Selectors, from most to least important:
|
||||
/// - `type`: TypeScript type imports.
|
||||
/// - `side_effect_style`: Side effect style imports.
|
||||
/// - `side_effect`: Side effect imports.
|
||||
/// - `style`: Style imports.
|
||||
/// - `index`: Main file from the current directory.
|
||||
/// - `sibling`: Modules from the same directory.
|
||||
/// - `parent`: Modules from the parent directory.
|
||||
/// - `subpath`: Node.js subpath imports.
|
||||
/// - `internal`: Your internal modules.
|
||||
/// - `builtin`: Node.js Built-in Modules.
|
||||
/// - `external`: External modules installed in the project.
|
||||
/// - `import`: Any import.
|
||||
///
|
||||
/// 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.
|
||||
/// Modifiers, from most to least important:
|
||||
/// - `side_effect`: Side effect imports.
|
||||
/// - `type`: TypeScript type imports.
|
||||
/// - `value`: Value imports.
|
||||
/// - `default`: Imports containing the default specifier.
|
||||
/// - `wildcard`: Imports containing the wildcard (`* as`) specifier.
|
||||
/// - `named`: Imports containing at least one named specifier.
|
||||
///
|
||||
/// The list of selectors is sorted from most to least important:
|
||||
/// - `type` — TypeScript type imports.
|
||||
/// - `side_effect_style` — Side effect style imports.
|
||||
/// - `side_effect` — Side effect imports.
|
||||
/// - `style` — Style imports.
|
||||
/// - `index` — Main file from the current directory.
|
||||
/// - `sibling` — Modules from the same directory.
|
||||
/// - `parent` — Modules from the parent directory.
|
||||
/// - `subpath` — Node.js subpath imports.
|
||||
/// - `internal` — Your internal modules.
|
||||
/// - `builtin` — Node.js Built-in Modules.
|
||||
/// - `external` — External modules installed in the project.
|
||||
/// - `import` — Any import.
|
||||
/// Wrap groups in an array to sort them together as a single group (order within the array does not matter).
|
||||
///
|
||||
/// The list of modifiers is sorted from most to least important:
|
||||
/// - `side_effect` — Side effect imports.
|
||||
/// - `type` — TypeScript type imports.
|
||||
/// - `value` — Value imports.
|
||||
/// - `default` — Imports containing the default specifier.
|
||||
/// - `wildcard` — Imports containing the wildcard (`* as`) specifier.
|
||||
/// - `named` — Imports containing at least one named specifier.
|
||||
/// To override `newlinesBetween` at a specific group boundary,
|
||||
/// put a `{ "newlinesBetween": boolean }` marker object at that position.
|
||||
///
|
||||
/// - Default: See below
|
||||
/// ```json
|
||||
@@ -601,21 +589,15 @@ pub struct SortImportsConfig {
|
||||
/// "unknown"
|
||||
/// ]
|
||||
/// ```
|
||||
///
|
||||
/// Also, you can override the global `newlinesBetween` setting for specific group boundaries
|
||||
/// by including a `{ "newlinesBetween": boolean }` marker object in the `groups` list at the desired position.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub groups: Option<Vec<SortGroupItemConfig>>,
|
||||
/// Define your own groups for matching very specific imports.
|
||||
///
|
||||
/// 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.
|
||||
/// The first matching definition is used, and custom groups take precedence over predefined groups.
|
||||
/// To give a predefined group precedence, define an equivalent custom group and put it first.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// If you specify multiple conditions like `elementNamePattern`, `selector`, and `modifiers`,
|
||||
/// all conditions must be met for an import to match the custom group (AND logic).
|
||||
/// When multiple conditions (`elementNamePattern`, `selector`, `modifiers`) are specified,
|
||||
/// all of them must match.
|
||||
///
|
||||
/// NOTE: Predefined group names (e.g. `side_effect`, `external`) and `unknown` are reserved and cannot be used as `groupName`.
|
||||
///
|
||||
@@ -701,7 +683,7 @@ pub struct CustomGroupItemConfig {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub selector: Option<ImportSelectorConfig>,
|
||||
/// Modifiers to match the import characteristics.
|
||||
/// All specified modifiers must be present (AND logic).
|
||||
/// All specified modifiers must match.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub modifiers: Option<Vec<ImportModifierConfig>>,
|
||||
}
|
||||
@@ -881,17 +863,21 @@ pub struct JsdocConfig {
|
||||
pub prefer_code_fences: Option<bool>,
|
||||
/// Strategy for wrapping description lines at print width.
|
||||
///
|
||||
/// - `"greedy"` — Always re-wrap text to fit within print width.
|
||||
/// - `"balance"` — Preserve original line breaks if all lines fit within print width.
|
||||
/// - `"greedy"`: Always re-wrap text to fit within print width
|
||||
/// - `"balance"`: Preserve original line breaks if all lines fit within print width
|
||||
///
|
||||
/// By default, description lines are always re-wrapped.
|
||||
///
|
||||
/// - Default: `"greedy"`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub line_wrapping_style: Option<LineWrappingStyleConfig>,
|
||||
/// How to format comment blocks.
|
||||
///
|
||||
/// - `"singleLine"` — Convert to single-line `/** content */` when possible.
|
||||
/// - `"multiline"` — Always use multi-line format.
|
||||
/// - `"keep"` — Preserve original formatting.
|
||||
/// - `"singleLine"`: Convert to single-line `/** content */` when possible
|
||||
/// - `"multiline"`: Always use multi-line format
|
||||
/// - `"keep"`: Preserve original formatting
|
||||
///
|
||||
/// By default, comments are collapsed to a single line when possible.
|
||||
///
|
||||
/// - Default: `"singleLine"`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@@ -961,13 +947,13 @@ impl SvelteUserConfig {
|
||||
#[serde(rename_all = "camelCase", default)]
|
||||
pub struct SvelteConfig {
|
||||
/// The order in which Svelte component sections are printed.
|
||||
/// Format: join the keywords `options`, `scripts`, `markup`, `styles` with a `-` in the order you want;
|
||||
/// or `none` if you don't want to reorder anything.
|
||||
/// Join `options`, `scripts`, `markup`, `styles` with `-` in the desired order,
|
||||
/// or use `none` to keep the original order.
|
||||
///
|
||||
/// - Default: `"options-scripts-markup-styles"`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sort_order: Option<String>,
|
||||
/// Whether to allow attribute shorthand if attribute name and expression are same.
|
||||
/// Whether to allow attribute shorthand if attribute name and expression are the same.
|
||||
///
|
||||
/// - Default: `true`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Oxfmtrc",
|
||||
"description": "Configuration options for the Oxfmt.\n\nMost options are the same as Prettier's options, but not all of them.\nIn addition, some options are our own extensions.",
|
||||
"description": "Configuration options for Oxfmt.\n\nMost options are the same as Prettier's options, but not all of them.\nIn addition, some options are our own extensions.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arrowParens": {
|
||||
@@ -14,18 +14,18 @@
|
||||
"markdownDescription": "Include parentheses around a sole arrow function parameter.\n\n- Languages: JS, JSX, TS, TSX\n- Default: `\"always\"`"
|
||||
},
|
||||
"astro": {
|
||||
"description": "Options for `prettier-plugin-astro`.\n\nPass `true` or an object to enable `.astro` file formatting,\nor `false` (handy in overrides) / omit to disable.\nSetting `true` resets to defaults — any options inherited from a parent scope are dropped.\n\nNOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime,\nbut Oxfmt does NOT bundle or auto-install it.\nYou must install `@astrojs/compiler-rs` yourself in your project, formatting will fail at runtime otherwise.\n\n- Languages: Astro\n- Default: Disabled",
|
||||
"description": "Options for `prettier-plugin-astro`.\n\nPass `true` or an object to enable `.astro` file formatting, `false` to disable (handy in overrides).\nSetting `true` resets to defaults, dropping options inherited from a parent scope.\n\nNOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime.\nOxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.\n\n- Languages: Astro\n- Default: Disabled",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/AstroUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Options for `prettier-plugin-astro`.\n\nPass `true` or an object to enable `.astro` file formatting,\nor `false` (handy in overrides) / omit to disable.\nSetting `true` resets to defaults — any options inherited from a parent scope are dropped.\n\nNOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime,\nbut Oxfmt does NOT bundle or auto-install it.\nYou must install `@astrojs/compiler-rs` yourself in your project, formatting will fail at runtime otherwise.\n\n- Languages: Astro\n- Default: Disabled"
|
||||
"markdownDescription": "Options for `prettier-plugin-astro`.\n\nPass `true` or an object to enable `.astro` file formatting, `false` to disable (handy in overrides).\nSetting `true` resets to defaults, dropping options inherited from a parent scope.\n\nNOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime.\nOxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.\n\n- Languages: Astro\n- Default: Disabled"
|
||||
},
|
||||
"bracketSameLine": {
|
||||
"description": "Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line,\ninstead of being alone on the next line (does not apply to self closing elements).\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`",
|
||||
"description": "Put the `>` of a multi-line element at the end of the last line,\ninstead of being alone on the next line (does not apply to self-closing elements).\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`",
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line,\ninstead of being alone on the next line (does not apply to self closing elements).\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`"
|
||||
"markdownDescription": "Put the `>` of a multi-line element at the end of the last line,\ninstead of being alone on the next line (does not apply to self-closing elements).\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`"
|
||||
},
|
||||
"bracketSpacing": {
|
||||
"description": "Print spaces between brackets in object literals.\n\n- Languages: JS, JSX, TS, TSX, JSON, JSONC, JSON5, GraphQL, YAML\n- Default: `true`",
|
||||
@@ -33,13 +33,13 @@
|
||||
"markdownDescription": "Print spaces between brackets in object literals.\n\n- Languages: JS, JSX, TS, TSX, JSON, JSONC, JSON5, GraphQL, YAML\n- Default: `true`"
|
||||
},
|
||||
"embeddedLanguageFormatting": {
|
||||
"description": "Control whether to format embedded parts in the file.\nFor example:\n- CSS-in-JS: template literal\n- JS-in-Vue: `<script>` block\n- JS-in-Markdown: code fence\n- YAML-in-CSS/Markdown: front matter\n\nWith `\"off\"`, these parts are kept as-is.\nNOTE: Except for some languages:\n- Svelte: formatting fails with \"off\", this is a limitation of `prettier-plugin-svelte`\n- Astro: the frontmatter is still formatted, but by Prettier instead of Oxfmt\n(use `astro.skipFrontmatter` to keep it as-is)\n\n- Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX (languages with embedded code)\n- Default: `\"auto\"`",
|
||||
"description": "Control whether to format embedded parts in the file.\nFor example:\n- CSS-in-JS: template literal\n- JS-in-Vue: `<script>` block\n- JS-in-Markdown: code fence\n- YAML-in-CSS/Markdown: front matter\n\nWith `\"off\"`, these parts are kept as-is.\n\nNOTE: Some languages behave differently.\nFor Svelte, formatting fails with `\"off\"`, a limitation of `prettier-plugin-svelte`.\nFor Astro, the frontmatter is still formatted, but by Prettier instead of Oxfmt (use `astro.skipFrontmatter` to keep it as-is).\n\n- Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX\n- Default: `\"auto\"`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/EmbeddedLanguageFormattingConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Control whether to format embedded parts in the file.\nFor example:\n- CSS-in-JS: template literal\n- JS-in-Vue: `<script>` block\n- JS-in-Markdown: code fence\n- YAML-in-CSS/Markdown: front matter\n\nWith `\"off\"`, these parts are kept as-is.\nNOTE: Except for some languages:\n- Svelte: formatting fails with \"off\", this is a limitation of `prettier-plugin-svelte`\n- Astro: the frontmatter is still formatted, but by Prettier instead of Oxfmt\n(use `astro.skipFrontmatter` to keep it as-is)\n\n- Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX (languages with embedded code)\n- Default: `\"auto\"`"
|
||||
"markdownDescription": "Control whether to format embedded parts in the file.\nFor example:\n- CSS-in-JS: template literal\n- JS-in-Vue: `<script>` block\n- JS-in-Markdown: code fence\n- YAML-in-CSS/Markdown: front matter\n\nWith `\"off\"`, these parts are kept as-is.\n\nNOTE: Some languages behave differently.\nFor Svelte, formatting fails with `\"off\"`, a limitation of `prettier-plugin-svelte`.\nFor Astro, the frontmatter is still formatted, but by Prettier instead of Oxfmt (use `astro.skipFrontmatter` to keep it as-is).\n\n- Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX\n- Default: `\"auto\"`"
|
||||
},
|
||||
"endOfLine": {
|
||||
"description": "Which end of line characters to apply.\n\nNOTE: `\"auto\"` is not supported.\n\n- Languages: All\n- Default: `\"lf\"`\n- Overrides `.editorconfig.end_of_line`",
|
||||
@@ -60,13 +60,13 @@
|
||||
"markdownDescription": "When expressions wrap lines, print operators at the start of new lines (`\"start\"`)\nor at the end of previous lines (`\"end\"`).\n\n- Languages: JS, JSX, TS, TSX\n- Default: `\"end\"`"
|
||||
},
|
||||
"htmlWhitespaceSensitivity": {
|
||||
"description": "Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.\n\n- Languages: HTML, Angular, Vue, Handlebars, Svelte\n- Default: `\"css\"`",
|
||||
"description": "Specify the global whitespace sensitivity.\n\n- Languages: HTML, Angular, Vue, Handlebars, Svelte\n- Default: `\"css\"`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/HtmlWhitespaceSensitivityConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.\n\n- Languages: HTML, Angular, Vue, Handlebars, Svelte\n- Default: `\"css\"`"
|
||||
"markdownDescription": "Specify the global whitespace sensitivity.\n\n- Languages: HTML, Angular, Vue, Handlebars, Svelte\n- Default: `\"css\"`"
|
||||
},
|
||||
"ignorePatterns": {
|
||||
"description": "Ignore files matching these glob patterns.\nPatterns use gitignore-style matching, rooted at the directory containing the configuration file.\nFiles outside that directory cannot be matched; patterns containing `..` are rejected as a configuration error.\n\n- Default: `[]`",
|
||||
@@ -82,13 +82,13 @@
|
||||
"markdownDescription": "Whether to insert a final newline at the end of the file.\n\n- Languages: All\n- Default: `true`\n- Overrides `.editorconfig.insert_final_newline`"
|
||||
},
|
||||
"jsdoc": {
|
||||
"description": "Enable JSDoc comment formatting.\n\nWhen enabled, JSDoc comments are normalized and reformatted:\ntag aliases are canonicalized, descriptions are capitalized,\nlong lines are wrapped, and short comments are collapsed to single-line.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled",
|
||||
"description": "Enable JSDoc comment formatting.\n\nNormalizes JSDoc comments: tag aliases are canonicalized, descriptions are capitalized,\nlong lines are wrapped, and short comments are collapsed to single-line.\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/JsdocUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Enable JSDoc comment formatting.\n\nWhen enabled, JSDoc comments are normalized and reformatted:\ntag aliases are canonicalized, descriptions are capitalized,\nlong lines are wrapped, and short comments are collapsed to single-line.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled"
|
||||
"markdownDescription": "Enable JSDoc comment formatting.\n\nNormalizes JSDoc comments: tag aliases are canonicalized, descriptions are capitalized,\nlong lines are wrapped, and short comments are collapsed to single-line.\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled"
|
||||
},
|
||||
"jsxSingleQuote": {
|
||||
"description": "Use single quotes instead of double quotes in JSX.\n\n- Languages: JSX, TSX\n- Default: `false`",
|
||||
@@ -120,13 +120,13 @@
|
||||
"markdownDescription": "Specify the line length that the printer will wrap on.\n\nIf you don't want line wrapping when formatting Markdown, you can set the `proseWrap` option to disable it.\n\n- Languages: All\n- Default: `100`\n- Overrides `.editorconfig.max_line_length`"
|
||||
},
|
||||
"proseWrap": {
|
||||
"description": "How to wrap prose.\n\nBy default, formatter will not change wrapping in markdown text since some services use a linebreak-sensitive renderer, e.g. GitHub comments and BitBucket.\nTo wrap prose to the print width, change this option to \"always\".\nIf 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\".\n\n- Languages: Markdown, MDX, YAML\n- Default: `\"preserve\"`",
|
||||
"description": "How to wrap prose.\n\n- `\"always\"`: Wrap prose to the print width\n- `\"never\"`: Put each prose block on a single line, relying on editor/viewer soft wrapping\n- `\"preserve\"`: Keep wrapping as-is\n\nBy default, wrapping is preserved, since some services use a linebreak-sensitive renderer (e.g. GitHub comments, BitBucket).\n\n- Languages: Markdown, MDX, YAML\n- Default: `\"preserve\"`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ProseWrapConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "How to wrap prose.\n\nBy default, formatter will not change wrapping in markdown text since some services use a linebreak-sensitive renderer, e.g. GitHub comments and BitBucket.\nTo wrap prose to the print width, change this option to \"always\".\nIf 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\".\n\n- Languages: Markdown, MDX, YAML\n- Default: `\"preserve\"`"
|
||||
"markdownDescription": "How to wrap prose.\n\n- `\"always\"`: Wrap prose to the print width\n- `\"never\"`: Put each prose block on a single line, relying on editor/viewer soft wrapping\n- `\"preserve\"`: Keep wrapping as-is\n\nBy default, wrapping is preserved, since some services use a linebreak-sensitive renderer (e.g. GitHub comments, BitBucket).\n\n- Languages: Markdown, MDX, YAML\n- Default: `\"preserve\"`"
|
||||
},
|
||||
"quoteProps": {
|
||||
"description": "Change when properties in objects are quoted.\n\n- Languages: JS, JSX, TS, TSX\n- Default: `\"as-needed\"`",
|
||||
@@ -143,9 +143,9 @@
|
||||
"markdownDescription": "Print semicolons at the ends of statements.\n\n- Languages: JS, JSX, TS, TSX\n- Default: `true`"
|
||||
},
|
||||
"singleAttributePerLine": {
|
||||
"description": "Enforce single attribute per line in HTML, Vue, and JSX.\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`",
|
||||
"description": "Enforce single attribute per line.\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`",
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Enforce single attribute per line in HTML, Vue, and JSX.\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`"
|
||||
"markdownDescription": "Enforce single attribute per line.\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`"
|
||||
},
|
||||
"singleQuote": {
|
||||
"description": "Use single quotes instead of double quotes.\n\nFor JSX, you can set the `jsxSingleQuote` option.\n\n- Languages: JS, JSX, TS, TSX, CSS, Less, SCSS, Markdown, MDX, YAML, Handlebars, Svelte, Astro\n- Default: `false`\n- Overrides `.editorconfig.quote_type`",
|
||||
@@ -153,40 +153,40 @@
|
||||
"markdownDescription": "Use single quotes instead of double quotes.\n\nFor JSX, you can set the `jsxSingleQuote` option.\n\n- Languages: JS, JSX, TS, TSX, CSS, Less, SCSS, Markdown, MDX, YAML, Handlebars, Svelte, Astro\n- Default: `false`\n- Overrides `.editorconfig.quote_type`"
|
||||
},
|
||||
"sortImports": {
|
||||
"description": "Sort import statements.\n\nUsing the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).\nFor details, see each field's documentation.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled",
|
||||
"description": "Sort import statements.\n\nUses a similar algorithm to [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SortImportsUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Sort import statements.\n\nUsing the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).\nFor details, see each field's documentation.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled"
|
||||
"markdownDescription": "Sort import statements.\n\nUses a similar algorithm to [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled"
|
||||
},
|
||||
"sortPackageJson": {
|
||||
"description": "Sort `package.json` keys.\n\nThe algorithm is NOT compatible with [prettier-plugin-sort-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson).\nBut we believe it is clearer and easier to navigate.\nFor details, see each field's documentation.\n\n- Languages: JSON (`package.json` only)\n- Default: `true`",
|
||||
"description": "Sort `package.json` keys.\n\nThe order is NOT compatible with [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson),\nbut we believe it is clearer and easier to navigate.\n\n- Languages: JSON (`package.json` only)\n- Default: `true`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SortPackageJsonUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Sort `package.json` keys.\n\nThe algorithm is NOT compatible with [prettier-plugin-sort-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson).\nBut we believe it is clearer and easier to navigate.\nFor details, see each field's documentation.\n\n- Languages: JSON (`package.json` only)\n- Default: `true`"
|
||||
"markdownDescription": "Sort `package.json` keys.\n\nThe order is NOT compatible with [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson),\nbut we believe it is clearer and easier to navigate.\n\n- Languages: JSON (`package.json` only)\n- Default: `true`"
|
||||
},
|
||||
"sortTailwindcss": {
|
||||
"description": "Sort Tailwind CSS classes.\n\nUsing the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\nOption names omit the `tailwind` prefix used in the original plugin (e.g., `config` instead of `tailwindConfig`).\nFor details, see each field's documentation.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro\n- Default: Disabled",
|
||||
"description": "Sort Tailwind CSS classes.\n\nUses the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\nOption names omit the `tailwind` prefix used in the original plugin (e.g. `config` instead of `tailwindConfig`).\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro\n- Default: Disabled",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SortTailwindcssUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Sort Tailwind CSS classes.\n\nUsing the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\nOption names omit the `tailwind` prefix used in the original plugin (e.g., `config` instead of `tailwindConfig`).\nFor details, see each field's documentation.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro\n- Default: Disabled"
|
||||
"markdownDescription": "Sort Tailwind CSS classes.\n\nUses the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\nOption names omit the `tailwind` prefix used in the original plugin (e.g. `config` instead of `tailwindConfig`).\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro\n- Default: Disabled"
|
||||
},
|
||||
"svelte": {
|
||||
"description": "Options for `prettier-plugin-svelte`.\n\nPass `true` or an object to enable `.svelte` file formatting,\nor `false` (handy in overrides) / omit to disable.\nSetting `true` resets to defaults — any options inherited from a parent scope are dropped.\n\nNOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime,\nbut Oxfmt does NOT bundle or auto-install it.\nYou must install `svelte` yourself in your project, formatting will fail at runtime otherwise.\n\n- Languages: Svelte\n- Default: Disabled",
|
||||
"description": "Options for `prettier-plugin-svelte`.\n\nPass `true` or an object to enable `.svelte` file formatting, `false` to disable (handy in overrides).\nSetting `true` resets to defaults, dropping options inherited from a parent scope.\n\nNOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime.\nOxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.\n\n- Languages: Svelte\n- Default: Disabled",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SvelteUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Options for `prettier-plugin-svelte`.\n\nPass `true` or an object to enable `.svelte` file formatting,\nor `false` (handy in overrides) / omit to disable.\nSetting `true` resets to defaults — any options inherited from a parent scope are dropped.\n\nNOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime,\nbut Oxfmt does NOT bundle or auto-install it.\nYou must install `svelte` yourself in your project, formatting will fail at runtime otherwise.\n\n- Languages: Svelte\n- Default: Disabled"
|
||||
"markdownDescription": "Options for `prettier-plugin-svelte`.\n\nPass `true` or an object to enable `.svelte` file formatting, `false` to disable (handy in overrides).\nSetting `true` resets to defaults, dropping options inherited from a parent scope.\n\nNOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime.\nOxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.\n\n- Languages: Svelte\n- Default: Disabled"
|
||||
},
|
||||
"tabWidth": {
|
||||
"description": "Specify the number of spaces per indentation-level.\n\n- Languages: All\n- Default: `2`\n- Overrides `.editorconfig.indent_size` (falls back to `.editorconfig.tab_width`)",
|
||||
@@ -314,12 +314,12 @@
|
||||
"markdownDescription": "Name of the custom group, used in the `groups` option."
|
||||
},
|
||||
"modifiers": {
|
||||
"description": "Modifiers to match the import characteristics.\nAll specified modifiers must be present (AND logic).",
|
||||
"description": "Modifiers to match the import characteristics.\nAll specified modifiers must match.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ImportModifierConfig"
|
||||
},
|
||||
"markdownDescription": "Modifiers to match the import characteristics.\nAll specified modifiers must be present (AND logic)."
|
||||
"markdownDescription": "Modifiers to match the import characteristics.\nAll specified modifiers must match."
|
||||
},
|
||||
"selector": {
|
||||
"description": "Selector to match the import kind.",
|
||||
@@ -360,18 +360,18 @@
|
||||
"markdownDescription": "Include parentheses around a sole arrow function parameter.\n\n- Languages: JS, JSX, TS, TSX\n- Default: `\"always\"`"
|
||||
},
|
||||
"astro": {
|
||||
"description": "Options for `prettier-plugin-astro`.\n\nPass `true` or an object to enable `.astro` file formatting,\nor `false` (handy in overrides) / omit to disable.\nSetting `true` resets to defaults — any options inherited from a parent scope are dropped.\n\nNOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime,\nbut Oxfmt does NOT bundle or auto-install it.\nYou must install `@astrojs/compiler-rs` yourself in your project, formatting will fail at runtime otherwise.\n\n- Languages: Astro\n- Default: Disabled",
|
||||
"description": "Options for `prettier-plugin-astro`.\n\nPass `true` or an object to enable `.astro` file formatting, `false` to disable (handy in overrides).\nSetting `true` resets to defaults, dropping options inherited from a parent scope.\n\nNOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime.\nOxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.\n\n- Languages: Astro\n- Default: Disabled",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/AstroUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Options for `prettier-plugin-astro`.\n\nPass `true` or an object to enable `.astro` file formatting,\nor `false` (handy in overrides) / omit to disable.\nSetting `true` resets to defaults — any options inherited from a parent scope are dropped.\n\nNOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime,\nbut Oxfmt does NOT bundle or auto-install it.\nYou must install `@astrojs/compiler-rs` yourself in your project, formatting will fail at runtime otherwise.\n\n- Languages: Astro\n- Default: Disabled"
|
||||
"markdownDescription": "Options for `prettier-plugin-astro`.\n\nPass `true` or an object to enable `.astro` file formatting, `false` to disable (handy in overrides).\nSetting `true` resets to defaults, dropping options inherited from a parent scope.\n\nNOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime.\nOxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.\n\n- Languages: Astro\n- Default: Disabled"
|
||||
},
|
||||
"bracketSameLine": {
|
||||
"description": "Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line,\ninstead of being alone on the next line (does not apply to self closing elements).\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`",
|
||||
"description": "Put the `>` of a multi-line element at the end of the last line,\ninstead of being alone on the next line (does not apply to self-closing elements).\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`",
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line,\ninstead of being alone on the next line (does not apply to self closing elements).\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`"
|
||||
"markdownDescription": "Put the `>` of a multi-line element at the end of the last line,\ninstead of being alone on the next line (does not apply to self-closing elements).\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`"
|
||||
},
|
||||
"bracketSpacing": {
|
||||
"description": "Print spaces between brackets in object literals.\n\n- Languages: JS, JSX, TS, TSX, JSON, JSONC, JSON5, GraphQL, YAML\n- Default: `true`",
|
||||
@@ -379,13 +379,13 @@
|
||||
"markdownDescription": "Print spaces between brackets in object literals.\n\n- Languages: JS, JSX, TS, TSX, JSON, JSONC, JSON5, GraphQL, YAML\n- Default: `true`"
|
||||
},
|
||||
"embeddedLanguageFormatting": {
|
||||
"description": "Control whether to format embedded parts in the file.\nFor example:\n- CSS-in-JS: template literal\n- JS-in-Vue: `<script>` block\n- JS-in-Markdown: code fence\n- YAML-in-CSS/Markdown: front matter\n\nWith `\"off\"`, these parts are kept as-is.\nNOTE: Except for some languages:\n- Svelte: formatting fails with \"off\", this is a limitation of `prettier-plugin-svelte`\n- Astro: the frontmatter is still formatted, but by Prettier instead of Oxfmt\n(use `astro.skipFrontmatter` to keep it as-is)\n\n- Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX (languages with embedded code)\n- Default: `\"auto\"`",
|
||||
"description": "Control whether to format embedded parts in the file.\nFor example:\n- CSS-in-JS: template literal\n- JS-in-Vue: `<script>` block\n- JS-in-Markdown: code fence\n- YAML-in-CSS/Markdown: front matter\n\nWith `\"off\"`, these parts are kept as-is.\n\nNOTE: Some languages behave differently.\nFor Svelte, formatting fails with `\"off\"`, a limitation of `prettier-plugin-svelte`.\nFor Astro, the frontmatter is still formatted, but by Prettier instead of Oxfmt (use `astro.skipFrontmatter` to keep it as-is).\n\n- Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX\n- Default: `\"auto\"`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/EmbeddedLanguageFormattingConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Control whether to format embedded parts in the file.\nFor example:\n- CSS-in-JS: template literal\n- JS-in-Vue: `<script>` block\n- JS-in-Markdown: code fence\n- YAML-in-CSS/Markdown: front matter\n\nWith `\"off\"`, these parts are kept as-is.\nNOTE: Except for some languages:\n- Svelte: formatting fails with \"off\", this is a limitation of `prettier-plugin-svelte`\n- Astro: the frontmatter is still formatted, but by Prettier instead of Oxfmt\n(use `astro.skipFrontmatter` to keep it as-is)\n\n- Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX (languages with embedded code)\n- Default: `\"auto\"`"
|
||||
"markdownDescription": "Control whether to format embedded parts in the file.\nFor example:\n- CSS-in-JS: template literal\n- JS-in-Vue: `<script>` block\n- JS-in-Markdown: code fence\n- YAML-in-CSS/Markdown: front matter\n\nWith `\"off\"`, these parts are kept as-is.\n\nNOTE: Some languages behave differently.\nFor Svelte, formatting fails with `\"off\"`, a limitation of `prettier-plugin-svelte`.\nFor Astro, the frontmatter is still formatted, but by Prettier instead of Oxfmt (use `astro.skipFrontmatter` to keep it as-is).\n\n- Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX\n- Default: `\"auto\"`"
|
||||
},
|
||||
"endOfLine": {
|
||||
"description": "Which end of line characters to apply.\n\nNOTE: `\"auto\"` is not supported.\n\n- Languages: All\n- Default: `\"lf\"`\n- Overrides `.editorconfig.end_of_line`",
|
||||
@@ -406,13 +406,13 @@
|
||||
"markdownDescription": "When expressions wrap lines, print operators at the start of new lines (`\"start\"`)\nor at the end of previous lines (`\"end\"`).\n\n- Languages: JS, JSX, TS, TSX\n- Default: `\"end\"`"
|
||||
},
|
||||
"htmlWhitespaceSensitivity": {
|
||||
"description": "Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.\n\n- Languages: HTML, Angular, Vue, Handlebars, Svelte\n- Default: `\"css\"`",
|
||||
"description": "Specify the global whitespace sensitivity.\n\n- Languages: HTML, Angular, Vue, Handlebars, Svelte\n- Default: `\"css\"`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/HtmlWhitespaceSensitivityConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.\n\n- Languages: HTML, Angular, Vue, Handlebars, Svelte\n- Default: `\"css\"`"
|
||||
"markdownDescription": "Specify the global whitespace sensitivity.\n\n- Languages: HTML, Angular, Vue, Handlebars, Svelte\n- Default: `\"css\"`"
|
||||
},
|
||||
"insertFinalNewline": {
|
||||
"description": "Whether to insert a final newline at the end of the file.\n\n- Languages: All\n- Default: `true`\n- Overrides `.editorconfig.insert_final_newline`",
|
||||
@@ -420,13 +420,13 @@
|
||||
"markdownDescription": "Whether to insert a final newline at the end of the file.\n\n- Languages: All\n- Default: `true`\n- Overrides `.editorconfig.insert_final_newline`"
|
||||
},
|
||||
"jsdoc": {
|
||||
"description": "Enable JSDoc comment formatting.\n\nWhen enabled, JSDoc comments are normalized and reformatted:\ntag aliases are canonicalized, descriptions are capitalized,\nlong lines are wrapped, and short comments are collapsed to single-line.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled",
|
||||
"description": "Enable JSDoc comment formatting.\n\nNormalizes JSDoc comments: tag aliases are canonicalized, descriptions are capitalized,\nlong lines are wrapped, and short comments are collapsed to single-line.\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/JsdocUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Enable JSDoc comment formatting.\n\nWhen enabled, JSDoc comments are normalized and reformatted:\ntag aliases are canonicalized, descriptions are capitalized,\nlong lines are wrapped, and short comments are collapsed to single-line.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled"
|
||||
"markdownDescription": "Enable JSDoc comment formatting.\n\nNormalizes JSDoc comments: tag aliases are canonicalized, descriptions are capitalized,\nlong lines are wrapped, and short comments are collapsed to single-line.\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled"
|
||||
},
|
||||
"jsxSingleQuote": {
|
||||
"description": "Use single quotes instead of double quotes in JSX.\n\n- Languages: JSX, TSX\n- Default: `false`",
|
||||
@@ -450,13 +450,13 @@
|
||||
"markdownDescription": "Specify the line length that the printer will wrap on.\n\nIf you don't want line wrapping when formatting Markdown, you can set the `proseWrap` option to disable it.\n\n- Languages: All\n- Default: `100`\n- Overrides `.editorconfig.max_line_length`"
|
||||
},
|
||||
"proseWrap": {
|
||||
"description": "How to wrap prose.\n\nBy default, formatter will not change wrapping in markdown text since some services use a linebreak-sensitive renderer, e.g. GitHub comments and BitBucket.\nTo wrap prose to the print width, change this option to \"always\".\nIf 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\".\n\n- Languages: Markdown, MDX, YAML\n- Default: `\"preserve\"`",
|
||||
"description": "How to wrap prose.\n\n- `\"always\"`: Wrap prose to the print width\n- `\"never\"`: Put each prose block on a single line, relying on editor/viewer soft wrapping\n- `\"preserve\"`: Keep wrapping as-is\n\nBy default, wrapping is preserved, since some services use a linebreak-sensitive renderer (e.g. GitHub comments, BitBucket).\n\n- Languages: Markdown, MDX, YAML\n- Default: `\"preserve\"`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ProseWrapConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "How to wrap prose.\n\nBy default, formatter will not change wrapping in markdown text since some services use a linebreak-sensitive renderer, e.g. GitHub comments and BitBucket.\nTo wrap prose to the print width, change this option to \"always\".\nIf 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\".\n\n- Languages: Markdown, MDX, YAML\n- Default: `\"preserve\"`"
|
||||
"markdownDescription": "How to wrap prose.\n\n- `\"always\"`: Wrap prose to the print width\n- `\"never\"`: Put each prose block on a single line, relying on editor/viewer soft wrapping\n- `\"preserve\"`: Keep wrapping as-is\n\nBy default, wrapping is preserved, since some services use a linebreak-sensitive renderer (e.g. GitHub comments, BitBucket).\n\n- Languages: Markdown, MDX, YAML\n- Default: `\"preserve\"`"
|
||||
},
|
||||
"quoteProps": {
|
||||
"description": "Change when properties in objects are quoted.\n\n- Languages: JS, JSX, TS, TSX\n- Default: `\"as-needed\"`",
|
||||
@@ -473,9 +473,9 @@
|
||||
"markdownDescription": "Print semicolons at the ends of statements.\n\n- Languages: JS, JSX, TS, TSX\n- Default: `true`"
|
||||
},
|
||||
"singleAttributePerLine": {
|
||||
"description": "Enforce single attribute per line in HTML, Vue, and JSX.\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`",
|
||||
"description": "Enforce single attribute per line.\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`",
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Enforce single attribute per line in HTML, Vue, and JSX.\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`"
|
||||
"markdownDescription": "Enforce single attribute per line.\n\n- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro\n- Default: `false`"
|
||||
},
|
||||
"singleQuote": {
|
||||
"description": "Use single quotes instead of double quotes.\n\nFor JSX, you can set the `jsxSingleQuote` option.\n\n- Languages: JS, JSX, TS, TSX, CSS, Less, SCSS, Markdown, MDX, YAML, Handlebars, Svelte, Astro\n- Default: `false`\n- Overrides `.editorconfig.quote_type`",
|
||||
@@ -483,40 +483,40 @@
|
||||
"markdownDescription": "Use single quotes instead of double quotes.\n\nFor JSX, you can set the `jsxSingleQuote` option.\n\n- Languages: JS, JSX, TS, TSX, CSS, Less, SCSS, Markdown, MDX, YAML, Handlebars, Svelte, Astro\n- Default: `false`\n- Overrides `.editorconfig.quote_type`"
|
||||
},
|
||||
"sortImports": {
|
||||
"description": "Sort import statements.\n\nUsing the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).\nFor details, see each field's documentation.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled",
|
||||
"description": "Sort import statements.\n\nUses a similar algorithm to [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SortImportsUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Sort import statements.\n\nUsing the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).\nFor details, see each field's documentation.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled"
|
||||
"markdownDescription": "Sort import statements.\n\nUses a similar algorithm to [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX\n- Default: Disabled"
|
||||
},
|
||||
"sortPackageJson": {
|
||||
"description": "Sort `package.json` keys.\n\nThe algorithm is NOT compatible with [prettier-plugin-sort-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson).\nBut we believe it is clearer and easier to navigate.\nFor details, see each field's documentation.\n\n- Languages: JSON (`package.json` only)\n- Default: `true`",
|
||||
"description": "Sort `package.json` keys.\n\nThe order is NOT compatible with [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson),\nbut we believe it is clearer and easier to navigate.\n\n- Languages: JSON (`package.json` only)\n- Default: `true`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SortPackageJsonUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Sort `package.json` keys.\n\nThe algorithm is NOT compatible with [prettier-plugin-sort-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson).\nBut we believe it is clearer and easier to navigate.\nFor details, see each field's documentation.\n\n- Languages: JSON (`package.json` only)\n- Default: `true`"
|
||||
"markdownDescription": "Sort `package.json` keys.\n\nThe order is NOT compatible with [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson),\nbut we believe it is clearer and easier to navigate.\n\n- Languages: JSON (`package.json` only)\n- Default: `true`"
|
||||
},
|
||||
"sortTailwindcss": {
|
||||
"description": "Sort Tailwind CSS classes.\n\nUsing the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\nOption names omit the `tailwind` prefix used in the original plugin (e.g., `config` instead of `tailwindConfig`).\nFor details, see each field's documentation.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro\n- Default: Disabled",
|
||||
"description": "Sort Tailwind CSS classes.\n\nUses the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\nOption names omit the `tailwind` prefix used in the original plugin (e.g. `config` instead of `tailwindConfig`).\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro\n- Default: Disabled",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SortTailwindcssUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Sort Tailwind CSS classes.\n\nUsing the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\nOption names omit the `tailwind` prefix used in the original plugin (e.g., `config` instead of `tailwindConfig`).\nFor details, see each field's documentation.\n\nPass `true` or an object to enable with defaults, or omit/set `false` to disable.\n\n- Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro\n- Default: Disabled"
|
||||
"markdownDescription": "Sort Tailwind CSS classes.\n\nUses the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\nOption names omit the `tailwind` prefix used in the original plugin (e.g. `config` instead of `tailwindConfig`).\n\nPass `true` or an object to enable, `false` to disable.\n\n- Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro\n- Default: Disabled"
|
||||
},
|
||||
"svelte": {
|
||||
"description": "Options for `prettier-plugin-svelte`.\n\nPass `true` or an object to enable `.svelte` file formatting,\nor `false` (handy in overrides) / omit to disable.\nSetting `true` resets to defaults — any options inherited from a parent scope are dropped.\n\nNOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime,\nbut Oxfmt does NOT bundle or auto-install it.\nYou must install `svelte` yourself in your project, formatting will fail at runtime otherwise.\n\n- Languages: Svelte\n- Default: Disabled",
|
||||
"description": "Options for `prettier-plugin-svelte`.\n\nPass `true` or an object to enable `.svelte` file formatting, `false` to disable (handy in overrides).\nSetting `true` resets to defaults, dropping options inherited from a parent scope.\n\nNOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime.\nOxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.\n\n- Languages: Svelte\n- Default: Disabled",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SvelteUserConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Options for `prettier-plugin-svelte`.\n\nPass `true` or an object to enable `.svelte` file formatting,\nor `false` (handy in overrides) / omit to disable.\nSetting `true` resets to defaults — any options inherited from a parent scope are dropped.\n\nNOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime,\nbut Oxfmt does NOT bundle or auto-install it.\nYou must install `svelte` yourself in your project, formatting will fail at runtime otherwise.\n\n- Languages: Svelte\n- Default: Disabled"
|
||||
"markdownDescription": "Options for `prettier-plugin-svelte`.\n\nPass `true` or an object to enable `.svelte` file formatting, `false` to disable (handy in overrides).\nSetting `true` resets to defaults, dropping options inherited from a parent scope.\n\nNOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime.\nOxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.\n\n- Languages: Svelte\n- Default: Disabled"
|
||||
},
|
||||
"tabWidth": {
|
||||
"description": "Specify the number of spaces per indentation-level.\n\n- Languages: All\n- Default: `2`\n- Overrides `.editorconfig.indent_size` (falls back to `.editorconfig.tab_width`)",
|
||||
@@ -613,13 +613,13 @@
|
||||
"markdownDescription": "Capitalize the first letter of tag descriptions.\n\n- Default: `true`"
|
||||
},
|
||||
"commentLineStrategy": {
|
||||
"description": "How to format comment blocks.\n\n- `\"singleLine\"` — Convert to single-line `/** content */` when possible.\n- `\"multiline\"` — Always use multi-line format.\n- `\"keep\"` — Preserve original formatting.\n\n- Default: `\"singleLine\"`",
|
||||
"description": "How to format comment blocks.\n\n- `\"singleLine\"`: Convert to single-line `/** content */` when possible\n- `\"multiline\"`: Always use multi-line format\n- `\"keep\"`: Preserve original formatting\n\nBy default, comments are collapsed to a single line when possible.\n\n- Default: `\"singleLine\"`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/CommentLineStrategyConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "How to format comment blocks.\n\n- `\"singleLine\"` — Convert to single-line `/** content */` when possible.\n- `\"multiline\"` — Always use multi-line format.\n- `\"keep\"` — Preserve original formatting.\n\n- Default: `\"singleLine\"`"
|
||||
"markdownDescription": "How to format comment blocks.\n\n- `\"singleLine\"`: Convert to single-line `/** content */` when possible\n- `\"multiline\"`: Always use multi-line format\n- `\"keep\"`: Preserve original formatting\n\nBy default, comments are collapsed to a single line when possible.\n\n- Default: `\"singleLine\"`"
|
||||
},
|
||||
"descriptionTag": {
|
||||
"description": "Emit `@description` tag instead of inline description.\n\n- Default: `false`",
|
||||
@@ -637,13 +637,13 @@
|
||||
"markdownDescription": "Preserve indentation in unparsable `@example` code.\n\n- Default: `false`"
|
||||
},
|
||||
"lineWrappingStyle": {
|
||||
"description": "Strategy for wrapping description lines at print width.\n\n- `\"greedy\"` — Always re-wrap text to fit within print width.\n- `\"balance\"` — Preserve original line breaks if all lines fit within print width.\n\n- Default: `\"greedy\"`",
|
||||
"description": "Strategy for wrapping description lines at print width.\n\n- `\"greedy\"`: Always re-wrap text to fit within print width\n- `\"balance\"`: Preserve original line breaks if all lines fit within print width\n\nBy default, description lines are always re-wrapped.\n\n- Default: `\"greedy\"`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/LineWrappingStyleConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Strategy for wrapping description lines at print width.\n\n- `\"greedy\"` — Always re-wrap text to fit within print width.\n- `\"balance\"` — Preserve original line breaks if all lines fit within print width.\n\n- Default: `\"greedy\"`"
|
||||
"markdownDescription": "Strategy for wrapping description lines at print width.\n\n- `\"greedy\"`: Always re-wrap text to fit within print width\n- `\"balance\"`: Preserve original line breaks if all lines fit within print width\n\nBy default, description lines are always re-wrapped.\n\n- Default: `\"greedy\"`"
|
||||
},
|
||||
"preferCodeFences": {
|
||||
"description": "Use fenced code blocks (```` ``` ````) instead of 4-space indentation for code without a language tag.\n\n- Default: `false`",
|
||||
@@ -788,62 +788,62 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"customGroups": {
|
||||
"description": "Define your own groups for matching very specific imports.\n\nThe `customGroups` list is ordered: The first definition that matches an element will be used.\nCustom groups have a higher priority than any predefined group.\n\nIf you want a predefined group to take precedence over a custom group,\nyou must write a custom group definition that does the same as what the predefined group does, and put it first in the list.\n\nIf you specify multiple conditions like `elementNamePattern`, `selector`, and `modifiers`,\nall conditions must be met for an import to match the custom group (AND logic).\n\nNOTE: Predefined group names (e.g. `side_effect`, `external`) and `unknown` are reserved and cannot be used as `groupName`.\n\n- Default: `[]`",
|
||||
"description": "Define your own groups for matching very specific imports.\n\nThe first matching definition is used, and custom groups take precedence over predefined groups.\nTo give a predefined group precedence, define an equivalent custom group and put it first.\n\nWhen multiple conditions (`elementNamePattern`, `selector`, `modifiers`) are specified,\nall of them must match.\n\nNOTE: Predefined group names (e.g. `side_effect`, `external`) and `unknown` are reserved and cannot be used as `groupName`.\n\n- Default: `[]`",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/CustomGroupItemConfig"
|
||||
},
|
||||
"markdownDescription": "Define your own groups for matching very specific imports.\n\nThe `customGroups` list is ordered: The first definition that matches an element will be used.\nCustom groups have a higher priority than any predefined group.\n\nIf you want a predefined group to take precedence over a custom group,\nyou must write a custom group definition that does the same as what the predefined group does, and put it first in the list.\n\nIf you specify multiple conditions like `elementNamePattern`, `selector`, and `modifiers`,\nall conditions must be met for an import to match the custom group (AND logic).\n\nNOTE: Predefined group names (e.g. `side_effect`, `external`) and `unknown` are reserved and cannot be used as `groupName`.\n\n- Default: `[]`"
|
||||
"markdownDescription": "Define your own groups for matching very specific imports.\n\nThe first matching definition is used, and custom groups take precedence over predefined groups.\nTo give a predefined group precedence, define an equivalent custom group and put it first.\n\nWhen multiple conditions (`elementNamePattern`, `selector`, `modifiers`) are specified,\nall of them must match.\n\nNOTE: Predefined group names (e.g. `side_effect`, `external`) and `unknown` are reserved and cannot be used as `groupName`.\n\n- Default: `[]`"
|
||||
},
|
||||
"groups": {
|
||||
"description": "Specifies a list of predefined import groups for sorting.\n\nEach import will be assigned a single group specified in the groups option (or the `unknown` group if no match is found).\nThe order of items in the `groups` option determines how groups are ordered.\n\nWithin a given group, members will be sorted according to the type, order, ignoreCase, etc. options.\n\nIndividual groups can be combined together by placing them in an array.\nThe order of groups in that array does not matter.\nAll members of the groups in the array will be sorted together as if they were part of a single group.\n\nPredefined groups are characterized by a single selector and potentially multiple modifiers.\nYou may enter modifiers in any order, but the selector must always come at the end.\n\nThe list of selectors is sorted from most to least important:\n- `type` — TypeScript type imports.\n- `side_effect_style` — Side effect style imports.\n- `side_effect` — Side effect imports.\n- `style` — Style imports.\n- `index` — Main file from the current directory.\n- `sibling` — Modules from the same directory.\n- `parent` — Modules from the parent directory.\n- `subpath` — Node.js subpath imports.\n- `internal` — Your internal modules.\n- `builtin` — Node.js Built-in Modules.\n- `external` — External modules installed in the project.\n- `import` — Any import.\n\nThe list of modifiers is sorted from most to least important:\n- `side_effect` — Side effect imports.\n- `type` — TypeScript type imports.\n- `value` — Value imports.\n- `default` — Imports containing the default specifier.\n- `wildcard` — Imports containing the wildcard (`* as`) specifier.\n- `named` — Imports containing at least one named specifier.\n\n- Default: See below\n```json\n[\n\"builtin\",\n\"external\",\n[\"internal\", \"subpath\"],\n[\"parent\", \"sibling\", \"index\"],\n\"style\",\n\"unknown\"\n]\n```\n\nAlso, you can override the global `newlinesBetween` setting for specific group boundaries\nby including a `{ \"newlinesBetween\": boolean }` marker object in the `groups` list at the desired position.",
|
||||
"description": "List of import groups for sorting.\n\nEach import is assigned to a single group (or `unknown` if none matches), and groups are ordered as listed.\nWithin a group, imports are sorted according to `order`, `ignoreCase`, etc.\n\nA predefined group name is a single selector with optional modifiers, joined by `-` (e.g. `type-external`).\nModifiers can be in any order, but the selector must come last.\n\nSelectors, from most to least important:\n- `type`: TypeScript type imports.\n- `side_effect_style`: Side effect style imports.\n- `side_effect`: Side effect imports.\n- `style`: Style imports.\n- `index`: Main file from the current directory.\n- `sibling`: Modules from the same directory.\n- `parent`: Modules from the parent directory.\n- `subpath`: Node.js subpath imports.\n- `internal`: Your internal modules.\n- `builtin`: Node.js Built-in Modules.\n- `external`: External modules installed in the project.\n- `import`: Any import.\n\nModifiers, from most to least important:\n- `side_effect`: Side effect imports.\n- `type`: TypeScript type imports.\n- `value`: Value imports.\n- `default`: Imports containing the default specifier.\n- `wildcard`: Imports containing the wildcard (`* as`) specifier.\n- `named`: Imports containing at least one named specifier.\n\nWrap groups in an array to sort them together as a single group (order within the array does not matter).\n\nTo override `newlinesBetween` at a specific group boundary,\nput a `{ \"newlinesBetween\": boolean }` marker object at that position.\n\n- Default: See below\n```json\n[\n\"builtin\",\n\"external\",\n[\"internal\", \"subpath\"],\n[\"parent\", \"sibling\", \"index\"],\n\"style\",\n\"unknown\"\n]\n```",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/SortGroupItemConfig"
|
||||
},
|
||||
"markdownDescription": "Specifies a list of predefined import groups for sorting.\n\nEach import will be assigned a single group specified in the groups option (or the `unknown` group if no match is found).\nThe order of items in the `groups` option determines how groups are ordered.\n\nWithin a given group, members will be sorted according to the type, order, ignoreCase, etc. options.\n\nIndividual groups can be combined together by placing them in an array.\nThe order of groups in that array does not matter.\nAll members of the groups in the array will be sorted together as if they were part of a single group.\n\nPredefined groups are characterized by a single selector and potentially multiple modifiers.\nYou may enter modifiers in any order, but the selector must always come at the end.\n\nThe list of selectors is sorted from most to least important:\n- `type` — TypeScript type imports.\n- `side_effect_style` — Side effect style imports.\n- `side_effect` — Side effect imports.\n- `style` — Style imports.\n- `index` — Main file from the current directory.\n- `sibling` — Modules from the same directory.\n- `parent` — Modules from the parent directory.\n- `subpath` — Node.js subpath imports.\n- `internal` — Your internal modules.\n- `builtin` — Node.js Built-in Modules.\n- `external` — External modules installed in the project.\n- `import` — Any import.\n\nThe list of modifiers is sorted from most to least important:\n- `side_effect` — Side effect imports.\n- `type` — TypeScript type imports.\n- `value` — Value imports.\n- `default` — Imports containing the default specifier.\n- `wildcard` — Imports containing the wildcard (`* as`) specifier.\n- `named` — Imports containing at least one named specifier.\n\n- Default: See below\n```json\n[\n\"builtin\",\n\"external\",\n[\"internal\", \"subpath\"],\n[\"parent\", \"sibling\", \"index\"],\n\"style\",\n\"unknown\"\n]\n```\n\nAlso, you can override the global `newlinesBetween` setting for specific group boundaries\nby including a `{ \"newlinesBetween\": boolean }` marker object in the `groups` list at the desired position."
|
||||
"markdownDescription": "List of import groups for sorting.\n\nEach import is assigned to a single group (or `unknown` if none matches), and groups are ordered as listed.\nWithin a group, imports are sorted according to `order`, `ignoreCase`, etc.\n\nA predefined group name is a single selector with optional modifiers, joined by `-` (e.g. `type-external`).\nModifiers can be in any order, but the selector must come last.\n\nSelectors, from most to least important:\n- `type`: TypeScript type imports.\n- `side_effect_style`: Side effect style imports.\n- `side_effect`: Side effect imports.\n- `style`: Style imports.\n- `index`: Main file from the current directory.\n- `sibling`: Modules from the same directory.\n- `parent`: Modules from the parent directory.\n- `subpath`: Node.js subpath imports.\n- `internal`: Your internal modules.\n- `builtin`: Node.js Built-in Modules.\n- `external`: External modules installed in the project.\n- `import`: Any import.\n\nModifiers, from most to least important:\n- `side_effect`: Side effect imports.\n- `type`: TypeScript type imports.\n- `value`: Value imports.\n- `default`: Imports containing the default specifier.\n- `wildcard`: Imports containing the wildcard (`* as`) specifier.\n- `named`: Imports containing at least one named specifier.\n\nWrap groups in an array to sort them together as a single group (order within the array does not matter).\n\nTo override `newlinesBetween` at a specific group boundary,\nput a `{ \"newlinesBetween\": boolean }` marker object at that position.\n\n- Default: See below\n```json\n[\n\"builtin\",\n\"external\",\n[\"internal\", \"subpath\"],\n[\"parent\", \"sibling\", \"index\"],\n\"style\",\n\"unknown\"\n]\n```"
|
||||
},
|
||||
"ignoreCase": {
|
||||
"description": "Specifies whether sorting should be case-sensitive.\n\n- Default: `true`",
|
||||
"description": "Ignore case when sorting.\n\n- Default: `true`",
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Specifies whether sorting should be case-sensitive.\n\n- Default: `true`"
|
||||
"markdownDescription": "Ignore case when sorting.\n\n- Default: `true`"
|
||||
},
|
||||
"internalPattern": {
|
||||
"description": "Specifies a prefix for identifying internal imports.\n\nThis is useful for distinguishing your own modules from external dependencies.\n\n- Default: `[\"~/\", \"@/\", \"#\"]`",
|
||||
"description": "Prefixes for identifying internal imports.\n\n- Default: `[\"~/\", \"@/\", \"#\"]`",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"markdownDescription": "Specifies a prefix for identifying internal imports.\n\nThis is useful for distinguishing your own modules from external dependencies.\n\n- Default: `[\"~/\", \"@/\", \"#\"]`"
|
||||
"markdownDescription": "Prefixes for identifying internal imports.\n\n- Default: `[\"~/\", \"@/\", \"#\"]`"
|
||||
},
|
||||
"newlinesBetween": {
|
||||
"description": "Specifies whether to add newlines between groups.\n\nWhen `false`, no newlines are added between groups.\n\n- Default: `true`",
|
||||
"description": "Add newlines between groups.\n\n- Default: `true`",
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Specifies whether to add newlines between groups.\n\nWhen `false`, no newlines are added between groups.\n\n- Default: `true`"
|
||||
"markdownDescription": "Add newlines between groups.\n\n- Default: `true`"
|
||||
},
|
||||
"order": {
|
||||
"description": "Specifies whether to sort items in ascending or descending order.\n\n- Default: `\"asc\"`",
|
||||
"description": "Sort in ascending or descending order.\n\n- Default: `\"asc\"`",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SortOrderConfig"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Specifies whether to sort items in ascending or descending order.\n\n- Default: `\"asc\"`"
|
||||
"markdownDescription": "Sort in ascending or descending order.\n\n- Default: `\"asc\"`"
|
||||
},
|
||||
"partitionByComment": {
|
||||
"description": "Enables the use of comments to separate imports into logical groups.\n\nWhen `true`, all comments will be treated as delimiters, creating partitions.\n\n```js\nimport { b1, b2 } from 'b'\n// PARTITION\nimport { a } from 'a'\nimport { c } from 'c'\n```\n\n- Default: `false`",
|
||||
"description": "Use comments to separate imports into logical groups.\n\nWhen `true`, all comments are treated as delimiters.\n\n```js\nimport { b1, b2 } from 'b'\n// PARTITION\nimport { a } from 'a'\nimport { c } from 'c'\n```\n\n- Default: `false`",
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Enables the use of comments to separate imports into logical groups.\n\nWhen `true`, all comments will be treated as delimiters, creating partitions.\n\n```js\nimport { b1, b2 } from 'b'\n// PARTITION\nimport { a } from 'a'\nimport { c } from 'c'\n```\n\n- Default: `false`"
|
||||
"markdownDescription": "Use comments to separate imports into logical groups.\n\nWhen `true`, all comments are treated as delimiters.\n\n```js\nimport { b1, b2 } from 'b'\n// PARTITION\nimport { a } from 'a'\nimport { c } from 'c'\n```\n\n- Default: `false`"
|
||||
},
|
||||
"partitionByNewline": {
|
||||
"description": "Enables the empty line to separate imports into logical groups.\n\nWhen `true`, formatter will not sort imports if there is an empty line between them.\nThis helps maintain the defined order of logically separated groups of members.\n\n```js\nimport { b1, b2 } from 'b'\n\nimport { a } from 'a'\nimport { c } from 'c'\n```\n\n- Default: `false`",
|
||||
"description": "Use empty lines to separate imports into logical groups.\n\nWhen `true`, imports are not sorted across an empty line.\n\n```js\nimport { b1, b2 } from 'b'\n\nimport { a } from 'a'\nimport { c } from 'c'\n```\n\n- Default: `false`",
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Enables the empty line to separate imports into logical groups.\n\nWhen `true`, formatter will not sort imports if there is an empty line between them.\nThis helps maintain the defined order of logically separated groups of members.\n\n```js\nimport { b1, b2 } from 'b'\n\nimport { a } from 'a'\nimport { c } from 'c'\n```\n\n- Default: `false`"
|
||||
"markdownDescription": "Use empty lines to separate imports into logical groups.\n\nWhen `true`, imports are not sorted across an empty line.\n\n```js\nimport { b1, b2 } from 'b'\n\nimport { a } from 'a'\nimport { c } from 'c'\n```\n\n- Default: `false`"
|
||||
},
|
||||
"sortSideEffects": {
|
||||
"description": "Specifies whether side effect imports should be sorted.\n\nBy default, sorting side-effect imports is disabled for security reasons.\n\n- Default: `false`",
|
||||
"description": "Sort side effect imports.\n\nDisabled by default for safety reasons.\n\n- Default: `false`",
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Specifies whether side effect imports should be sorted.\n\nBy default, sorting side-effect imports is disabled for security reasons.\n\n- Default: `false`"
|
||||
"markdownDescription": "Sort side effect imports.\n\nDisabled by default for safety reasons.\n\n- Default: `false`"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -939,9 +939,9 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allowShorthand": {
|
||||
"description": "Whether to allow attribute shorthand if attribute name and expression are same.\n\n- Default: `true`",
|
||||
"description": "Whether to allow attribute shorthand if attribute name and expression are the same.\n\n- Default: `true`",
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Whether to allow attribute shorthand if attribute name and expression are same.\n\n- Default: `true`"
|
||||
"markdownDescription": "Whether to allow attribute shorthand if attribute name and expression are the same.\n\n- Default: `true`"
|
||||
},
|
||||
"indentScriptAndStyle": {
|
||||
"description": "Whether to indent code inside `<script>` and `<style>` tags.\n\n- Default: `true`",
|
||||
@@ -949,9 +949,9 @@
|
||||
"markdownDescription": "Whether to indent code inside `<script>` and `<style>` tags.\n\n- Default: `true`"
|
||||
},
|
||||
"sortOrder": {
|
||||
"description": "The order in which Svelte component sections are printed.\nFormat: join the keywords `options`, `scripts`, `markup`, `styles` with a `-` in the order you want;\nor `none` if you don't want to reorder anything.\n\n- Default: `\"options-scripts-markup-styles\"`",
|
||||
"description": "The order in which Svelte component sections are printed.\nJoin `options`, `scripts`, `markup`, `styles` with `-` in the desired order,\nor use `none` to keep the original order.\n\n- Default: `\"options-scripts-markup-styles\"`",
|
||||
"type": "string",
|
||||
"markdownDescription": "The order in which Svelte component sections are printed.\nFormat: join the keywords `options`, `scripts`, `markup`, `styles` with a `-` in the order you want;\nor `none` if you don't want to reorder anything.\n\n- Default: `\"options-scripts-markup-styles\"`"
|
||||
"markdownDescription": "The order in which Svelte component sections are printed.\nJoin `options`, `scripts`, `markup`, `styles` with `-` in the desired order,\nor use `none` to keep the original order.\n\n- Default: `\"options-scripts-markup-styles\"`"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -974,5 +974,5 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"markdownDescription": "Configuration options for the Oxfmt.\n\nMost options are the same as Prettier's options, but not all of them.\nIn addition, some options are our own extensions."
|
||||
"markdownDescription": "Configuration options for Oxfmt.\n\nMost options are the same as Prettier's options, but not all of them.\nIn addition, some options are our own extensions."
|
||||
}
|
||||
@@ -6,7 +6,7 @@ expression: snapshot
|
||||
search: false
|
||||
---
|
||||
|
||||
# Configuration options for the Oxfmt.
|
||||
# Configuration options for Oxfmt.
|
||||
|
||||
Most options are the same as Prettier's options, but not all of them.
|
||||
In addition, some options are our own extensions.
|
||||
@@ -30,13 +30,11 @@ type: `object | boolean`
|
||||
|
||||
Options for `prettier-plugin-astro`.
|
||||
|
||||
Pass `true` or an object to enable `.astro` file formatting,
|
||||
or `false` (handy in overrides) / omit to disable.
|
||||
Setting `true` resets to defaults — any options inherited from a parent scope are dropped.
|
||||
Pass `true` or an object to enable `.astro` file formatting, `false` to disable (handy in overrides).
|
||||
Setting `true` resets to defaults, dropping options inherited from a parent scope.
|
||||
|
||||
NOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime,
|
||||
but Oxfmt does NOT bundle or auto-install it.
|
||||
You must install `@astrojs/compiler-rs` yourself in your project, formatting will fail at runtime otherwise.
|
||||
NOTE: `prettier-plugin-astro` requires the `@astrojs/compiler-rs` package at runtime.
|
||||
Oxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.
|
||||
|
||||
- Languages: Astro
|
||||
- Default: Disabled
|
||||
@@ -79,8 +77,8 @@ Whether to skip formatting the frontmatter.
|
||||
type: `boolean`
|
||||
|
||||
|
||||
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).
|
||||
Put the `>` of a multi-line element at the end of the last line,
|
||||
instead of being alone on the next line (does not apply to self-closing elements).
|
||||
|
||||
- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro
|
||||
- Default: `false`
|
||||
@@ -110,12 +108,12 @@ For example:
|
||||
- YAML-in-CSS/Markdown: front matter
|
||||
|
||||
With `"off"`, these parts are kept as-is.
|
||||
NOTE: Except for some languages:
|
||||
- Svelte: formatting fails with "off", this is a limitation of `prettier-plugin-svelte`
|
||||
- Astro: the frontmatter is still formatted, but by Prettier instead of Oxfmt
|
||||
(use `astro.skipFrontmatter` to keep it as-is)
|
||||
|
||||
- Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX (languages with embedded code)
|
||||
NOTE: Some languages behave differently.
|
||||
For Svelte, formatting fails with `"off"`, a limitation of `prettier-plugin-svelte`.
|
||||
For Astro, the frontmatter is still formatted, but by Prettier instead of Oxfmt (use `astro.skipFrontmatter` to keep it as-is).
|
||||
|
||||
- Languages: JS, JSX, TS, TSX, CSS, SCSS, Less, HTML, Vue, Angular, Svelte, Astro, Markdown, MDX
|
||||
- Default: `"auto"`
|
||||
|
||||
|
||||
@@ -150,7 +148,7 @@ or at the end of previous lines (`"end"`).
|
||||
type: `"css" | "strict" | "ignore"`
|
||||
|
||||
|
||||
Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.
|
||||
Specify the global whitespace sensitivity.
|
||||
|
||||
- Languages: HTML, Angular, Vue, Handlebars, Svelte
|
||||
- Default: `"css"`
|
||||
@@ -187,11 +185,10 @@ type: `object | boolean`
|
||||
|
||||
Enable JSDoc comment formatting.
|
||||
|
||||
When enabled, JSDoc comments are normalized and reformatted:
|
||||
tag aliases are canonicalized, descriptions are capitalized,
|
||||
Normalizes JSDoc comments: tag aliases are canonicalized, descriptions are capitalized,
|
||||
long lines are wrapped, and short comments are collapsed to single-line.
|
||||
|
||||
Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
Pass `true` or an object to enable, `false` to disable.
|
||||
|
||||
- Languages: JS, JSX, TS, TSX
|
||||
- Default: Disabled
|
||||
@@ -234,9 +231,11 @@ type: `"singleLine" | "multiline" | "keep"`
|
||||
|
||||
How to format comment blocks.
|
||||
|
||||
- `"singleLine"` — Convert to single-line `/** content */` when possible.
|
||||
- `"multiline"` — Always use multi-line format.
|
||||
- `"keep"` — Preserve original formatting.
|
||||
- `"singleLine"`: Convert to single-line `/** content */` when possible
|
||||
- `"multiline"`: Always use multi-line format
|
||||
- `"keep"`: Preserve original formatting
|
||||
|
||||
By default, comments are collapsed to a single line when possible.
|
||||
|
||||
- Default: `"singleLine"`
|
||||
|
||||
@@ -278,8 +277,10 @@ type: `"greedy" | "balance"`
|
||||
|
||||
Strategy for wrapping description lines at print width.
|
||||
|
||||
- `"greedy"` — Always re-wrap text to fit within print width.
|
||||
- `"balance"` — Preserve original line breaks if all lines fit within print width.
|
||||
- `"greedy"`: Always re-wrap text to fit within print width
|
||||
- `"balance"`: Preserve original line breaks if all lines fit within print width
|
||||
|
||||
By default, description lines are always re-wrapped.
|
||||
|
||||
- Default: `"greedy"`
|
||||
|
||||
@@ -410,9 +411,11 @@ type: `"always" | "never" | "preserve"`
|
||||
|
||||
How to wrap prose.
|
||||
|
||||
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".
|
||||
- `"always"`: Wrap prose to the print width
|
||||
- `"never"`: Put each prose block on a single line, relying on editor/viewer soft wrapping
|
||||
- `"preserve"`: Keep wrapping as-is
|
||||
|
||||
By default, wrapping is preserved, since some services use a linebreak-sensitive renderer (e.g. GitHub comments, BitBucket).
|
||||
|
||||
- Languages: Markdown, MDX, YAML
|
||||
- Default: `"preserve"`
|
||||
@@ -445,7 +448,7 @@ Print semicolons at the ends of statements.
|
||||
type: `boolean`
|
||||
|
||||
|
||||
Enforce single attribute per line in HTML, Vue, and JSX.
|
||||
Enforce single attribute per line.
|
||||
|
||||
- Languages: JSX, TSX, HTML, Angular, Vue, MJML, Svelte, Astro
|
||||
- Default: `false`
|
||||
@@ -472,10 +475,9 @@ type: `object | boolean`
|
||||
|
||||
Sort import statements.
|
||||
|
||||
Using the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
|
||||
For details, see each field's documentation.
|
||||
Uses a similar algorithm to [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
|
||||
|
||||
Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
Pass `true` or an object to enable, `false` to disable.
|
||||
|
||||
- Languages: JS, JSX, TS, TSX
|
||||
- Default: Disabled
|
||||
@@ -488,14 +490,11 @@ type: `array`
|
||||
|
||||
Define your own groups for matching very specific imports.
|
||||
|
||||
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.
|
||||
The first matching definition is used, and custom groups take precedence over predefined groups.
|
||||
To give a predefined group precedence, define an equivalent custom group and put it first.
|
||||
|
||||
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.
|
||||
|
||||
If you specify multiple conditions like `elementNamePattern`, `selector`, and `modifiers`,
|
||||
all conditions must be met for an import to match the custom group (AND logic).
|
||||
When multiple conditions (`elementNamePattern`, `selector`, `modifiers`) are specified,
|
||||
all of them must match.
|
||||
|
||||
NOTE: Predefined group names (e.g. `side_effect`, `external`) and `unknown` are reserved and cannot be used as `groupName`.
|
||||
|
||||
@@ -534,7 +533,7 @@ type: `array`
|
||||
|
||||
|
||||
Modifiers to match the import characteristics.
|
||||
All specified modifiers must be present (AND logic).
|
||||
All specified modifiers must match.
|
||||
|
||||
|
||||
###### sortImports.customGroups[n].modifiers[n]
|
||||
@@ -558,41 +557,40 @@ Selector to match the import kind.
|
||||
type: `array`
|
||||
|
||||
|
||||
Specifies a list of predefined import groups for sorting.
|
||||
List of import groups for sorting.
|
||||
|
||||
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.
|
||||
Each import is assigned to a single group (or `unknown` if none matches), and groups are ordered as listed.
|
||||
Within a group, imports are sorted according to `order`, `ignoreCase`, etc.
|
||||
|
||||
Within a given group, members will be sorted according to the type, order, ignoreCase, etc. options.
|
||||
A predefined group name is a single selector with optional modifiers, joined by `-` (e.g. `type-external`).
|
||||
Modifiers can be in any order, but the selector must come last.
|
||||
|
||||
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.
|
||||
Selectors, from most to least important:
|
||||
- `type`: TypeScript type imports.
|
||||
- `side_effect_style`: Side effect style imports.
|
||||
- `side_effect`: Side effect imports.
|
||||
- `style`: Style imports.
|
||||
- `index`: Main file from the current directory.
|
||||
- `sibling`: Modules from the same directory.
|
||||
- `parent`: Modules from the parent directory.
|
||||
- `subpath`: Node.js subpath imports.
|
||||
- `internal`: Your internal modules.
|
||||
- `builtin`: Node.js Built-in Modules.
|
||||
- `external`: External modules installed in the project.
|
||||
- `import`: Any import.
|
||||
|
||||
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.
|
||||
Modifiers, from most to least important:
|
||||
- `side_effect`: Side effect imports.
|
||||
- `type`: TypeScript type imports.
|
||||
- `value`: Value imports.
|
||||
- `default`: Imports containing the default specifier.
|
||||
- `wildcard`: Imports containing the wildcard (`* as`) specifier.
|
||||
- `named`: Imports containing at least one named specifier.
|
||||
|
||||
The list of selectors is sorted from most to least important:
|
||||
- `type` — TypeScript type imports.
|
||||
- `side_effect_style` — Side effect style imports.
|
||||
- `side_effect` — Side effect imports.
|
||||
- `style` — Style imports.
|
||||
- `index` — Main file from the current directory.
|
||||
- `sibling` — Modules from the same directory.
|
||||
- `parent` — Modules from the parent directory.
|
||||
- `subpath` — Node.js subpath imports.
|
||||
- `internal` — Your internal modules.
|
||||
- `builtin` — Node.js Built-in Modules.
|
||||
- `external` — External modules installed in the project.
|
||||
- `import` — Any import.
|
||||
Wrap groups in an array to sort them together as a single group (order within the array does not matter).
|
||||
|
||||
The list of modifiers is sorted from most to least important:
|
||||
- `side_effect` — Side effect imports.
|
||||
- `type` — TypeScript type imports.
|
||||
- `value` — Value imports.
|
||||
- `default` — Imports containing the default specifier.
|
||||
- `wildcard` — Imports containing the wildcard (`* as`) specifier.
|
||||
- `named` — Imports containing at least one named specifier.
|
||||
To override `newlinesBetween` at a specific group boundary,
|
||||
put a `{ "newlinesBetween": boolean }` marker object at that position.
|
||||
|
||||
- Default: See below
|
||||
```json
|
||||
@@ -613,9 +611,6 @@ The list of modifiers is sorted from most to least important:
|
||||
]
|
||||
```
|
||||
|
||||
Also, you can override the global `newlinesBetween` setting for specific group boundaries
|
||||
by including a `{ "newlinesBetween": boolean }` marker object in the `groups` list at the desired position.
|
||||
|
||||
|
||||
#### sortImports.groups[n]
|
||||
|
||||
@@ -638,7 +633,7 @@ type: `boolean`
|
||||
type: `boolean`
|
||||
|
||||
|
||||
Specifies whether sorting should be case-sensitive.
|
||||
Ignore case when sorting.
|
||||
|
||||
- Default: `true`
|
||||
|
||||
@@ -648,9 +643,7 @@ Specifies whether sorting should be case-sensitive.
|
||||
type: `string[]`
|
||||
|
||||
|
||||
Specifies a prefix for identifying internal imports.
|
||||
|
||||
This is useful for distinguishing your own modules from external dependencies.
|
||||
Prefixes for identifying internal imports.
|
||||
|
||||
- Default: `["~/", "@/", "#"]`
|
||||
|
||||
@@ -660,9 +653,7 @@ This is useful for distinguishing your own modules from external dependencies.
|
||||
type: `boolean`
|
||||
|
||||
|
||||
Specifies whether to add newlines between groups.
|
||||
|
||||
When `false`, no newlines are added between groups.
|
||||
Add newlines between groups.
|
||||
|
||||
- Default: `true`
|
||||
|
||||
@@ -672,7 +663,7 @@ When `false`, no newlines are added between groups.
|
||||
type: `"asc" | "desc"`
|
||||
|
||||
|
||||
Specifies whether to sort items in ascending or descending order.
|
||||
Sort in ascending or descending order.
|
||||
|
||||
- Default: `"asc"`
|
||||
|
||||
@@ -682,9 +673,9 @@ Specifies whether to sort items in ascending or descending order.
|
||||
type: `boolean`
|
||||
|
||||
|
||||
Enables the use of comments to separate imports into logical groups.
|
||||
Use comments to separate imports into logical groups.
|
||||
|
||||
When `true`, all comments will be treated as delimiters, creating partitions.
|
||||
When `true`, all comments are treated as delimiters.
|
||||
|
||||
```js
|
||||
import { b1, b2 } from 'b'
|
||||
@@ -701,10 +692,9 @@ import { c } from 'c'
|
||||
type: `boolean`
|
||||
|
||||
|
||||
Enables the empty line to separate imports into logical groups.
|
||||
Use empty lines to separate imports into logical groups.
|
||||
|
||||
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.
|
||||
When `true`, imports are not sorted across an empty line.
|
||||
|
||||
```js
|
||||
import { b1, b2 } from 'b'
|
||||
@@ -721,9 +711,9 @@ import { c } from 'c'
|
||||
type: `boolean`
|
||||
|
||||
|
||||
Specifies whether side effect imports should be sorted.
|
||||
Sort side effect imports.
|
||||
|
||||
By default, sorting side-effect imports is disabled for security reasons.
|
||||
Disabled by default for safety reasons.
|
||||
|
||||
- Default: `false`
|
||||
|
||||
@@ -735,9 +725,8 @@ type: `object | boolean`
|
||||
|
||||
Sort `package.json` keys.
|
||||
|
||||
The algorithm is NOT compatible with [prettier-plugin-sort-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson).
|
||||
But we believe it is clearer and easier to navigate.
|
||||
For details, see each field's documentation.
|
||||
The order is NOT compatible with [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson),
|
||||
but we believe it is clearer and easier to navigate.
|
||||
|
||||
- Languages: JSON (`package.json` only)
|
||||
- Default: `true`
|
||||
@@ -760,11 +749,10 @@ type: `object | boolean`
|
||||
|
||||
Sort Tailwind CSS classes.
|
||||
|
||||
Using the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/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.
|
||||
Uses the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).
|
||||
Option names omit the `tailwind` prefix used in the original plugin (e.g. `config` instead of `tailwindConfig`).
|
||||
|
||||
Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
|
||||
Pass `true` or an object to enable, `false` to disable.
|
||||
|
||||
- Languages: JS, JSX, TS, TSX, HTML, Vue, Angular, Handlebars, CSS, SCSS, Less, Svelte, Astro
|
||||
- Default: Disabled
|
||||
@@ -847,13 +835,11 @@ type: `object | boolean`
|
||||
|
||||
Options for `prettier-plugin-svelte`.
|
||||
|
||||
Pass `true` or an object to enable `.svelte` file formatting,
|
||||
or `false` (handy in overrides) / omit to disable.
|
||||
Setting `true` resets to defaults — any options inherited from a parent scope are dropped.
|
||||
Pass `true` or an object to enable `.svelte` file formatting, `false` to disable (handy in overrides).
|
||||
Setting `true` resets to defaults, dropping options inherited from a parent scope.
|
||||
|
||||
NOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime,
|
||||
but Oxfmt does NOT bundle or auto-install it.
|
||||
You must install `svelte` yourself in your project, formatting will fail at runtime otherwise.
|
||||
NOTE: `prettier-plugin-svelte` requires the `svelte` package (`svelte/compiler`) at runtime.
|
||||
Oxfmt does NOT bundle it, so install it in your project, otherwise formatting fails.
|
||||
|
||||
- Languages: Svelte
|
||||
- Default: Disabled
|
||||
@@ -864,7 +850,7 @@ You must install `svelte` yourself in your project, formatting will fail at runt
|
||||
type: `boolean`
|
||||
|
||||
|
||||
Whether to allow attribute shorthand if attribute name and expression are same.
|
||||
Whether to allow attribute shorthand if attribute name and expression are the same.
|
||||
|
||||
- Default: `true`
|
||||
|
||||
@@ -885,8 +871,8 @@ type: `string`
|
||||
|
||||
|
||||
The order in which Svelte component sections are printed.
|
||||
Format: join the keywords `options`, `scripts`, `markup`, `styles` with a `-` in the order you want;
|
||||
or `none` if you don't want to reorder anything.
|
||||
Join `options`, `scripts`, `markup`, `styles` with `-` in the desired order,
|
||||
or use `none` to keep the original order.
|
||||
|
||||
- Default: `"options-scripts-markup-styles"`
|
||||
|
||||
|
||||
Reference in new issue
Block a user