diff --git a/apps/oxfmt/src/core/oxfmtrc.rs b/apps/oxfmt/src/core/oxfmtrc.rs index 7cf372c68fb85..5916d7d6f6b20 100644 --- a/apps/oxfmt/src/core/oxfmtrc.rs +++ b/apps/oxfmt/src/core/oxfmtrc.rs @@ -11,55 +11,100 @@ use oxc_formatter::{ /// Configuration options for the Oxfmt. /// -/// Most options are the same as Prettier's options. -/// See also -/// +/// Most options are the same as Prettier's options, but not all of them. /// In addition, some options are our own extensions. // NOTE: All fields are typed as `Option` to distinguish between user-specified values and defaults. #[derive(Debug, Default, Clone, Deserialize, Serialize, JsonSchema)] #[serde(rename_all = "camelCase", default)] pub struct Oxfmtrc { - /// Use tabs for indentation or spaces. (Default: `false`) + // ============================================================================================ + // Prettier compatible options + // ============================================================================================ + /// Indent lines with tabs instead of spaces. + /// + /// - Default: `false` + /// - Overrides `.editorconfig.indent_style` #[serde(skip_serializing_if = "Option::is_none")] pub use_tabs: Option, - /// Number of spaces per indentation level. (Default: `2`) + /// Specify the number of spaces per indentation-level. + /// + /// - Default: `2` + /// - Overrides `.editorconfig.indent_size` #[serde(skip_serializing_if = "Option::is_none")] pub tab_width: Option, - /// Which end of line characters to apply. (Default: `"lf"`) + /// Which end of line characters to apply. + /// + /// NOTE: `"auto"` is not supported. + /// + /// - Default: `"lf"` + /// - Overrides `.editorconfig.end_of_line` #[serde(skip_serializing_if = "Option::is_none")] pub end_of_line: Option, - /// The line length that the printer will wrap on. (Default: `100`) + /// Specify the line length that the printer will wrap on. + /// + /// If you don’t want line wrapping when formatting Markdown, you can set the `proseWrap` option to disable it. + /// + /// - Default: `100` + /// - Overrides `.editorconfig.max_line_length` #[serde(skip_serializing_if = "Option::is_none")] pub print_width: Option, - /// Use single quotes instead of double quotes. (Default: `false`) + + /// Use single quotes instead of double quotes. + /// + /// For JSX, you can set the `jsxSingleQuote` option. + /// + /// - Default: `false` #[serde(skip_serializing_if = "Option::is_none")] pub single_quote: Option, - /// Use single quotes instead of double quotes in JSX. (Default: `false`) + /// Use single quotes instead of double quotes in JSX. + /// + /// - Default: `false` #[serde(skip_serializing_if = "Option::is_none")] pub jsx_single_quote: Option, - /// Change when properties in objects are quoted. (Default: `"as-needed"`) + /// Change when properties in objects are quoted. + /// + /// - Default: `"as-needed"` #[serde(skip_serializing_if = "Option::is_none")] pub quote_props: Option, - /// Print trailing commas wherever possible. (Default: `"all"`) + /// Print trailing commas wherever possible in multi-line comma-separated syntactic structures. + /// + /// A single-line array, for example, never gets trailing commas. + /// + /// - Default: `"all"` #[serde(skip_serializing_if = "Option::is_none")] pub trailing_comma: Option, - /// Print semicolons at the ends of statements. (Default: `true`) + /// Print semicolons at the ends of statements. + /// + /// - Default: `true` #[serde(skip_serializing_if = "Option::is_none")] pub semi: Option, - /// Include parentheses around a sole arrow function parameter. (Default: `"always"`) + /// Include parentheses around a sole arrow function parameter. + /// + /// - Default: `"always"` #[serde(skip_serializing_if = "Option::is_none")] pub arrow_parens: Option, - /// Print spaces between brackets in object literals. (Default: `true`) + /// Print spaces between brackets in object literals. + /// + /// - Default: `true` #[serde(skip_serializing_if = "Option::is_none")] pub bracket_spacing: Option, - /// Put the `>` of a multi-line JSX element at the end of the last line - /// instead of being alone on the next line. (Default: `false`) + /// 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). + /// + /// - Default: `false` #[serde(skip_serializing_if = "Option::is_none")] pub bracket_same_line: Option, - /// How to wrap object literals when they could fit on one line or span multiple lines. (Default: `"preserve"`) + /// How to wrap object literals when they could fit on one line or span multiple lines. + /// + /// By default, formats objects as multi-line if there is a newline prior to the first property. + /// Authors can use this heuristic to contextually improve readability, though it has some downsides. + /// + /// - Default: `"preserve"` #[serde(skip_serializing_if = "Option::is_none")] pub object_wrap: Option, - /// Put each attribute on a new line in JSX. (Default: `false`) + /// Enforce single attribute per line in HTML, Vue, and JSX. + /// + /// - Default: `false` #[serde(skip_serializing_if = "Option::is_none")] pub single_attribute_per_line: Option, @@ -67,40 +112,63 @@ pub struct Oxfmtrc { // Just be here to report error if they are used. #[serde(skip_serializing_if = "Option::is_none")] #[schemars(skip)] - pub experimental_operator_position: Option, + pub experimental_operator_position: Option, #[serde(skip_serializing_if = "Option::is_none")] #[schemars(skip)] pub experimental_ternaries: Option, - /// Control whether to format embedded parts in the file. - /// e.g. JS-in-Vue, CSS-in-JS, etc. (Default: `"auto"`) + /// Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file. + /// + /// NOTE: XXX-in-JS support is incomplete. + /// JS-in-XXX is fully supported but still be handled by Prettier. + /// + /// - Default: `"auto"` #[serde(skip_serializing_if = "Option::is_none")] pub embedded_language_formatting: Option, - /// Whether to insert a final newline at the end of the file. (Default: `true`) + // ============================================================================================ + // Below are our own extensions + // ============================================================================================ + /// Whether to insert a final newline at the end of the file. + /// + /// - Default: `true` + /// - Overrides `.editorconfig.insert_final_newline` #[serde(skip_serializing_if = "Option::is_none")] pub insert_final_newline: Option, - /// Experimental: Sort import statements. (Default: disabled) + /// Experimental: 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. + /// + /// - Default: Disabled #[serde(skip_serializing_if = "Option::is_none")] pub experimental_sort_imports: Option, - /// Experimental: Sort `package.json` keys. (Default: `true`) + /// Experimental: 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. + /// + /// - Default: `true` #[serde(skip_serializing_if = "Option::is_none")] pub experimental_sort_package_json: Option, - /// Experimental: Sort Tailwind CSS classes in string literals. + /// Experimental: Sort Tailwind CSS classes. /// - /// When enabled, `Oxfmt` sorts Tailwind CSS classes using the same algorithm as - /// [`prettier-plugin-tailwindcss`](https://github.com/tailwindlabs/prettier-plugin-tailwindcss). + /// 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. /// - /// See [`TailwindcssConfig`] for available options. - /// - /// (Default: disabled) + /// - Default: Disabled #[serde(skip_serializing_if = "Option::is_none")] pub experimental_tailwindcss: Option, - /// Ignore files matching these glob patterns. Current working directory is used as the root. + /// Ignore files matching these glob patterns. + /// Patterns are based on the location of the Oxfmt configuration file. + /// + /// - Default: `[]` #[serde(skip_serializing_if = "Option::is_none")] pub ignore_patterns: Option>, } @@ -155,30 +223,118 @@ pub enum EmbeddedLanguageFormattingConfig { #[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)] #[serde(rename_all = "camelCase", default)] pub struct SortImportsConfig { - /// Partition imports by newlines. (Default: `false`) + /// Enables the empty line 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. + /// + /// ```js + /// import { b1, b2 } from 'b' + /// + /// import { a } from 'a' + /// import { c } from 'c' + /// ``` + /// + /// - Default: `false` #[serde(skip_serializing_if = "Option::is_none")] pub partition_by_newline: Option, - /// Partition imports by comments. (Default: `false`) + /// Enables the use of comments to separate imports into logical groups. + /// + /// When `true`, all comments will be treated as delimiters, creating partitions. + /// + /// ```js + /// import { b1, b2 } from 'b' + /// // PARTITION + /// import { a } from 'a' + /// import { c } from 'c' + /// ``` + /// + /// - Default: `false` #[serde(skip_serializing_if = "Option::is_none")] pub partition_by_comment: Option, - /// Sort side-effect imports. (Default: `false`) + /// Specifies whether side effect imports should be sorted. + /// + /// By default, sorting side-effect imports is disabled for security reasons. + /// + /// - Default: `false` #[serde(skip_serializing_if = "Option::is_none")] pub sort_side_effects: Option, - /// Sort order. (Default: `"asc"`) + /// Specifies whether to sort items in ascending or descending order. + /// + /// - Default: `"asc"` #[serde(skip_serializing_if = "Option::is_none")] pub order: Option, - /// Ignore case when sorting. (Default: `true`) + /// Specifies whether sorting should be case-sensitive. + /// + /// - Default: `true` #[serde(skip_serializing_if = "Option::is_none")] pub ignore_case: Option, - /// Add newlines between import groups. (Default: `true`) + /// Specifies whether to add newlines between groups. + /// + /// When `false`, no newlines are added between groups. + /// + /// - Default: `true` #[serde(skip_serializing_if = "Option::is_none")] pub newlines_between: Option, - /// Glob patterns to identify internal imports. + /// Specifies a prefix for identifying internal imports. + /// + /// This is useful for distinguishing your own modules from external dependencies. + /// + /// - Default: `["~/", "@/"]` #[serde(skip_serializing_if = "Option::is_none")] pub internal_pattern: Option>, - /// Custom groups configuration for organizing imports. - /// Each array element represents a group, and multiple group names in the same array are treated as one. - /// Accepts both `string` and `string[]` as group elements. + /// Specifies a list of predefined 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. + /// + /// Within a given group, members will be sorted according to the type, order, ignoreCase, etc. options. + /// + /// Individual groups can be combined together by placing them in an array. + /// The order of groups in that array does not matter. + /// All members of the groups in the array will be sorted together as if they were part of a single group. + /// + /// Predefined groups are characterized by a single selector and potentially multiple modifiers. You may enter modifiers in any order, but the selector must always come at the end. + /// + /// The list of selectors is sorted from most to least important: + /// - `type` — TypeScript 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. + /// + /// 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. + /// - `multiline` — Imports on multiple lines. + /// - `singleline` — Imports on a single line. + /// + /// See also for details. + /// NOTE: `customGroups` is not implemented yet. + /// + /// - Default: See below + /// ```json + /// [ + /// "type-import", + /// ["value-builtin", "value-external"], + /// "type-internal", + /// "value-internal", + /// ["type-parent", "type-sibling", "type-index"], + /// ["value-parent", "value-sibling", "value-index"], + /// "unknown", + /// ] + /// ``` #[serde(skip_serializing_if = "Option::is_none", deserialize_with = "deserialize_groups")] pub groups: Option>>, } @@ -237,11 +393,6 @@ pub enum SortOrderConfig { Desc, } -/// User-provided configuration for `package.json` sorting. -/// -/// - `true`: Enable sorting with default options -/// - `false`: Disable sorting -/// - `{ sortScripts: true }`: Enable sorting with custom options #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)] #[serde(untagged)] pub enum SortPackageJsonUserConfig { @@ -267,11 +418,12 @@ impl SortPackageJsonUserConfig { } } -/// Configuration for `package.json` sorting. #[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)] #[serde(rename_all = "camelCase", default)] pub struct SortPackageJsonConfig { - /// Sort the `scripts` field alphabetically. (Default: `false`) + /// Sort the `scripts` field alphabetically. + /// + /// - Default: `false` #[serde(skip_serializing_if = "Option::is_none")] pub sort_scripts: Option, } @@ -286,60 +438,49 @@ impl SortPackageJsonConfig { } } -/// Configuration for Tailwind CSS class sorting. -/// -/// Option names omit the `tailwind` prefix used in the original plugin -/// (e.g., `config` instead of `tailwindConfig`). -/// -/// See [`prettier-plugin-tailwindcss` options](https://github.com/tailwindlabs/prettier-plugin-tailwindcss#options) for details. #[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)] #[serde(rename_all = "camelCase", default)] pub struct TailwindcssConfig { /// Path to your Tailwind CSS configuration file (v3). /// - /// Note: Paths are resolved relative to the Oxfmt configuration file. + /// NOTE: Paths are resolved relative to the Oxfmt configuration file. /// - /// Default: `"./tailwind.config.js"` + /// - Default: Automatically find `"tailwind.config.js"` #[serde(skip_serializing_if = "Option::is_none")] pub config: Option, - /// Path to your Tailwind CSS stylesheet (v4). /// - /// Note: Paths are resolved relative to the Oxfmt configuration file. + /// NOTE: Paths are resolved relative to the Oxfmt configuration file. /// - /// Example: `"./src/app.css"` + /// - Default: Installed Tailwind CSS's `theme.css` #[serde(skip_serializing_if = "Option::is_none")] pub stylesheet: Option, - /// List of custom function names that contain Tailwind CSS classes. + /// List of custom function name prefixes that contain Tailwind CSS classes. /// - /// Note: Regex patterns are not yet supported. + /// NOTE: Regex patterns are not yet supported. /// - /// Example: `["clsx", "cn", "cva", "tw"]` - /// - /// Default: `[]` + /// - Default: `[]` + /// - Example: `["clsx", "cn", "cva", "tw"]` #[serde(skip_serializing_if = "Option::is_none")] pub functions: Option>, - - /// List of attributes that contain Tailwind CSS classes. + /// List of attribute prefixes that contain Tailwind CSS classes. /// - /// Note: Regex patterns are not yet supported. + /// NOTE: Regex patterns are not yet supported. /// - /// Example: `["myClassProp", ":class"]` - /// - /// Default: `["class", "className"]` + /// - Default: `["class", "className"]` + /// - Example: `["myClassProp", ":class"]` #[serde(skip_serializing_if = "Option::is_none")] pub attributes: Option>, /// Preserve whitespace around classes. /// - /// Default: `false` + /// - Default: `false` #[serde(skip_serializing_if = "Option::is_none")] pub preserve_whitespace: Option, - /// Preserve duplicate classes. /// - /// Default: `false` + /// - Default: `false` #[serde(skip_serializing_if = "Option::is_none")] pub preserve_duplicates: Option, } @@ -694,6 +835,10 @@ impl Oxfmtrc { obj.remove("experimentalSortImports"); obj.remove("experimentalSortPackageJson"); + // TODO: Currently, `experimentalTailwindcss` is not removed here. + // Instead, they are mapped directly to Prettier's options in JS side. + // But in theory, we can also remove and remap them here. + // Any other unknown fields are preserved as-is. // e.g. `plugins`, `htmlWhitespaceSensitivity`, `vueIndentScriptAndStyle`, etc. // Other options defined independently by plugins are also left as they are. diff --git a/npm/oxfmt/configuration_schema.json b/npm/oxfmt/configuration_schema.json index 325040b56c51d..cab1ceb58ad33 100644 --- a/npm/oxfmt/configuration_schema.json +++ b/npm/oxfmt/configuration_schema.json @@ -43,41 +43,41 @@ "SortImportsConfig": { "properties": { "groups": { - "description": "Custom groups configuration for organizing imports.\nEach array element represents a group, and multiple group names in the same array are treated as one.\nAccepts both `string` and `string[]` as group elements.", + "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. You 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- `multiline` — Imports on multiple lines.\n- `singleline` — Imports on a single line.\n\nSee also for details.\nNOTE: `customGroups` is not implemented yet.\n\n- Default: See below\n```json\n[\n\"type-import\",\n[\"value-builtin\", \"value-external\"],\n\"type-internal\",\n\"value-internal\",\n[\"type-parent\", \"type-sibling\", \"type-index\"],\n[\"value-parent\", \"value-sibling\", \"value-index\"],\n\"unknown\",\n]\n```", "items": { "items": { "type": "string" }, "type": "array" }, - "markdownDescription": "Custom groups configuration for organizing imports.\nEach array element represents a group, and multiple group names in the same array are treated as one.\nAccepts both `string` and `string[]` as group elements.", + "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. You 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- `multiline` — Imports on multiple lines.\n- `singleline` — Imports on a single line.\n\nSee also for details.\nNOTE: `customGroups` is not implemented yet.\n\n- Default: See below\n```json\n[\n\"type-import\",\n[\"value-builtin\", \"value-external\"],\n\"type-internal\",\n\"value-internal\",\n[\"type-parent\", \"type-sibling\", \"type-index\"],\n[\"value-parent\", \"value-sibling\", \"value-index\"],\n\"unknown\",\n]\n```", "type": [ "array", "null" ] }, "ignoreCase": { - "description": "Ignore case when sorting. (Default: `true`)", - "markdownDescription": "Ignore case when sorting. (Default: `true`)", + "description": "Specifies whether sorting should be case-sensitive.\n\n- Default: `true`", + "markdownDescription": "Specifies whether sorting should be case-sensitive.\n\n- Default: `true`", "type": [ "boolean", "null" ] }, "internalPattern": { - "description": "Glob patterns to identify internal imports.", + "description": "Specifies a prefix for identifying internal imports.\n\nThis is useful for distinguishing your own modules from external dependencies.\n\n- Default: `[\"~/\", \"@/\"]`", "items": { "type": "string" }, - "markdownDescription": "Glob patterns to identify internal imports.", + "markdownDescription": "Specifies a prefix for identifying internal imports.\n\nThis is useful for distinguishing your own modules from external dependencies.\n\n- Default: `[\"~/\", \"@/\"]`", "type": [ "array", "null" ] }, "newlinesBetween": { - "description": "Add newlines between import groups. (Default: `true`)", - "markdownDescription": "Add newlines between import groups. (Default: `true`)", + "description": "Specifies whether to add newlines between groups.\n\nWhen `false`, no newlines are added between groups.\n\n- Default: `true`", + "markdownDescription": "Specifies whether to add newlines between groups.\n\nWhen `false`, no newlines are added between groups.\n\n- Default: `true`", "type": [ "boolean", "null" @@ -92,28 +92,28 @@ "type": "null" } ], - "description": "Sort order. (Default: `\"asc\"`)", - "markdownDescription": "Sort order. (Default: `\"asc\"`)" + "description": "Specifies whether to sort items in ascending or descending order.\n\n- Default: `\"asc\"`", + "markdownDescription": "Specifies whether to sort items in ascending or descending order.\n\n- Default: `\"asc\"`" }, "partitionByComment": { - "description": "Partition imports by comments. (Default: `false`)", - "markdownDescription": "Partition imports by comments. (Default: `false`)", + "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`", + "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`", "type": [ "boolean", "null" ] }, "partitionByNewline": { - "description": "Partition imports by newlines. (Default: `false`)", - "markdownDescription": "Partition imports by newlines. (Default: `false`)", + "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`", + "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`", "type": [ "boolean", "null" ] }, "sortSideEffects": { - "description": "Sort side-effect imports. (Default: `false`)", - "markdownDescription": "Sort side-effect imports. (Default: `false`)", + "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`", + "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`", "type": [ "boolean", "null" @@ -130,12 +130,10 @@ "type": "string" }, "SortPackageJsonConfig": { - "description": "Configuration for `package.json` sorting.", - "markdownDescription": "Configuration for `package.json` sorting.", "properties": { "sortScripts": { - "description": "Sort the `scripts` field alphabetically. (Default: `false`)", - "markdownDescription": "Sort the `scripts` field alphabetically. (Default: `false`)", + "description": "Sort the `scripts` field alphabetically.\n\n- Default: `false`", + "markdownDescription": "Sort the `scripts` field alphabetically.\n\n- Default: `false`", "type": [ "boolean", "null" @@ -152,63 +150,59 @@ { "$ref": "#/definitions/SortPackageJsonConfig" } - ], - "description": "User-provided configuration for `package.json` sorting.\n\n- `true`: Enable sorting with default options\n- `false`: Disable sorting\n- `{ sortScripts: true }`: Enable sorting with custom options", - "markdownDescription": "User-provided configuration for `package.json` sorting.\n\n- `true`: Enable sorting with default options\n- `false`: Disable sorting\n- `{ sortScripts: true }`: Enable sorting with custom options" + ] }, "TailwindcssConfig": { - "description": "Configuration for Tailwind CSS class sorting.\n\nOption names omit the `tailwind` prefix used in the original plugin\n(e.g., `config` instead of `tailwindConfig`).\n\nSee [`prettier-plugin-tailwindcss` options](https://github.com/tailwindlabs/prettier-plugin-tailwindcss#options) for details.", - "markdownDescription": "Configuration for Tailwind CSS class sorting.\n\nOption names omit the `tailwind` prefix used in the original plugin\n(e.g., `config` instead of `tailwindConfig`).\n\nSee [`prettier-plugin-tailwindcss` options](https://github.com/tailwindlabs/prettier-plugin-tailwindcss#options) for details.", "properties": { "attributes": { - "description": "List of attributes that contain Tailwind CSS classes.\n\nNote: Regex patterns are not yet supported.\n\nExample: `[\"myClassProp\", \":class\"]`\n\nDefault: `[\"class\", \"className\"]`", + "description": "List of attribute prefixes that contain Tailwind CSS classes.\n\nNOTE: Regex patterns are not yet supported.\n\n- Default: `[\"class\", \"className\"]`\n- Example: `[\"myClassProp\", \":class\"]`", "items": { "type": "string" }, - "markdownDescription": "List of attributes that contain Tailwind CSS classes.\n\nNote: Regex patterns are not yet supported.\n\nExample: `[\"myClassProp\", \":class\"]`\n\nDefault: `[\"class\", \"className\"]`", + "markdownDescription": "List of attribute prefixes that contain Tailwind CSS classes.\n\nNOTE: Regex patterns are not yet supported.\n\n- Default: `[\"class\", \"className\"]`\n- Example: `[\"myClassProp\", \":class\"]`", "type": [ "array", "null" ] }, "config": { - "description": "Path to your Tailwind CSS configuration file (v3).\n\nNote: Paths are resolved relative to the Oxfmt configuration file.\n\nDefault: `\"./tailwind.config.js\"`", - "markdownDescription": "Path to your Tailwind CSS configuration file (v3).\n\nNote: Paths are resolved relative to the Oxfmt configuration file.\n\nDefault: `\"./tailwind.config.js\"`", + "description": "Path to your Tailwind CSS configuration file (v3).\n\nNOTE: Paths are resolved relative to the Oxfmt configuration file.\n\n- Default: Automatically find `\"tailwind.config.js\"`", + "markdownDescription": "Path to your Tailwind CSS configuration file (v3).\n\nNOTE: Paths are resolved relative to the Oxfmt configuration file.\n\n- Default: Automatically find `\"tailwind.config.js\"`", "type": [ "string", "null" ] }, "functions": { - "description": "List of custom function names that contain Tailwind CSS classes.\n\nNote: Regex patterns are not yet supported.\n\nExample: `[\"clsx\", \"cn\", \"cva\", \"tw\"]`\n\nDefault: `[]`", + "description": "List of custom function name prefixes that contain Tailwind CSS classes.\n\nNOTE: Regex patterns are not yet supported.\n\n- Default: `[]`\n- Example: `[\"clsx\", \"cn\", \"cva\", \"tw\"]`", "items": { "type": "string" }, - "markdownDescription": "List of custom function names that contain Tailwind CSS classes.\n\nNote: Regex patterns are not yet supported.\n\nExample: `[\"clsx\", \"cn\", \"cva\", \"tw\"]`\n\nDefault: `[]`", + "markdownDescription": "List of custom function name prefixes that contain Tailwind CSS classes.\n\nNOTE: Regex patterns are not yet supported.\n\n- Default: `[]`\n- Example: `[\"clsx\", \"cn\", \"cva\", \"tw\"]`", "type": [ "array", "null" ] }, "preserveDuplicates": { - "description": "Preserve duplicate classes.\n\nDefault: `false`", - "markdownDescription": "Preserve duplicate classes.\n\nDefault: `false`", + "description": "Preserve duplicate classes.\n\n- Default: `false`", + "markdownDescription": "Preserve duplicate classes.\n\n- Default: `false`", "type": [ "boolean", "null" ] }, "preserveWhitespace": { - "description": "Preserve whitespace around classes.\n\nDefault: `false`", - "markdownDescription": "Preserve whitespace around classes.\n\nDefault: `false`", + "description": "Preserve whitespace around classes.\n\n- Default: `false`", + "markdownDescription": "Preserve whitespace around classes.\n\n- Default: `false`", "type": [ "boolean", "null" ] }, "stylesheet": { - "description": "Path to your Tailwind CSS stylesheet (v4).\n\nNote: Paths are resolved relative to the Oxfmt configuration file.\n\nExample: `\"./src/app.css\"`", - "markdownDescription": "Path to your Tailwind CSS stylesheet (v4).\n\nNote: Paths are resolved relative to the Oxfmt configuration file.\n\nExample: `\"./src/app.css\"`", + "description": "Path to your Tailwind CSS stylesheet (v4).\n\nNOTE: Paths are resolved relative to the Oxfmt configuration file.\n\n- Default: Installed Tailwind CSS's `theme.css`", + "markdownDescription": "Path to your Tailwind CSS stylesheet (v4).\n\nNOTE: Paths are resolved relative to the Oxfmt configuration file.\n\n- Default: Installed Tailwind CSS's `theme.css`", "type": [ "string", "null" @@ -226,8 +220,8 @@ "type": "string" } }, - "description": "Configuration options for the Oxfmt.\n\nMost options are the same as Prettier's options.\nSee also \n\nIn addition, some options are our own extensions.", - "markdownDescription": "Configuration options for the Oxfmt.\n\nMost options are the same as Prettier's options.\nSee also \n\nIn addition, some options are our own extensions.", + "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.", + "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.", "properties": { "arrowParens": { "anyOf": [ @@ -238,20 +232,20 @@ "type": "null" } ], - "description": "Include parentheses around a sole arrow function parameter. (Default: `\"always\"`)", - "markdownDescription": "Include parentheses around a sole arrow function parameter. (Default: `\"always\"`)" + "description": "Include parentheses around a sole arrow function parameter.\n\n- Default: `\"always\"`", + "markdownDescription": "Include parentheses around a sole arrow function parameter.\n\n- Default: `\"always\"`" }, "bracketSameLine": { - "description": "Put the `>` of a multi-line JSX element at the end of the last line\ninstead of being alone on the next line. (Default: `false`)", - "markdownDescription": "Put the `>` of a multi-line JSX element at the end of the last line\ninstead of being alone on the next line. (Default: `false`)", + "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- Default: `false`", + "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- Default: `false`", "type": [ "boolean", "null" ] }, "bracketSpacing": { - "description": "Print spaces between brackets in object literals. (Default: `true`)", - "markdownDescription": "Print spaces between brackets in object literals. (Default: `true`)", + "description": "Print spaces between brackets in object literals.\n\n- Default: `true`", + "markdownDescription": "Print spaces between brackets in object literals.\n\n- Default: `true`", "type": [ "boolean", "null" @@ -266,8 +260,8 @@ "type": "null" } ], - "description": "Control whether to format embedded parts in the file.\ne.g. JS-in-Vue, CSS-in-JS, etc. (Default: `\"auto\"`)", - "markdownDescription": "Control whether to format embedded parts in the file.\ne.g. JS-in-Vue, CSS-in-JS, etc. (Default: `\"auto\"`)" + "description": "Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file.\n\nNOTE: XXX-in-JS support is incomplete.\nJS-in-XXX is fully supported but still be handled by Prettier.\n\n- Default: `\"auto\"`", + "markdownDescription": "Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file.\n\nNOTE: XXX-in-JS support is incomplete.\nJS-in-XXX is fully supported but still be handled by Prettier.\n\n- Default: `\"auto\"`" }, "endOfLine": { "anyOf": [ @@ -278,8 +272,8 @@ "type": "null" } ], - "description": "Which end of line characters to apply. (Default: `\"lf\"`)", - "markdownDescription": "Which end of line characters to apply. (Default: `\"lf\"`)" + "description": "Which end of line characters to apply.\n\nNOTE: `\"auto\"` is not supported.\n\n- Default: `\"lf\"`\n- Overrides `.editorconfig.end_of_line`", + "markdownDescription": "Which end of line characters to apply.\n\nNOTE: `\"auto\"` is not supported.\n\n- Default: `\"lf\"`\n- Overrides `.editorconfig.end_of_line`" }, "experimentalSortImports": { "anyOf": [ @@ -290,8 +284,8 @@ "type": "null" } ], - "description": "Experimental: Sort import statements. (Default: disabled)", - "markdownDescription": "Experimental: Sort import statements. (Default: disabled)" + "description": "Experimental: 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\n- Default: Disabled", + "markdownDescription": "Experimental: 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\n- Default: Disabled" }, "experimentalSortPackageJson": { "anyOf": [ @@ -302,8 +296,8 @@ "type": "null" } ], - "description": "Experimental: Sort `package.json` keys. (Default: `true`)", - "markdownDescription": "Experimental: Sort `package.json` keys. (Default: `true`)" + "description": "Experimental: 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- Default: `true`", + "markdownDescription": "Experimental: 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- Default: `true`" }, "experimentalTailwindcss": { "anyOf": [ @@ -314,31 +308,31 @@ "type": "null" } ], - "description": "Experimental: Sort Tailwind CSS classes in string literals.\n\nWhen enabled, `Oxfmt` sorts Tailwind CSS classes using the same algorithm as\n[`prettier-plugin-tailwindcss`](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\n\nSee [`TailwindcssConfig`] for available options.\n\n(Default: disabled)", - "markdownDescription": "Experimental: Sort Tailwind CSS classes in string literals.\n\nWhen enabled, `Oxfmt` sorts Tailwind CSS classes using the same algorithm as\n[`prettier-plugin-tailwindcss`](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\n\nSee [`TailwindcssConfig`] for available options.\n\n(Default: disabled)" + "description": "Experimental: 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\n- Default: Disabled", + "markdownDescription": "Experimental: 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\n- Default: Disabled" }, "ignorePatterns": { - "description": "Ignore files matching these glob patterns. Current working directory is used as the root.", + "description": "Ignore files matching these glob patterns.\nPatterns are based on the location of the Oxfmt configuration file.\n\n- Default: `[]`", "items": { "type": "string" }, - "markdownDescription": "Ignore files matching these glob patterns. Current working directory is used as the root.", + "markdownDescription": "Ignore files matching these glob patterns.\nPatterns are based on the location of the Oxfmt configuration file.\n\n- Default: `[]`", "type": [ "array", "null" ] }, "insertFinalNewline": { - "description": "Whether to insert a final newline at the end of the file. (Default: `true`)", - "markdownDescription": "Whether to insert a final newline at the end of the file. (Default: `true`)", + "description": "Whether to insert a final newline at the end of the file.\n\n- Default: `true`\n- Overrides `.editorconfig.insert_final_newline`", + "markdownDescription": "Whether to insert a final newline at the end of the file.\n\n- Default: `true`\n- Overrides `.editorconfig.insert_final_newline`", "type": [ "boolean", "null" ] }, "jsxSingleQuote": { - "description": "Use single quotes instead of double quotes in JSX. (Default: `false`)", - "markdownDescription": "Use single quotes instead of double quotes in JSX. (Default: `false`)", + "description": "Use single quotes instead of double quotes in JSX.\n\n- Default: `false`", + "markdownDescription": "Use single quotes instead of double quotes in JSX.\n\n- Default: `false`", "type": [ "boolean", "null" @@ -353,13 +347,13 @@ "type": "null" } ], - "description": "How to wrap object literals when they could fit on one line or span multiple lines. (Default: `\"preserve\"`)", - "markdownDescription": "How to wrap object literals when they could fit on one line or span multiple lines. (Default: `\"preserve\"`)" + "description": "How to wrap object literals when they could fit on one line or span multiple lines.\n\nBy default, formats objects as multi-line if there is a newline prior to the first property.\nAuthors can use this heuristic to contextually improve readability, though it has some downsides.\n\n- Default: `\"preserve\"`", + "markdownDescription": "How to wrap object literals when they could fit on one line or span multiple lines.\n\nBy default, formats objects as multi-line if there is a newline prior to the first property.\nAuthors can use this heuristic to contextually improve readability, though it has some downsides.\n\n- Default: `\"preserve\"`" }, "printWidth": { - "description": "The line length that the printer will wrap on. (Default: `100`)", + "description": "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- Default: `100`\n- Overrides `.editorconfig.max_line_length`", "format": "uint16", - "markdownDescription": "The line length that the printer will wrap on. (Default: `100`)", + "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- Default: `100`\n- Overrides `.editorconfig.max_line_length`", "minimum": 0.0, "type": [ "integer", @@ -375,37 +369,37 @@ "type": "null" } ], - "description": "Change when properties in objects are quoted. (Default: `\"as-needed\"`)", - "markdownDescription": "Change when properties in objects are quoted. (Default: `\"as-needed\"`)" + "description": "Change when properties in objects are quoted.\n\n- Default: `\"as-needed\"`", + "markdownDescription": "Change when properties in objects are quoted.\n\n- Default: `\"as-needed\"`" }, "semi": { - "description": "Print semicolons at the ends of statements. (Default: `true`)", - "markdownDescription": "Print semicolons at the ends of statements. (Default: `true`)", + "description": "Print semicolons at the ends of statements.\n\n- Default: `true`", + "markdownDescription": "Print semicolons at the ends of statements.\n\n- Default: `true`", "type": [ "boolean", "null" ] }, "singleAttributePerLine": { - "description": "Put each attribute on a new line in JSX. (Default: `false`)", - "markdownDescription": "Put each attribute on a new line in JSX. (Default: `false`)", + "description": "Enforce single attribute per line in HTML, Vue, and JSX.\n\n- Default: `false`", + "markdownDescription": "Enforce single attribute per line in HTML, Vue, and JSX.\n\n- Default: `false`", "type": [ "boolean", "null" ] }, "singleQuote": { - "description": "Use single quotes instead of double quotes. (Default: `false`)", - "markdownDescription": "Use single quotes instead of double quotes. (Default: `false`)", + "description": "Use single quotes instead of double quotes.\n\nFor JSX, you can set the `jsxSingleQuote` option.\n\n- Default: `false`", + "markdownDescription": "Use single quotes instead of double quotes.\n\nFor JSX, you can set the `jsxSingleQuote` option.\n\n- Default: `false`", "type": [ "boolean", "null" ] }, "tabWidth": { - "description": "Number of spaces per indentation level. (Default: `2`)", + "description": "Specify the number of spaces per indentation-level.\n\n- Default: `2`\n- Overrides `.editorconfig.indent_size`", "format": "uint8", - "markdownDescription": "Number of spaces per indentation level. (Default: `2`)", + "markdownDescription": "Specify the number of spaces per indentation-level.\n\n- Default: `2`\n- Overrides `.editorconfig.indent_size`", "minimum": 0.0, "type": [ "integer", @@ -421,12 +415,12 @@ "type": "null" } ], - "description": "Print trailing commas wherever possible. (Default: `\"all\"`)", - "markdownDescription": "Print trailing commas wherever possible. (Default: `\"all\"`)" + "description": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures.\n\nA single-line array, for example, never gets trailing commas.\n\n- Default: `\"all\"`", + "markdownDescription": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures.\n\nA single-line array, for example, never gets trailing commas.\n\n- Default: `\"all\"`" }, "useTabs": { - "description": "Use tabs for indentation or spaces. (Default: `false`)", - "markdownDescription": "Use tabs for indentation or spaces. (Default: `false`)", + "description": "Indent lines with tabs instead of spaces.\n\n- Default: `false`\n- Overrides `.editorconfig.indent_style`", + "markdownDescription": "Indent lines with tabs instead of spaces.\n\n- Default: `false`\n- Overrides `.editorconfig.indent_style`", "type": [ "boolean", "null" @@ -435,4 +429,4 @@ }, "title": "Oxfmtrc", "type": "object" -} \ No newline at end of file +} diff --git a/tasks/website_formatter/src/snapshots/schema_json.snap b/tasks/website_formatter/src/snapshots/schema_json.snap index 8562967a813d5..2934cbd2a942f 100644 --- a/tasks/website_formatter/src/snapshots/schema_json.snap +++ b/tasks/website_formatter/src/snapshots/schema_json.snap @@ -47,41 +47,41 @@ expression: json "SortImportsConfig": { "properties": { "groups": { - "description": "Custom groups configuration for organizing imports.\nEach array element represents a group, and multiple group names in the same array are treated as one.\nAccepts both `string` and `string[]` as group elements.", + "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. You 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- `multiline` — Imports on multiple lines.\n- `singleline` — Imports on a single line.\n\nSee also for details.\nNOTE: `customGroups` is not implemented yet.\n\n- Default: See below\n```json\n[\n\"type-import\",\n[\"value-builtin\", \"value-external\"],\n\"type-internal\",\n\"value-internal\",\n[\"type-parent\", \"type-sibling\", \"type-index\"],\n[\"value-parent\", \"value-sibling\", \"value-index\"],\n\"unknown\",\n]\n```", "items": { "items": { "type": "string" }, "type": "array" }, - "markdownDescription": "Custom groups configuration for organizing imports.\nEach array element represents a group, and multiple group names in the same array are treated as one.\nAccepts both `string` and `string[]` as group elements.", + "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. You 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- `multiline` — Imports on multiple lines.\n- `singleline` — Imports on a single line.\n\nSee also for details.\nNOTE: `customGroups` is not implemented yet.\n\n- Default: See below\n```json\n[\n\"type-import\",\n[\"value-builtin\", \"value-external\"],\n\"type-internal\",\n\"value-internal\",\n[\"type-parent\", \"type-sibling\", \"type-index\"],\n[\"value-parent\", \"value-sibling\", \"value-index\"],\n\"unknown\",\n]\n```", "type": [ "array", "null" ] }, "ignoreCase": { - "description": "Ignore case when sorting. (Default: `true`)", - "markdownDescription": "Ignore case when sorting. (Default: `true`)", + "description": "Specifies whether sorting should be case-sensitive.\n\n- Default: `true`", + "markdownDescription": "Specifies whether sorting should be case-sensitive.\n\n- Default: `true`", "type": [ "boolean", "null" ] }, "internalPattern": { - "description": "Glob patterns to identify internal imports.", + "description": "Specifies a prefix for identifying internal imports.\n\nThis is useful for distinguishing your own modules from external dependencies.\n\n- Default: `[\"~/\", \"@/\"]`", "items": { "type": "string" }, - "markdownDescription": "Glob patterns to identify internal imports.", + "markdownDescription": "Specifies a prefix for identifying internal imports.\n\nThis is useful for distinguishing your own modules from external dependencies.\n\n- Default: `[\"~/\", \"@/\"]`", "type": [ "array", "null" ] }, "newlinesBetween": { - "description": "Add newlines between import groups. (Default: `true`)", - "markdownDescription": "Add newlines between import groups. (Default: `true`)", + "description": "Specifies whether to add newlines between groups.\n\nWhen `false`, no newlines are added between groups.\n\n- Default: `true`", + "markdownDescription": "Specifies whether to add newlines between groups.\n\nWhen `false`, no newlines are added between groups.\n\n- Default: `true`", "type": [ "boolean", "null" @@ -96,28 +96,28 @@ expression: json "type": "null" } ], - "description": "Sort order. (Default: `\"asc\"`)", - "markdownDescription": "Sort order. (Default: `\"asc\"`)" + "description": "Specifies whether to sort items in ascending or descending order.\n\n- Default: `\"asc\"`", + "markdownDescription": "Specifies whether to sort items in ascending or descending order.\n\n- Default: `\"asc\"`" }, "partitionByComment": { - "description": "Partition imports by comments. (Default: `false`)", - "markdownDescription": "Partition imports by comments. (Default: `false`)", + "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`", + "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`", "type": [ "boolean", "null" ] }, "partitionByNewline": { - "description": "Partition imports by newlines. (Default: `false`)", - "markdownDescription": "Partition imports by newlines. (Default: `false`)", + "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`", + "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`", "type": [ "boolean", "null" ] }, "sortSideEffects": { - "description": "Sort side-effect imports. (Default: `false`)", - "markdownDescription": "Sort side-effect imports. (Default: `false`)", + "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`", + "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`", "type": [ "boolean", "null" @@ -134,12 +134,10 @@ expression: json "type": "string" }, "SortPackageJsonConfig": { - "description": "Configuration for `package.json` sorting.", - "markdownDescription": "Configuration for `package.json` sorting.", "properties": { "sortScripts": { - "description": "Sort the `scripts` field alphabetically. (Default: `false`)", - "markdownDescription": "Sort the `scripts` field alphabetically. (Default: `false`)", + "description": "Sort the `scripts` field alphabetically.\n\n- Default: `false`", + "markdownDescription": "Sort the `scripts` field alphabetically.\n\n- Default: `false`", "type": [ "boolean", "null" @@ -156,63 +154,59 @@ expression: json { "$ref": "#/definitions/SortPackageJsonConfig" } - ], - "description": "User-provided configuration for `package.json` sorting.\n\n- `true`: Enable sorting with default options\n- `false`: Disable sorting\n- `{ sortScripts: true }`: Enable sorting with custom options", - "markdownDescription": "User-provided configuration for `package.json` sorting.\n\n- `true`: Enable sorting with default options\n- `false`: Disable sorting\n- `{ sortScripts: true }`: Enable sorting with custom options" + ] }, "TailwindcssConfig": { - "description": "Configuration for Tailwind CSS class sorting.\n\nOption names omit the `tailwind` prefix used in the original plugin\n(e.g., `config` instead of `tailwindConfig`).\n\nSee [`prettier-plugin-tailwindcss` options](https://github.com/tailwindlabs/prettier-plugin-tailwindcss#options) for details.", - "markdownDescription": "Configuration for Tailwind CSS class sorting.\n\nOption names omit the `tailwind` prefix used in the original plugin\n(e.g., `config` instead of `tailwindConfig`).\n\nSee [`prettier-plugin-tailwindcss` options](https://github.com/tailwindlabs/prettier-plugin-tailwindcss#options) for details.", "properties": { "attributes": { - "description": "List of attributes that contain Tailwind CSS classes.\n\nNote: Regex patterns are not yet supported.\n\nExample: `[\"myClassProp\", \":class\"]`\n\nDefault: `[\"class\", \"className\"]`", + "description": "List of attribute prefixes that contain Tailwind CSS classes.\n\nNOTE: Regex patterns are not yet supported.\n\n- Default: `[\"class\", \"className\"]`\n- Example: `[\"myClassProp\", \":class\"]`", "items": { "type": "string" }, - "markdownDescription": "List of attributes that contain Tailwind CSS classes.\n\nNote: Regex patterns are not yet supported.\n\nExample: `[\"myClassProp\", \":class\"]`\n\nDefault: `[\"class\", \"className\"]`", + "markdownDescription": "List of attribute prefixes that contain Tailwind CSS classes.\n\nNOTE: Regex patterns are not yet supported.\n\n- Default: `[\"class\", \"className\"]`\n- Example: `[\"myClassProp\", \":class\"]`", "type": [ "array", "null" ] }, "config": { - "description": "Path to your Tailwind CSS configuration file (v3).\n\nNote: Paths are resolved relative to the Oxfmt configuration file.\n\nDefault: `\"./tailwind.config.js\"`", - "markdownDescription": "Path to your Tailwind CSS configuration file (v3).\n\nNote: Paths are resolved relative to the Oxfmt configuration file.\n\nDefault: `\"./tailwind.config.js\"`", + "description": "Path to your Tailwind CSS configuration file (v3).\n\nNOTE: Paths are resolved relative to the Oxfmt configuration file.\n\n- Default: Automatically find `\"tailwind.config.js\"`", + "markdownDescription": "Path to your Tailwind CSS configuration file (v3).\n\nNOTE: Paths are resolved relative to the Oxfmt configuration file.\n\n- Default: Automatically find `\"tailwind.config.js\"`", "type": [ "string", "null" ] }, "functions": { - "description": "List of custom function names that contain Tailwind CSS classes.\n\nNote: Regex patterns are not yet supported.\n\nExample: `[\"clsx\", \"cn\", \"cva\", \"tw\"]`\n\nDefault: `[]`", + "description": "List of custom function name prefixes that contain Tailwind CSS classes.\n\nNOTE: Regex patterns are not yet supported.\n\n- Default: `[]`\n- Example: `[\"clsx\", \"cn\", \"cva\", \"tw\"]`", "items": { "type": "string" }, - "markdownDescription": "List of custom function names that contain Tailwind CSS classes.\n\nNote: Regex patterns are not yet supported.\n\nExample: `[\"clsx\", \"cn\", \"cva\", \"tw\"]`\n\nDefault: `[]`", + "markdownDescription": "List of custom function name prefixes that contain Tailwind CSS classes.\n\nNOTE: Regex patterns are not yet supported.\n\n- Default: `[]`\n- Example: `[\"clsx\", \"cn\", \"cva\", \"tw\"]`", "type": [ "array", "null" ] }, "preserveDuplicates": { - "description": "Preserve duplicate classes.\n\nDefault: `false`", - "markdownDescription": "Preserve duplicate classes.\n\nDefault: `false`", + "description": "Preserve duplicate classes.\n\n- Default: `false`", + "markdownDescription": "Preserve duplicate classes.\n\n- Default: `false`", "type": [ "boolean", "null" ] }, "preserveWhitespace": { - "description": "Preserve whitespace around classes.\n\nDefault: `false`", - "markdownDescription": "Preserve whitespace around classes.\n\nDefault: `false`", + "description": "Preserve whitespace around classes.\n\n- Default: `false`", + "markdownDescription": "Preserve whitespace around classes.\n\n- Default: `false`", "type": [ "boolean", "null" ] }, "stylesheet": { - "description": "Path to your Tailwind CSS stylesheet (v4).\n\nNote: Paths are resolved relative to the Oxfmt configuration file.\n\nExample: `\"./src/app.css\"`", - "markdownDescription": "Path to your Tailwind CSS stylesheet (v4).\n\nNote: Paths are resolved relative to the Oxfmt configuration file.\n\nExample: `\"./src/app.css\"`", + "description": "Path to your Tailwind CSS stylesheet (v4).\n\nNOTE: Paths are resolved relative to the Oxfmt configuration file.\n\n- Default: Installed Tailwind CSS's `theme.css`", + "markdownDescription": "Path to your Tailwind CSS stylesheet (v4).\n\nNOTE: Paths are resolved relative to the Oxfmt configuration file.\n\n- Default: Installed Tailwind CSS's `theme.css`", "type": [ "string", "null" @@ -230,8 +224,8 @@ expression: json "type": "string" } }, - "description": "Configuration options for the Oxfmt.\n\nMost options are the same as Prettier's options.\nSee also \n\nIn addition, some options are our own extensions.", - "markdownDescription": "Configuration options for the Oxfmt.\n\nMost options are the same as Prettier's options.\nSee also \n\nIn addition, some options are our own extensions.", + "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.", + "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.", "properties": { "arrowParens": { "anyOf": [ @@ -242,20 +236,20 @@ expression: json "type": "null" } ], - "description": "Include parentheses around a sole arrow function parameter. (Default: `\"always\"`)", - "markdownDescription": "Include parentheses around a sole arrow function parameter. (Default: `\"always\"`)" + "description": "Include parentheses around a sole arrow function parameter.\n\n- Default: `\"always\"`", + "markdownDescription": "Include parentheses around a sole arrow function parameter.\n\n- Default: `\"always\"`" }, "bracketSameLine": { - "description": "Put the `>` of a multi-line JSX element at the end of the last line\ninstead of being alone on the next line. (Default: `false`)", - "markdownDescription": "Put the `>` of a multi-line JSX element at the end of the last line\ninstead of being alone on the next line. (Default: `false`)", + "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- Default: `false`", + "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- Default: `false`", "type": [ "boolean", "null" ] }, "bracketSpacing": { - "description": "Print spaces between brackets in object literals. (Default: `true`)", - "markdownDescription": "Print spaces between brackets in object literals. (Default: `true`)", + "description": "Print spaces between brackets in object literals.\n\n- Default: `true`", + "markdownDescription": "Print spaces between brackets in object literals.\n\n- Default: `true`", "type": [ "boolean", "null" @@ -270,8 +264,8 @@ expression: json "type": "null" } ], - "description": "Control whether to format embedded parts in the file.\ne.g. JS-in-Vue, CSS-in-JS, etc. (Default: `\"auto\"`)", - "markdownDescription": "Control whether to format embedded parts in the file.\ne.g. JS-in-Vue, CSS-in-JS, etc. (Default: `\"auto\"`)" + "description": "Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file.\n\nNOTE: XXX-in-JS support is incomplete.\nJS-in-XXX is fully supported but still be handled by Prettier.\n\n- Default: `\"auto\"`", + "markdownDescription": "Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file.\n\nNOTE: XXX-in-JS support is incomplete.\nJS-in-XXX is fully supported but still be handled by Prettier.\n\n- Default: `\"auto\"`" }, "endOfLine": { "anyOf": [ @@ -282,8 +276,8 @@ expression: json "type": "null" } ], - "description": "Which end of line characters to apply. (Default: `\"lf\"`)", - "markdownDescription": "Which end of line characters to apply. (Default: `\"lf\"`)" + "description": "Which end of line characters to apply.\n\nNOTE: `\"auto\"` is not supported.\n\n- Default: `\"lf\"`\n- Overrides `.editorconfig.end_of_line`", + "markdownDescription": "Which end of line characters to apply.\n\nNOTE: `\"auto\"` is not supported.\n\n- Default: `\"lf\"`\n- Overrides `.editorconfig.end_of_line`" }, "experimentalSortImports": { "anyOf": [ @@ -294,8 +288,8 @@ expression: json "type": "null" } ], - "description": "Experimental: Sort import statements. (Default: disabled)", - "markdownDescription": "Experimental: Sort import statements. (Default: disabled)" + "description": "Experimental: 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\n- Default: Disabled", + "markdownDescription": "Experimental: 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\n- Default: Disabled" }, "experimentalSortPackageJson": { "anyOf": [ @@ -306,8 +300,8 @@ expression: json "type": "null" } ], - "description": "Experimental: Sort `package.json` keys. (Default: `true`)", - "markdownDescription": "Experimental: Sort `package.json` keys. (Default: `true`)" + "description": "Experimental: 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- Default: `true`", + "markdownDescription": "Experimental: 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- Default: `true`" }, "experimentalTailwindcss": { "anyOf": [ @@ -318,31 +312,31 @@ expression: json "type": "null" } ], - "description": "Experimental: Sort Tailwind CSS classes in string literals.\n\nWhen enabled, `Oxfmt` sorts Tailwind CSS classes using the same algorithm as\n[`prettier-plugin-tailwindcss`](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\n\nSee [`TailwindcssConfig`] for available options.\n\n(Default: disabled)", - "markdownDescription": "Experimental: Sort Tailwind CSS classes in string literals.\n\nWhen enabled, `Oxfmt` sorts Tailwind CSS classes using the same algorithm as\n[`prettier-plugin-tailwindcss`](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).\n\nSee [`TailwindcssConfig`] for available options.\n\n(Default: disabled)" + "description": "Experimental: 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\n- Default: Disabled", + "markdownDescription": "Experimental: 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\n- Default: Disabled" }, "ignorePatterns": { - "description": "Ignore files matching these glob patterns. Current working directory is used as the root.", + "description": "Ignore files matching these glob patterns.\nPatterns are based on the location of the Oxfmt configuration file.\n\n- Default: `[]`", "items": { "type": "string" }, - "markdownDescription": "Ignore files matching these glob patterns. Current working directory is used as the root.", + "markdownDescription": "Ignore files matching these glob patterns.\nPatterns are based on the location of the Oxfmt configuration file.\n\n- Default: `[]`", "type": [ "array", "null" ] }, "insertFinalNewline": { - "description": "Whether to insert a final newline at the end of the file. (Default: `true`)", - "markdownDescription": "Whether to insert a final newline at the end of the file. (Default: `true`)", + "description": "Whether to insert a final newline at the end of the file.\n\n- Default: `true`\n- Overrides `.editorconfig.insert_final_newline`", + "markdownDescription": "Whether to insert a final newline at the end of the file.\n\n- Default: `true`\n- Overrides `.editorconfig.insert_final_newline`", "type": [ "boolean", "null" ] }, "jsxSingleQuote": { - "description": "Use single quotes instead of double quotes in JSX. (Default: `false`)", - "markdownDescription": "Use single quotes instead of double quotes in JSX. (Default: `false`)", + "description": "Use single quotes instead of double quotes in JSX.\n\n- Default: `false`", + "markdownDescription": "Use single quotes instead of double quotes in JSX.\n\n- Default: `false`", "type": [ "boolean", "null" @@ -357,13 +351,13 @@ expression: json "type": "null" } ], - "description": "How to wrap object literals when they could fit on one line or span multiple lines. (Default: `\"preserve\"`)", - "markdownDescription": "How to wrap object literals when they could fit on one line or span multiple lines. (Default: `\"preserve\"`)" + "description": "How to wrap object literals when they could fit on one line or span multiple lines.\n\nBy default, formats objects as multi-line if there is a newline prior to the first property.\nAuthors can use this heuristic to contextually improve readability, though it has some downsides.\n\n- Default: `\"preserve\"`", + "markdownDescription": "How to wrap object literals when they could fit on one line or span multiple lines.\n\nBy default, formats objects as multi-line if there is a newline prior to the first property.\nAuthors can use this heuristic to contextually improve readability, though it has some downsides.\n\n- Default: `\"preserve\"`" }, "printWidth": { - "description": "The line length that the printer will wrap on. (Default: `100`)", + "description": "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- Default: `100`\n- Overrides `.editorconfig.max_line_length`", "format": "uint16", - "markdownDescription": "The line length that the printer will wrap on. (Default: `100`)", + "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- Default: `100`\n- Overrides `.editorconfig.max_line_length`", "minimum": 0.0, "type": [ "integer", @@ -379,37 +373,37 @@ expression: json "type": "null" } ], - "description": "Change when properties in objects are quoted. (Default: `\"as-needed\"`)", - "markdownDescription": "Change when properties in objects are quoted. (Default: `\"as-needed\"`)" + "description": "Change when properties in objects are quoted.\n\n- Default: `\"as-needed\"`", + "markdownDescription": "Change when properties in objects are quoted.\n\n- Default: `\"as-needed\"`" }, "semi": { - "description": "Print semicolons at the ends of statements. (Default: `true`)", - "markdownDescription": "Print semicolons at the ends of statements. (Default: `true`)", + "description": "Print semicolons at the ends of statements.\n\n- Default: `true`", + "markdownDescription": "Print semicolons at the ends of statements.\n\n- Default: `true`", "type": [ "boolean", "null" ] }, "singleAttributePerLine": { - "description": "Put each attribute on a new line in JSX. (Default: `false`)", - "markdownDescription": "Put each attribute on a new line in JSX. (Default: `false`)", + "description": "Enforce single attribute per line in HTML, Vue, and JSX.\n\n- Default: `false`", + "markdownDescription": "Enforce single attribute per line in HTML, Vue, and JSX.\n\n- Default: `false`", "type": [ "boolean", "null" ] }, "singleQuote": { - "description": "Use single quotes instead of double quotes. (Default: `false`)", - "markdownDescription": "Use single quotes instead of double quotes. (Default: `false`)", + "description": "Use single quotes instead of double quotes.\n\nFor JSX, you can set the `jsxSingleQuote` option.\n\n- Default: `false`", + "markdownDescription": "Use single quotes instead of double quotes.\n\nFor JSX, you can set the `jsxSingleQuote` option.\n\n- Default: `false`", "type": [ "boolean", "null" ] }, "tabWidth": { - "description": "Number of spaces per indentation level. (Default: `2`)", + "description": "Specify the number of spaces per indentation-level.\n\n- Default: `2`\n- Overrides `.editorconfig.indent_size`", "format": "uint8", - "markdownDescription": "Number of spaces per indentation level. (Default: `2`)", + "markdownDescription": "Specify the number of spaces per indentation-level.\n\n- Default: `2`\n- Overrides `.editorconfig.indent_size`", "minimum": 0.0, "type": [ "integer", @@ -425,12 +419,12 @@ expression: json "type": "null" } ], - "description": "Print trailing commas wherever possible. (Default: `\"all\"`)", - "markdownDescription": "Print trailing commas wherever possible. (Default: `\"all\"`)" + "description": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures.\n\nA single-line array, for example, never gets trailing commas.\n\n- Default: `\"all\"`", + "markdownDescription": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures.\n\nA single-line array, for example, never gets trailing commas.\n\n- Default: `\"all\"`" }, "useTabs": { - "description": "Use tabs for indentation or spaces. (Default: `false`)", - "markdownDescription": "Use tabs for indentation or spaces. (Default: `false`)", + "description": "Indent lines with tabs instead of spaces.\n\n- Default: `false`\n- Overrides `.editorconfig.indent_style`", + "markdownDescription": "Indent lines with tabs instead of spaces.\n\n- Default: `false`\n- Overrides `.editorconfig.indent_style`", "type": [ "boolean", "null" diff --git a/tasks/website_formatter/src/snapshots/schema_markdown.snap b/tasks/website_formatter/src/snapshots/schema_markdown.snap index a43d0890d7a9c..fb75586458e92 100644 --- a/tasks/website_formatter/src/snapshots/schema_markdown.snap +++ b/tasks/website_formatter/src/snapshots/schema_markdown.snap @@ -8,9 +8,7 @@ search: false # Configuration options for the Oxfmt. -Most options are the same as Prettier's options. -See also - +Most options are the same as Prettier's options, but not all of them. In addition, some options are our own extensions. @@ -19,7 +17,9 @@ In addition, some options are our own extensions. type: `"always" | "avoid" | null` -Include parentheses around a sole arrow function parameter. (Default: `"always"`) +Include parentheses around a sole arrow function parameter. + +- Default: `"always"` ## bracketSameLine @@ -27,8 +27,10 @@ Include parentheses around a sole arrow function parameter. (Default: `"always"` type: `boolean | null` -Put the `>` of a multi-line JSX element at the end of the last line -instead of being alone on the next line. (Default: `false`) +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). + +- Default: `false` ## bracketSpacing @@ -36,7 +38,9 @@ instead of being alone on the next line. (Default: `false`) type: `boolean | null` -Print spaces between brackets in object literals. (Default: `true`) +Print spaces between brackets in object literals. + +- Default: `true` ## embeddedLanguageFormatting @@ -44,8 +48,12 @@ Print spaces between brackets in object literals. (Default: `true`) type: `"auto" | "off" | null` -Control whether to format embedded parts in the file. -e.g. JS-in-Vue, CSS-in-JS, etc. (Default: `"auto"`) +Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file. + +NOTE: XXX-in-JS support is incomplete. +JS-in-XXX is fully supported but still be handled by Prettier. + +- Default: `"auto"` ## endOfLine @@ -53,7 +61,12 @@ e.g. JS-in-Vue, CSS-in-JS, etc. (Default: `"auto"`) type: `"lf" | "crlf" | "cr" | null` -Which end of line characters to apply. (Default: `"lf"`) +Which end of line characters to apply. + +NOTE: `"auto"` is not supported. + +- Default: `"lf"` +- Overrides `.editorconfig.end_of_line` ## experimentalSortImports @@ -61,7 +74,12 @@ Which end of line characters to apply. (Default: `"lf"`) type: `object | null` -Experimental: Sort import statements. (Default: disabled) +Experimental: 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. + +- Default: Disabled ### experimentalSortImports.groups @@ -69,9 +87,58 @@ Experimental: Sort import statements. (Default: disabled) type: `array | null` -Custom groups configuration for organizing imports. -Each array element represents a group, and multiple group names in the same array are treated as one. -Accepts both `string` and `string[]` as group elements. +Specifies a list of predefined 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. + +Within a given group, members will be sorted according to the type, order, ignoreCase, etc. options. + +Individual groups can be combined together by placing them in an array. +The order of groups in that array does not matter. +All members of the groups in the array will be sorted together as if they were part of a single group. + +Predefined groups are characterized by a single selector and potentially multiple modifiers. You may enter modifiers in any order, but the selector must always come at the end. + +The list of selectors is sorted from most to least important: +- `type` — TypeScript 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. + +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. +- `multiline` — Imports on multiple lines. +- `singleline` — Imports on a single line. + +See also for details. +NOTE: `customGroups` is not implemented yet. + +- Default: See below +```json +[ +"type-import", +["value-builtin", "value-external"], +"type-internal", +"value-internal", +["type-parent", "type-sibling", "type-index"], +["value-parent", "value-sibling", "value-index"], +"unknown", +] +``` #### experimentalSortImports.groups[n] @@ -87,7 +154,9 @@ type: `string[]` type: `boolean | null` -Ignore case when sorting. (Default: `true`) +Specifies whether sorting should be case-sensitive. + +- Default: `true` ### experimentalSortImports.internalPattern @@ -95,7 +164,11 @@ Ignore case when sorting. (Default: `true`) type: `string[]` -Glob patterns to identify internal imports. +Specifies a prefix for identifying internal imports. + +This is useful for distinguishing your own modules from external dependencies. + +- Default: `["~/", "@/"]` ### experimentalSortImports.newlinesBetween @@ -103,7 +176,11 @@ Glob patterns to identify internal imports. type: `boolean | null` -Add newlines between import groups. (Default: `true`) +Specifies whether to add newlines between groups. + +When `false`, no newlines are added between groups. + +- Default: `true` ### experimentalSortImports.order @@ -111,7 +188,9 @@ Add newlines between import groups. (Default: `true`) type: `"asc" | "desc" | null` -Sort order. (Default: `"asc"`) +Specifies whether to sort items in ascending or descending order. + +- Default: `"asc"` ### experimentalSortImports.partitionByComment @@ -119,7 +198,18 @@ Sort order. (Default: `"asc"`) type: `boolean | null` -Partition imports by comments. (Default: `false`) +Enables the use of comments to separate imports into logical groups. + +When `true`, all comments will be treated as delimiters, creating partitions. + +```js +import { b1, b2 } from 'b' +// PARTITION +import { a } from 'a' +import { c } from 'c' +``` + +- Default: `false` ### experimentalSortImports.partitionByNewline @@ -127,7 +217,19 @@ Partition imports by comments. (Default: `false`) type: `boolean | null` -Partition imports by newlines. (Default: `false`) +Enables the empty line 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. + +```js +import { b1, b2 } from 'b' + +import { a } from 'a' +import { c } from 'c' +``` + +- Default: `false` ### experimentalSortImports.sortSideEffects @@ -135,7 +237,11 @@ Partition imports by newlines. (Default: `false`) type: `boolean | null` -Sort side-effect imports. (Default: `false`) +Specifies whether side effect imports should be sorted. + +By default, sorting side-effect imports is disabled for security reasons. + +- Default: `false` ## experimentalSortPackageJson @@ -143,7 +249,13 @@ Sort side-effect imports. (Default: `false`) type: `object | boolean | null` -Experimental: Sort `package.json` keys. (Default: `true`) +Experimental: 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. + +- Default: `true` ### experimentalSortPackageJson.sortScripts @@ -151,7 +263,9 @@ Experimental: Sort `package.json` keys. (Default: `true`) type: `boolean | null` -Sort the `scripts` field alphabetically. (Default: `false`) +Sort the `scripts` field alphabetically. + +- Default: `false` ## experimentalTailwindcss @@ -159,14 +273,13 @@ Sort the `scripts` field alphabetically. (Default: `false`) type: `object | null` -Experimental: Sort Tailwind CSS classes in string literals. - -When enabled, `Oxfmt` sorts Tailwind CSS classes using the same algorithm as -[`prettier-plugin-tailwindcss`](https://github.com/tailwindlabs/prettier-plugin-tailwindcss). +Experimental: Sort Tailwind CSS classes. -See [`TailwindcssConfig`] for available options. +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. -(Default: disabled) +- Default: Disabled ### experimentalTailwindcss.attributes @@ -174,13 +287,12 @@ See [`TailwindcssConfig`] for available options. type: `string[]` -List of attributes that contain Tailwind CSS classes. - -Note: Regex patterns are not yet supported. +List of attribute prefixes that contain Tailwind CSS classes. -Example: `["myClassProp", ":class"]` +NOTE: Regex patterns are not yet supported. -Default: `["class", "className"]` +- Default: `["class", "className"]` +- Example: `["myClassProp", ":class"]` ### experimentalTailwindcss.config @@ -190,9 +302,9 @@ type: `string | null` Path to your Tailwind CSS configuration file (v3). -Note: Paths are resolved relative to the Oxfmt configuration file. +NOTE: Paths are resolved relative to the Oxfmt configuration file. -Default: `"./tailwind.config.js"` +- Default: Automatically find `"tailwind.config.js"` ### experimentalTailwindcss.functions @@ -200,13 +312,12 @@ Default: `"./tailwind.config.js"` type: `string[]` -List of custom function names that contain Tailwind CSS classes. +List of custom function name prefixes that contain Tailwind CSS classes. -Note: Regex patterns are not yet supported. +NOTE: Regex patterns are not yet supported. -Example: `["clsx", "cn", "cva", "tw"]` - -Default: `[]` +- Default: `[]` +- Example: `["clsx", "cn", "cva", "tw"]` ### experimentalTailwindcss.preserveDuplicates @@ -216,7 +327,7 @@ type: `boolean | null` Preserve duplicate classes. -Default: `false` +- Default: `false` ### experimentalTailwindcss.preserveWhitespace @@ -226,7 +337,7 @@ type: `boolean | null` Preserve whitespace around classes. -Default: `false` +- Default: `false` ### experimentalTailwindcss.stylesheet @@ -236,9 +347,9 @@ type: `string | null` Path to your Tailwind CSS stylesheet (v4). -Note: Paths are resolved relative to the Oxfmt configuration file. +NOTE: Paths are resolved relative to the Oxfmt configuration file. -Example: `"./src/app.css"` +- Default: Installed Tailwind CSS's `theme.css` ## ignorePatterns @@ -246,7 +357,10 @@ Example: `"./src/app.css"` type: `string[]` -Ignore files matching these glob patterns. Current working directory is used as the root. +Ignore files matching these glob patterns. +Patterns are based on the location of the Oxfmt configuration file. + +- Default: `[]` ## insertFinalNewline @@ -254,7 +368,10 @@ Ignore files matching these glob patterns. Current working directory is used as type: `boolean | null` -Whether to insert a final newline at the end of the file. (Default: `true`) +Whether to insert a final newline at the end of the file. + +- Default: `true` +- Overrides `.editorconfig.insert_final_newline` ## jsxSingleQuote @@ -262,7 +379,9 @@ Whether to insert a final newline at the end of the file. (Default: `true`) type: `boolean | null` -Use single quotes instead of double quotes in JSX. (Default: `false`) +Use single quotes instead of double quotes in JSX. + +- Default: `false` ## objectWrap @@ -270,7 +389,12 @@ Use single quotes instead of double quotes in JSX. (Default: `false`) type: `"preserve" | "collapse" | null` -How to wrap object literals when they could fit on one line or span multiple lines. (Default: `"preserve"`) +How to wrap object literals when they could fit on one line or span multiple lines. + +By default, formats objects as multi-line if there is a newline prior to the first property. +Authors can use this heuristic to contextually improve readability, though it has some downsides. + +- Default: `"preserve"` ## printWidth @@ -278,7 +402,12 @@ How to wrap object literals when they could fit on one line or span multiple lin type: `integer | null` -The line length that the printer will wrap on. (Default: `100`) +Specify the line length that the printer will wrap on. + +If you don’t want line wrapping when formatting Markdown, you can set the `proseWrap` option to disable it. + +- Default: `100` +- Overrides `.editorconfig.max_line_length` ## quoteProps @@ -286,7 +415,9 @@ The line length that the printer will wrap on. (Default: `100`) type: `"as-needed" | "consistent" | "preserve" | null` -Change when properties in objects are quoted. (Default: `"as-needed"`) +Change when properties in objects are quoted. + +- Default: `"as-needed"` ## semi @@ -294,7 +425,9 @@ Change when properties in objects are quoted. (Default: `"as-needed"`) type: `boolean | null` -Print semicolons at the ends of statements. (Default: `true`) +Print semicolons at the ends of statements. + +- Default: `true` ## singleAttributePerLine @@ -302,7 +435,9 @@ Print semicolons at the ends of statements. (Default: `true`) type: `boolean | null` -Put each attribute on a new line in JSX. (Default: `false`) +Enforce single attribute per line in HTML, Vue, and JSX. + +- Default: `false` ## singleQuote @@ -310,7 +445,11 @@ Put each attribute on a new line in JSX. (Default: `false`) type: `boolean | null` -Use single quotes instead of double quotes. (Default: `false`) +Use single quotes instead of double quotes. + +For JSX, you can set the `jsxSingleQuote` option. + +- Default: `false` ## tabWidth @@ -318,7 +457,10 @@ Use single quotes instead of double quotes. (Default: `false`) type: `integer | null` -Number of spaces per indentation level. (Default: `2`) +Specify the number of spaces per indentation-level. + +- Default: `2` +- Overrides `.editorconfig.indent_size` ## trailingComma @@ -326,7 +468,11 @@ Number of spaces per indentation level. (Default: `2`) type: `"all" | "es5" | "none" | null` -Print trailing commas wherever possible. (Default: `"all"`) +Print trailing commas wherever possible in multi-line comma-separated syntactic structures. + +A single-line array, for example, never gets trailing commas. + +- Default: `"all"` ## useTabs @@ -334,4 +480,7 @@ Print trailing commas wherever possible. (Default: `"all"`) type: `boolean | null` -Use tabs for indentation or spaces. (Default: `false`) +Indent lines with tabs instead of spaces. + +- Default: `false` +- Overrides `.editorconfig.indent_style`