diff --git a/.vitepress/data/rules.json b/.vitepress/data/rules.json
index ba192120557..5d6b0e50515 100644
--- a/.vitepress/data/rules.json
+++ b/.vitepress/data/rules.json
@@ -5651,6 +5651,15 @@
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-modern-math-apis.html"
},
+ {
+ "scope": "unicorn",
+ "value": "prefer-module",
+ "category": "restriction",
+ "type_aware": false,
+ "fix": "pending",
+ "default": false,
+ "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-module.html"
+ },
{
"scope": "unicorn",
"value": "prefer-native-coercion-functions",
@@ -5831,6 +5840,15 @@
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-structured-clone.html"
},
+ {
+ "scope": "unicorn",
+ "value": "prefer-ternary",
+ "category": "style",
+ "type_aware": false,
+ "fix": "pending",
+ "default": false,
+ "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-ternary.html"
+ },
{
"scope": "unicorn",
"value": "prefer-top-level-await",
diff --git a/src/docs/guide/usage/formatter/generated-config.md b/src/docs/guide/usage/formatter/generated-config.md
index 652fa65d84d..dd47c23bfee 100644
--- a/src/docs/guide/usage/formatter/generated-config.md
+++ b/src/docs/guide/usage/formatter/generated-config.md
@@ -53,18 +53,232 @@ NOTE: `"auto"` is not supported.
- Default: `"lf"`
- Overrides `.editorconfig.end_of_line`
-## experimentalSortImports
+## htmlWhitespaceSensitivity
+
+type: `"css" | "strict" | "ignore"`
+
+Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.
+
+- Default: `"css"`
+
+## ignorePatterns
+
+type: `string[]`
+
+Ignore files matching these glob patterns.
+Patterns are based on the location of the Oxfmt configuration file.
+
+- Default: `[]`
+
+## insertFinalNewline
+
+type: `boolean`
+
+Whether to insert a final newline at the end of the file.
+
+- Default: `true`
+- Overrides `.editorconfig.insert_final_newline`
+
+## jsxSingleQuote
+
+type: `boolean`
+
+Use single quotes instead of double quotes in JSX.
+
+- Default: `false`
+
+## objectWrap
+
+type: `"preserve" | "collapse"`
+
+How to wrap object literals when they could fit on one line or span multiple lines.
+
+By default, formats objects as multi-line if there is a newline prior to the first property.
+Authors can use this heuristic to contextually improve readability, though it has some downsides.
+
+- Default: `"preserve"`
+
+## overrides
+
+type: `array`
+
+File-specific overrides.
+When a file matches multiple overrides, the later override takes precedence (array order matters).
+
+- Default: `[]`
+
+### overrides[n]
+
+type: `object`
+
+#### overrides[n].excludeFiles
+
+type: `string[]`
+
+Glob patterns to exclude from this override.
+
+#### overrides[n].files
+
+type: `string[]`
+
+Glob patterns to match files for this override.
+All patterns are relative to the Oxfmt configuration file.
+
+#### overrides[n].options
+
+type: `object`
+
+##### overrides[n].options.arrowParens
+
+type: `"always" | "avoid"`
+
+Include parentheses around a sole arrow function parameter.
+
+- Default: `"always"`
+
+##### overrides[n].options.bracketSameLine
+
+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).
+
+- Default: `false`
+
+##### overrides[n].options.bracketSpacing
+
+type: `boolean`
+
+Print spaces between brackets in object literals.
+
+- Default: `true`
+
+##### overrides[n].options.embeddedLanguageFormatting
+
+type: `"auto" | "off"`
+
+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.
+
+- Default: `"auto"`
+
+##### overrides[n].options.endOfLine
+
+type: `"lf" | "crlf" | "cr"`
+
+Which end of line characters to apply.
+
+NOTE: `"auto"` is not supported.
+
+- Default: `"lf"`
+- Overrides `.editorconfig.end_of_line`
+
+##### overrides[n].options.htmlWhitespaceSensitivity
+
+type: `"css" | "strict" | "ignore"`
+
+Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.
+
+- Default: `"css"`
+
+##### overrides[n].options.insertFinalNewline
+
+type: `boolean`
+
+Whether to insert a final newline at the end of the file.
+
+- Default: `true`
+- Overrides `.editorconfig.insert_final_newline`
+
+##### overrides[n].options.jsxSingleQuote
+
+type: `boolean`
+
+Use single quotes instead of double quotes in JSX.
+
+- Default: `false`
+
+##### overrides[n].options.objectWrap
+
+type: `"preserve" | "collapse"`
+
+How to wrap object literals when they could fit on one line or span multiple lines.
+
+By default, formats objects as multi-line if there is a newline prior to the first property.
+Authors can use this heuristic to contextually improve readability, though it has some downsides.
+
+- Default: `"preserve"`
+
+##### overrides[n].options.printWidth
+
+type: `integer`
+
+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`
+
+##### overrides[n].options.proseWrap
+
+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".
+
+- Default: `"preserve"`
+
+##### overrides[n].options.quoteProps
+
+type: `"as-needed" | "consistent" | "preserve"`
+
+Change when properties in objects are quoted.
+
+- Default: `"as-needed"`
+
+##### overrides[n].options.semi
+
+type: `boolean`
+
+Print semicolons at the ends of statements.
+
+- Default: `true`
+
+##### overrides[n].options.singleAttributePerLine
+
+type: `boolean`
+
+Enforce single attribute per line in HTML, Vue, and JSX.
+
+- Default: `false`
+
+##### overrides[n].options.singleQuote
+
+type: `boolean`
+
+Use single quotes instead of double quotes.
+
+For JSX, you can set the `jsxSingleQuote` option.
+
+- Default: `false`
+
+##### overrides[n].options.sortImports
type: `object`
-Experimental: Sort import statements.
+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.customGroups
+###### overrides[n].options.sortImports.customGroups
type: `array`
@@ -81,11 +295,11 @@ all conditions must be met for an import to match the custom group (AND logic).
- Default: `[]`
-#### experimentalSortImports.customGroups[n]
+####### overrides[n].options.sortImports.customGroups[n]
type: `object`
-##### experimentalSortImports.customGroups[n].elementNamePattern
+######## overrides[n].options.sortImports.customGroups[n].elementNamePattern
type: `string[]`
@@ -93,7 +307,7 @@ default: `[]`
List of glob patterns to match import sources for this group.
-##### experimentalSortImports.customGroups[n].groupName
+######## overrides[n].options.sortImports.customGroups[n].groupName
type: `string`
@@ -101,7 +315,7 @@ default: `""`
Name of the custom group, used in the `groups` option.
-##### experimentalSortImports.customGroups[n].modifiers
+######## overrides[n].options.sortImports.customGroups[n].modifiers
type: `string[]`
@@ -110,7 +324,7 @@ All specified modifiers must be present (AND logic).
Possible values: `"side_effect"`, `"type"`, `"value"`, `"default"`, `"wildcard"`, `"named"`
-##### experimentalSortImports.customGroups[n].selector
+######## overrides[n].options.sortImports.customGroups[n].selector
type: `string`
@@ -119,7 +333,7 @@ Selector to match the import kind.
Possible values: `"type"`, `"side_effect_style"`, `"side_effect"`, `"style"`, `"index"`,
`"sibling"`, `"parent"`, `"subpath"`, `"internal"`, `"builtin"`, `"external"`, `"import"`
-### experimentalSortImports.groups
+###### overrides[n].options.sortImports.groups
type: `array`
@@ -170,11 +384,11 @@ 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.
-#### experimentalSortImports.groups[n]
+####### overrides[n].options.sortImports.groups[n]
type: `array | string`
-### experimentalSortImports.ignoreCase
+###### overrides[n].options.sortImports.ignoreCase
type: `boolean`
@@ -182,7 +396,7 @@ Specifies whether sorting should be case-sensitive.
- Default: `true`
-### experimentalSortImports.internalPattern
+###### overrides[n].options.sortImports.internalPattern
type: `string[]`
@@ -192,7 +406,7 @@ This is useful for distinguishing your own modules from external dependencies.
- Default: `["~/", "@/"]`
-### experimentalSortImports.newlinesBetween
+###### overrides[n].options.sortImports.newlinesBetween
type: `boolean`
@@ -202,7 +416,7 @@ When `false`, no newlines are added between groups.
- Default: `true`
-### experimentalSortImports.order
+###### overrides[n].options.sortImports.order
type: `"asc" | "desc"`
@@ -210,7 +424,7 @@ Specifies whether to sort items in ascending or descending order.
- Default: `"asc"`
-### experimentalSortImports.partitionByComment
+###### overrides[n].options.sortImports.partitionByComment
type: `boolean`
@@ -227,7 +441,7 @@ import { c } from "c";
- Default: `false`
-### experimentalSortImports.partitionByNewline
+###### overrides[n].options.sortImports.partitionByNewline
type: `boolean`
@@ -245,7 +459,7 @@ import { c } from "c";
- Default: `false`
-### experimentalSortImports.sortSideEffects
+###### overrides[n].options.sortImports.sortSideEffects
type: `boolean`
@@ -255,11 +469,11 @@ By default, sorting side-effect imports is disabled for security reasons.
- Default: `false`
-## experimentalSortPackageJson
+##### overrides[n].options.sortPackageJson
type: `object | boolean`
-Experimental: Sort `package.json` keys.
+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.
@@ -267,7 +481,7 @@ For details, see each field's documentation.
- Default: `true`
-### experimentalSortPackageJson.sortScripts
+###### overrides[n].options.sortPackageJson.sortScripts
type: `boolean`
@@ -275,11 +489,11 @@ Sort the `scripts` field alphabetically.
- Default: `false`
-## experimentalTailwindcss
+##### overrides[n].options.sortTailwindcss
type: `object`
-Experimental: Sort Tailwind CSS classes.
+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`).
@@ -287,7 +501,7 @@ For details, see each field's documentation.
- Default: Disabled
-### experimentalTailwindcss.attributes
+###### overrides[n].options.sortTailwindcss.attributes
type: `string[]`
@@ -298,7 +512,7 @@ NOTE: Regex patterns are not yet supported.
- Default: `[]`
- Example: `["myClassProp", ":class"]`
-### experimentalTailwindcss.config
+###### overrides[n].options.sortTailwindcss.config
type: `string`
@@ -308,7 +522,7 @@ NOTE: Paths are resolved relative to the Oxfmt configuration file.
- Default: Automatically find `"tailwind.config.js"`
-### experimentalTailwindcss.functions
+###### overrides[n].options.sortTailwindcss.functions
type: `string[]`
@@ -319,7 +533,7 @@ NOTE: Regex patterns are not yet supported.
- Default: `[]`
- Example: `["clsx", "cn", "cva", "tw"]`
-### experimentalTailwindcss.preserveDuplicates
+###### overrides[n].options.sortTailwindcss.preserveDuplicates
type: `boolean`
@@ -327,7 +541,7 @@ Preserve duplicate classes.
- Default: `false`
-### experimentalTailwindcss.preserveWhitespace
+###### overrides[n].options.sortTailwindcss.preserveWhitespace
type: `boolean`
@@ -335,7 +549,7 @@ Preserve whitespace around classes.
- Default: `false`
-### experimentalTailwindcss.stylesheet
+###### overrides[n].options.sortTailwindcss.stylesheet
type: `string`
@@ -345,139 +559,111 @@ NOTE: Paths are resolved relative to the Oxfmt configuration file.
- Default: Installed Tailwind CSS's `theme.css`
-## htmlWhitespaceSensitivity
-
-type: `"css" | "strict" | "ignore"`
-
-Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.
-
-- Default: `"css"`
+##### overrides[n].options.tabWidth
-## ignorePatterns
+type: `integer`
-type: `string[]`
+Specify the number of spaces per indentation-level.
-Ignore files matching these glob patterns.
-Patterns are based on the location of the Oxfmt configuration file.
+- Default: `2`
+- Overrides `.editorconfig.indent_size`
-- Default: `[]`
+##### overrides[n].options.trailingComma
-## insertFinalNewline
+type: `"all" | "es5" | "none"`
-type: `boolean`
+Print trailing commas wherever possible in multi-line comma-separated syntactic structures.
-Whether to insert a final newline at the end of the file.
+A single-line array, for example, never gets trailing commas.
-- Default: `true`
-- Overrides `.editorconfig.insert_final_newline`
+- Default: `"all"`
-## jsxSingleQuote
+##### overrides[n].options.useTabs
type: `boolean`
-Use single quotes instead of double quotes in JSX.
-
-- Default: `false`
-
-## objectWrap
-
-type: `"preserve" | "collapse"`
-
-How to wrap object literals when they could fit on one line or span multiple lines.
-
-By default, formats objects as multi-line if there is a newline prior to the first property.
-Authors can use this heuristic to contextually improve readability, though it has some downsides.
-
-- Default: `"preserve"`
-
-## overrides
-
-type: `array`
-
-File-specific overrides.
-When a file matches multiple overrides, the later override takes precedence (array order matters).
+Indent lines with tabs instead of spaces.
-- Default: `[]`
+- Default: `false`
+- Overrides `.editorconfig.indent_style`
-### overrides[n]
+##### overrides[n].options.vueIndentScriptAndStyle
-type: `object`
+type: `boolean`
-#### overrides[n].excludeFiles
+Whether or not to indent the code inside `
+
+
+
+### What it does
+
+Prefer JavaScript modules (ESM) over CommonJS.
+
+### Why is this bad?
+
+CommonJS globals and patterns (`require`, `module`, `exports`, `__filename`, `__dirname`)
+make code harder to migrate and can block ESM-only features.
+
+### Examples
+
+Examples of **incorrect** code for this rule:
+
+```js
+"use strict";
+const foo = require("foo");
+module.exports = foo;
+```
+
+Examples of **correct** code for this rule:
+
+```js
+import foo from "foo";
+export default foo;
+```
+
+## How to use
+
+To **enable** this rule using the config file or in the CLI, you can use:
+
+::: code-group
+
+```json [Config (.oxlintrc.json)]
+{
+ "rules": {
+ "unicorn/prefer-module": "error"
+ }
+}
+```
+
+```bash [CLI]
+oxlint --deny unicorn/prefer-module
+```
+
+:::
+
+## References
+
+- Rule Source
diff --git a/src/docs/guide/usage/linter/rules/unicorn/prefer-ternary.md b/src/docs/guide/usage/linter/rules/unicorn/prefer-ternary.md
new file mode 100644
index 00000000000..be5f8bcbfda
--- /dev/null
+++ b/src/docs/guide/usage/linter/rules/unicorn/prefer-ternary.md
@@ -0,0 +1,79 @@
+---
+title: "unicorn/prefer-ternary"
+category: "Style"
+default: false
+type_aware: false
+fix: "pending"
+---
+
+
+
+
+
+
+
+### What it does
+
+Prefers ternary expressions over simple `if`/`else` statements.
+
+### Why is this bad?
+
+Simple `if`/`else` branches for the same operation are often shorter and
+clearer when expressed as a ternary.
+
+### Examples
+
+Examples of **incorrect** code for this rule:
+
+```js
+if (test) {
+ return a;
+} else {
+ return b;
+}
+```
+
+Examples of **correct** code for this rule:
+
+```js
+return test ? a : b;
+```
+
+## Configuration
+
+This rule accepts one of the following string values:
+
+### `"always"`
+
+Always enforce ternary usage when the branches can be safely merged.
+
+### `"only-single-line"`
+
+Only enforce ternary usage when the condition and both branches are single-line.
+
+## How to use
+
+To **enable** this rule using the config file or in the CLI, you can use:
+
+::: code-group
+
+```json [Config (.oxlintrc.json)]
+{
+ "rules": {
+ "unicorn/prefer-ternary": "error"
+ }
+}
+```
+
+```bash [CLI]
+oxlint --deny unicorn/prefer-ternary
+```
+
+:::
+
+## References
+
+- Rule Source
diff --git a/src/docs/guide/usage/linter/rules/version.data.js b/src/docs/guide/usage/linter/rules/version.data.js
index 34d374d978a..c01c0faae6b 100644
--- a/src/docs/guide/usage/linter/rules/version.data.js
+++ b/src/docs/guide/usage/linter/rules/version.data.js
@@ -1,5 +1,5 @@
export default {
load() {
- return "82ca5c3dfa0e389a099666107a669e95b54587ce";
+ return "89c28356c7a2c6578059a434c92c534093a188dc";
},
};
diff --git a/src/docs/guide/usage/rule-count.data.js b/src/docs/guide/usage/rule-count.data.js
index 432ae19e40f..1077bf51a4e 100644
--- a/src/docs/guide/usage/rule-count.data.js
+++ b/src/docs/guide/usage/rule-count.data.js
@@ -1,5 +1,5 @@
export default {
load() {
- return 693;
+ return 695;
},
};