From 322b1f77121590e28d35e90df6406f6fc2c65a60 Mon Sep 17 00:00:00 2001 From: Boshen <1430279+Boshen@users.noreply.github.com> Date: Tue, 10 Feb 2026 11:42:08 +0000 Subject: [PATCH] Release 1.44.0 --- .vitepress/data/rules.json | 41 +++++-- .../guide/usage/formatter/generated-cli.md | 2 +- .../guide/usage/formatter/generated-config.md | 6 +- .../guide/usage/linter/generated-config.md | 38 ++++++- .../usage/linter/rules/eslint/max-params.md | 10 +- .../usage/linter/rules/eslint/no-iterator.md | 6 +- .../eslint/no-misleading-character-class.md | 4 +- .../linter/rules/import/max-dependencies.md | 16 ++- .../linter/rules/import/no-nodejs-modules.md | 2 +- .../rules/jsx_a11y/no-distracting-elements.md | 14 +++ .../rules/jsx_a11y/no-redundant-roles.md | 19 +++- .../usage/linter/rules/oxc/erasing-op.md | 2 +- .../linter/rules/typescript/ban-types.md | 13 ++- .../typescript/consistent-type-assertions.md | 106 ++++++++++++++++++ .../typescript/prefer-namespace-keyword.md | 8 ++ .../rules/unicorn/prefer-dom-node-dataset.md | 2 +- .../rules/unicorn/prefer-reflect-apply.md | 2 +- .../rules/unicorn/relative-url-style.md | 86 ++++++++++++++ .../guide/usage/linter/rules/version.data.js | 2 +- .../rules/vitest/consistent-test-filename.md | 4 +- .../rules/vitest/prefer-expect-type-of.md | 81 +++++++++++++ src/docs/guide/usage/rule-count.data.js | 2 +- 22 files changed, 429 insertions(+), 37 deletions(-) create mode 100644 src/docs/guide/usage/linter/rules/typescript/consistent-type-assertions.md create mode 100644 src/docs/guide/usage/linter/rules/unicorn/relative-url-style.md create mode 100644 src/docs/guide/usage/linter/rules/vitest/prefer-expect-type-of.md diff --git a/.vitepress/data/rules.json b/.vitepress/data/rules.json index c4005d0b0c0..fdec43f999d 100644 --- a/.vitepress/data/rules.json +++ b/.vitepress/data/rules.json @@ -686,10 +686,10 @@ { "scope": "eslint", "value": "no-iterator", - "category": "restriction", + "category": "correctness", "type_aware": false, "fix": "fixable_suggestion", - "default": false, + "default": true, "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-iterator.html" }, { @@ -758,10 +758,10 @@ { "scope": "eslint", "value": "no-misleading-character-class", - "category": "nursery", + "category": "correctness", "type_aware": false, "fix": "none", - "default": false, + "default": true, "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-misleading-character-class.html" }, { @@ -3865,7 +3865,7 @@ "value": "ban-types", "category": "pedantic", "type_aware": false, - "fix": "pending", + "fix": "none", "default": false, "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/typescript/ban-types.html" }, @@ -3887,6 +3887,15 @@ "default": false, "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/typescript/consistent-indexed-object-style.html" }, + { + "scope": "typescript", + "value": "consistent-type-assertions", + "category": "style", + "type_aware": false, + "fix": "conditional_safe_fix_or_suggestion", + "default": false, + "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/typescript/consistent-type-assertions.html" + }, { "scope": "typescript", "value": "consistent-type-definitions", @@ -5332,7 +5341,7 @@ "value": "prefer-dom-node-dataset", "category": "pedantic", "type_aware": false, - "fix": "pending", + "fix": "conditional_fix", "default": false, "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-dom-node-dataset.html" }, @@ -5512,7 +5521,7 @@ "value": "prefer-reflect-apply", "category": "style", "type_aware": false, - "fix": "pending", + "fix": "fixable_suggestion", "default": false, "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-reflect-apply.html" }, @@ -5633,6 +5642,15 @@ "default": false, "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-type-error.html" }, + { + "scope": "unicorn", + "value": "relative-url-style", + "category": "style", + "type_aware": false, + "fix": "fixable_safe_fix_or_suggestion", + "default": false, + "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/relative-url-style.html" + }, { "scope": "unicorn", "value": "require-array-join-separator", @@ -5786,6 +5804,15 @@ "default": false, "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-describe-function-title.html" }, + { + "scope": "vitest", + "value": "prefer-expect-type-of", + "category": "style", + "type_aware": false, + "fix": "fixable_fix", + "default": false, + "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-expect-type-of.html" + }, { "scope": "vitest", "value": "prefer-to-be-falsy", diff --git a/src/docs/guide/usage/formatter/generated-cli.md b/src/docs/guide/usage/formatter/generated-cli.md index da773adcb6b..692816774b3 100644 --- a/src/docs/guide/usage/formatter/generated-cli.md +++ b/src/docs/guide/usage/formatter/generated-cli.md @@ -48,7 +48,7 @@ search: false ## Available positional items: - _`PATH`_ — - Single file, single path or list of paths. If not provided, current working directory is used. Glob is supported only for exclude patterns like `'!**/fixtures/*.js'`. + Single file, path or list of paths. Glob patterns are also supported. (Be sure to quote them, otherwise your shell may expand them before passing.) Exclude patterns with `!` prefix like `'!**/fixtures/*.js'` are also supported. If not provided, current working directory is used. ## Available options: diff --git a/src/docs/guide/usage/formatter/generated-config.md b/src/docs/guide/usage/formatter/generated-config.md index 8268018d12d..4a469e27e69 100644 --- a/src/docs/guide/usage/formatter/generated-config.md +++ b/src/docs/guide/usage/formatter/generated-config.md @@ -39,7 +39,6 @@ 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. -JS-in-XXX is fully supported but still be handled by Prettier. - Default: `"auto"` @@ -89,7 +88,7 @@ type: `string[]` default: `[]` -List of import name prefixes to match for this group. +List of glob patterns to match import sources for this group. ##### experimentalSortImports.customGroups[n].groupName @@ -445,7 +444,6 @@ 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. -JS-in-XXX is fully supported but still be handled by Prettier. - Default: `"auto"` @@ -495,7 +493,7 @@ type: `string[]` default: `[]` -List of import name prefixes to match for this group. +List of glob patterns to match import sources for this group. ######## overrides[n].options.experimentalSortImports.customGroups[n].groupName diff --git a/src/docs/guide/usage/linter/generated-config.md b/src/docs/guide/usage/linter/generated-config.md index 81b059adfff..33cf626e4c4 100644 --- a/src/docs/guide/usage/linter/generated-config.md +++ b/src/docs/guide/usage/linter/generated-config.md @@ -28,7 +28,14 @@ Example "globals": { "foo": "readonly" }, - "settings": {}, + "settings": { + "react": { + "version": "18.2.0" + }, + "custom": { + "option": true + } + }, "rules": { "eqeqeq": "warn", "import/no-cycle": "error", @@ -157,7 +164,33 @@ Read more about JS plugins in [the docs](https://oxc.rs/docs/guide/usage/linter/js-plugins.html). Note: JS plugins are experimental and not subject to semver. -They are not supported in the language server (and thus editor integrations) at present. + +Examples: + +Basic usage with a local plugin path. + +```json +{ + "jsPlugins": ["./custom-plugin.js"], + "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. + +```json +{ + "plugins": ["import"], + "jsPlugins": [{ "name": "import-js", "specifier": "eslint-plugin-import" }], + "rules": { + "import/no-cycle": "error", + "import-js/no-unresolved": "warn" + } +} +``` ### jsPlugins[n] @@ -231,7 +264,6 @@ Read more about JS plugins in [the docs](https://oxc.rs/docs/guide/usage/linter/js-plugins.html). Note: JS plugins are experimental and not subject to semver. -They are not supported in the language server (and thus editor integrations) at present. ##### overrides[n].jsPlugins[n] diff --git a/src/docs/guide/usage/linter/rules/eslint/max-params.md b/src/docs/guide/usage/linter/rules/eslint/max-params.md index 05d2bde9fa6..b838ce37be0 100644 --- a/src/docs/guide/usage/linter/rules/eslint/max-params.md +++ b/src/docs/guide/usage/linter/rules/eslint/max-params.md @@ -62,13 +62,21 @@ let foo = (bar, baz, qux) => { This rule accepts a configuration object with the following properties: +### countThis + +This option controls when to count a `this` parameter. + +- "always": always count `this` +- "never": never count `this` +- "except-void": count `this` only when it is not type `void` + ### countVoidThis type: `boolean` default: `false` -This option is for counting the `this` parameter if it is of type `void`. +Deprecated alias for `countThis`. For example `{ "countVoidThis": true }` would mean that having a function take a `this` parameter of type `void` is counted towards the maximum number of parameters. diff --git a/src/docs/guide/usage/linter/rules/eslint/no-iterator.md b/src/docs/guide/usage/linter/rules/eslint/no-iterator.md index 69fb3ce54cf..0c178851411 100644 --- a/src/docs/guide/usage/linter/rules/eslint/no-iterator.md +++ b/src/docs/guide/usage/linter/rules/eslint/no-iterator.md @@ -1,7 +1,7 @@ --- title: "eslint/no-iterator" -category: "Restriction" -default: false +category: "Correctness" +default: true type_aware: false fix: "fixable_suggestion" --- @@ -17,7 +17,7 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin ### What it does -Disallow the use of the `__iterator__` property +Disallow the use of the `__iterator__` property. ### Why is this bad? diff --git a/src/docs/guide/usage/linter/rules/eslint/no-misleading-character-class.md b/src/docs/guide/usage/linter/rules/eslint/no-misleading-character-class.md index 0544c55f8af..2362757d6d0 100644 --- a/src/docs/guide/usage/linter/rules/eslint/no-misleading-character-class.md +++ b/src/docs/guide/usage/linter/rules/eslint/no-misleading-character-class.md @@ -1,7 +1,7 @@ --- title: "eslint/no-misleading-character-class" -category: "Nursery" -default: false +category: "Correctness" +default: true type_aware: false fix: "none" --- diff --git a/src/docs/guide/usage/linter/rules/import/max-dependencies.md b/src/docs/guide/usage/linter/rules/import/max-dependencies.md index d9dca3f8b56..213d5ad1ef3 100644 --- a/src/docs/guide/usage/linter/rules/import/max-dependencies.md +++ b/src/docs/guide/usage/linter/rules/import/max-dependencies.md @@ -17,7 +17,7 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin ### What it does -Forbid modules to have too many dependencies (import or require statements). +Forbid modules to have too many dependencies (`import` statements only). ### Why is this bad? @@ -25,9 +25,13 @@ This is a useful rule because a module with too many dependencies is a code smel and usually indicates the module is doing too much and/or should be broken up into smaller modules. +**NOTE**: This rule only counts `import` statements, and does not count dependencies from +CommonJS `require()` statements. This is a difference from the original +eslint-import-plugin rule. + ### Examples -Given `{"max": 2}` +Given `{ "max": 2 }` Examples of **incorrect** code for this rule: @@ -56,13 +60,19 @@ default: `false` Whether to ignore type imports when counting dependencies. +```ts +// Neither of these count as dependencies if `ignoreTypeImports` is true: +import type { Foo } from "./foo"; +import { type Foo } from "./foo"; +``` + ### max type: `integer` default: `10` -Maximum number of dependencies allowed in a module. +Maximum number of dependencies allowed in a file. ## How to use diff --git a/src/docs/guide/usage/linter/rules/import/no-nodejs-modules.md b/src/docs/guide/usage/linter/rules/import/no-nodejs-modules.md index 1927010879f..34635a96918 100644 --- a/src/docs/guide/usage/linter/rules/import/no-nodejs-modules.md +++ b/src/docs/guide/usage/linter/rules/import/no-nodejs-modules.md @@ -47,7 +47,7 @@ var _ = require("lodash"); var foo = require("foo"); var foo = require("./foo"); -/* eslint import/no-nodejs-modules: ["error", {"allow": ["path"]}] */ +/* import/no-nodejs-modules: ["error", {"allow": ["path"]}] */ import path from "path"; ``` diff --git a/src/docs/guide/usage/linter/rules/jsx_a11y/no-distracting-elements.md b/src/docs/guide/usage/linter/rules/jsx_a11y/no-distracting-elements.md index 0c17a68943a..5760c807985 100644 --- a/src/docs/guide/usage/linter/rules/jsx_a11y/no-distracting-elements.md +++ b/src/docs/guide/usage/linter/rules/jsx_a11y/no-distracting-elements.md @@ -47,6 +47,20 @@ Examples of **correct** code for this rule: ``` +## Configuration + +This rule accepts a configuration object with the following properties: + +### elements + +type: `array` + +List of distracting elements to check for. + +#### elements[n] + +type: `"marquee" | "blink"` + ## How to use To **enable** this rule using the config file or in the CLI, you can use: diff --git a/src/docs/guide/usage/linter/rules/jsx_a11y/no-redundant-roles.md b/src/docs/guide/usage/linter/rules/jsx_a11y/no-redundant-roles.md index 8304af67244..0c5d9e3f35f 100644 --- a/src/docs/guide/usage/linter/rules/jsx_a11y/no-redundant-roles.md +++ b/src/docs/guide/usage/linter/rules/jsx_a11y/no-redundant-roles.md @@ -17,8 +17,9 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin ### What it does -Enforces that the explicit `role` property is not the same as -implicit/default role property on element. +Enforces that code does not include a redundant `role` property, in the +case that it's identical to the implicit `role` property of the +element type. ### Why is this bad? @@ -26,16 +27,26 @@ Redundant roles can lead to confusion and verbosity in the codebase. ### Examples +This rule applies for the following elements and their implicit roles: + +- `