Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 41 additions & 5 deletions .vitepress/data/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@
"value": "no-useless-computed-key",
"category": "style",
"type_aware": false,
"fix": "pending",
"fix": "conditional_fix",
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-computed-key.html"
},
Expand Down Expand Up @@ -4601,7 +4601,7 @@
{
"scope": "typescript",
"value": "prefer-find",
"category": "nursery",
"category": "style",
"type_aware": true,
"fix": "none",
"default": false,
Expand Down Expand Up @@ -4682,7 +4682,7 @@
{
"scope": "typescript",
"value": "prefer-readonly",
"category": "nursery",
"category": "style",
"type_aware": true,
"fix": "none",
"default": false,
Expand All @@ -4709,7 +4709,7 @@
{
"scope": "typescript",
"value": "prefer-regexp-exec",
"category": "nursery",
"category": "style",
"type_aware": true,
"fix": "none",
"default": false,
Expand All @@ -4727,7 +4727,7 @@
{
"scope": "typescript",
"value": "prefer-string-starts-ends-with",
"category": "nursery",
"category": "style",
"type_aware": true,
"fix": "none",
"default": true,
Expand Down Expand Up @@ -6056,6 +6056,15 @@
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-importing-vitest-globals.html"
},
{
"scope": "vitest",
"value": "prefer-called-exactly-once-with",
"category": "style",
"type_aware": false,
"fix": "fixable_dangerous_fix",
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-called-exactly-once-with.html"
},
{
"scope": "vitest",
"value": "prefer-called-once",
Expand Down Expand Up @@ -6137,6 +6146,15 @@
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-to-be-truthy.html"
},
{
"scope": "vitest",
"value": "require-awaited-expect-poll",
"category": "correctness",
"type_aware": false,
"fix": "none",
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-awaited-expect-poll.html"
},
{
"scope": "vitest",
"value": "require-local-test-context-for-concurrent-snapshots",
Expand All @@ -6146,6 +6164,24 @@
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-local-test-context-for-concurrent-snapshots.html"
},
{
"scope": "vitest",
"value": "require-mock-type-parameters",
"category": "correctness",
"type_aware": false,
"fix": "none",
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-mock-type-parameters.html"
},
{
"scope": "vitest",
"value": "require-test-timeout",
"category": "restriction",
"type_aware": false,
"fix": "none",
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-test-timeout.html"
},
{
"scope": "vitest",
"value": "warn-todo",
Expand Down
24 changes: 16 additions & 8 deletions src/docs/guide/usage/formatter/generated-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ Whether to insert a final newline at the end of the file.

## jsdoc

type: `object`
type: `object | boolean`

Enable JSDoc comment formatting.

When enabled, JSDoc comments are normalized and reformatted:
tag aliases are canonicalized, descriptions are capitalized,
long lines are wrapped, and short comments are collapsed to single-line.

Pass an object (`jsdoc: {}`) to enable with defaults, or omit to disable.
Pass `true` or an object to enable with defaults, or omit/set `false` to disable.

- Default: Disabled

Expand Down Expand Up @@ -302,15 +302,15 @@ Whether to insert a final newline at the end of the file.

##### overrides[n].options.jsdoc

type: `object`
type: `object | boolean`

Enable JSDoc comment formatting.

When enabled, JSDoc comments are normalized and reformatted:
tag aliases are canonicalized, descriptions are capitalized,
long lines are wrapped, and short comments are collapsed to single-line.

Pass an object (`jsdoc: {}`) to enable with defaults, or omit to disable.
Pass `true` or an object to enable with defaults, or omit/set `false` to disable.

- Default: Disabled

Expand Down Expand Up @@ -487,13 +487,15 @@ For JSX, you can set the `jsxSingleQuote` option.

##### overrides[n].options.sortImports

type: `object`
type: `object | boolean`

Sort import statements.

Using the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
For details, see each field's documentation.

Pass `true` or an object to enable with defaults, or omit/set `false` to disable.

- Default: Disabled

###### overrides[n].options.sortImports.customGroups
Expand Down Expand Up @@ -713,14 +715,16 @@ Sort the `scripts` field alphabetically.

##### overrides[n].options.sortTailwindcss

type: `object`
type: `object | boolean`

Sort Tailwind CSS classes.

Using the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).
Option names omit the `tailwind` prefix used in the original plugin (e.g., `config` instead of `tailwindConfig`).
For details, see each field's documentation.

Pass `true` or an object to enable with defaults, or omit/set `false` to disable.

- Default: Disabled

###### overrides[n].options.sortTailwindcss.attributes
Expand Down Expand Up @@ -876,13 +880,15 @@ For JSX, you can set the `jsxSingleQuote` option.

## sortImports

type: `object`
type: `object | boolean`

Sort import statements.

Using the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
For details, see each field's documentation.

Pass `true` or an object to enable with defaults, or omit/set `false` to disable.

- Default: Disabled

### sortImports.customGroups
Expand Down Expand Up @@ -1102,14 +1108,16 @@ Sort the `scripts` field alphabetically.

## sortTailwindcss

type: `object`
type: `object | boolean`

Sort Tailwind CSS classes.

Using the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).
Option names omit the `tailwind` prefix used in the original plugin (e.g., `config` instead of `tailwindConfig`).
For details, see each field's documentation.

Pass `true` or an object to enable with defaults, or omit/set `false` to disable.

- Default: Disabled

### sortTailwindcss.attributes
Expand Down
19 changes: 19 additions & 0 deletions src/docs/guide/usage/linter/generated-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,25 @@ Basic usage with a local plugin path.
}
```

Basic usage with a TypeScript plugin and a local plugin path.

TypeScript plugin files are supported in the following environments:

- Deno and Bun: TypeScript files are supported natively.
- Node.js >=22.18.0 and Node.js ^20.19.0: TypeScript files are supported natively with built-in
type-stripping enabled by default.

For older Node.js versions, TypeScript plugins are not supported. Please use JavaScript plugins or upgrade your Node version.

```json
{
"jsPlugins": ["./custom-plugin.ts"],
"rules": {
"custom/rule-name": "warn"
}
}
```

Using a built-in Rust plugin alongside a JS plugin with the same name
by giving the JS plugin an alias.

Expand Down
14 changes: 12 additions & 2 deletions src/docs/guide/usage/linter/rules/eslint/no-unused-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Fine-grained auto-fix controls for `no-unused-vars`.

#### fix.imports

type: `"off" | "suggestion" | "fix"`
type: `"off" | "suggestion" | "fix" | "safe-fix"`

##### `"off"`

Expand All @@ -313,9 +313,14 @@ Emit suggestion-style fixes (current behavior).

Emit fix-style fixes.

##### `"safe-fix"`

Like `Fix`, but does not mark them as dangerous.
Only applicable for imports, unavailable for variables.

#### fix.variables

type: `"off" | "suggestion" | "fix"`
type: `"off" | "suggestion" | "fix" | "safe-fix"`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove unsupported safe-fix from fix.variables type

This type declaration advertises "safe-fix" as a valid value for fix.variables, but the section below states that safe-fix is only applicable to imports and unavailable for variables. That contradiction makes the option schema misleading and can cause users to set fix.variables: "safe-fix" expecting behavior that the page itself says is unsupported.

Useful? React with 👍 / 👎.


##### `"off"`

Expand All @@ -329,6 +334,11 @@ Emit suggestion-style fixes (current behavior).

Emit fix-style fixes.

##### `"safe-fix"`

Like `Fix`, but does not mark them as dangerous.
Only applicable for imports, unavailable for variables.

### ignoreClassWithStaticInitBlock

type: `boolean`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "eslint/no-useless-computed-key"
category: "Style"
default: false
type_aware: false
fix: "pending"
fix: "conditional_fix"
---

<!-- This file is auto-generated by tasks/website_linter/src/rules/doc_page.rs. Do not edit it manually. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ expect(uncalledFunction).not.toBeCalled();
expect(method.mock.calls[0][0]).toStrictEqual(value);
```

This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-been-called-times.md),
to use it, add the following configuration to your `.oxlintrc.json`:

```json
{
"rules": {
"vitest/prefer-to-have-been-called-times": "error"
}
}
```

## How to use

<RuleHowToUse />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Examples of **incorrect** code for this rule:
*/

/**
* @namespace {Object} SomeNamesoace
* @namespace {Object} SomeNamespace
*/
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "typescript/prefer-find"
category: "Nursery"
category: "Style"
default: false
type_aware: true
fix: "none"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "typescript/prefer-readonly"
category: "Nursery"
category: "Style"
default: false
type_aware: true
fix: "none"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "typescript/prefer-regexp-exec"
category: "Nursery"
category: "Style"
default: false
type_aware: true
fix: "none"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "typescript/prefer-string-starts-ends-with"
category: "Nursery"
category: "Style"
default: true
type_aware: true
fix: "none"
Expand Down
2 changes: 1 addition & 1 deletion src/docs/guide/usage/linter/rules/version.data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
load() {
return "180dd0f8f60c383dff3325334b595e67845824a1";
return "6620ad82e20eab334f1ec8710cb938e2a6e5cd4d";
},
};
Loading