From 84fb8aa21642e8ae1f695206d5da5c355eadfd97 Mon Sep 17 00:00:00 2001 From: Boshen <1430279+Boshen@users.noreply.github.com> Date: Fri, 19 Dec 2025 01:32:15 +0000 Subject: [PATCH 1/2] Release 1.34.0 --- .../guide/usage/formatter/generated-config.md | 27 +++-- .../guide/usage/linter/generated-config.md | 86 +++++++++++++- .../guide/usage/linter/generated-rules.md | 24 ++-- .../rules/eslint/capitalized-comments.md | 112 ++++++++++++++++++ .../linter/rules/eslint/no-inline-comments.md | 84 +++++++++++++ .../linter/rules/jest/consistent-test-it.md | 2 +- .../usage/linter/rules/jest/expect-expect.md | 2 +- .../linter/rules/jest/no-alias-methods.md | 2 +- .../rules/jest/no-commented-out-tests.md | 2 +- .../linter/rules/jest/no-disabled-tests.md | 2 +- .../linter/rules/jest/no-focused-tests.md | 2 +- .../linter/rules/jest/no-identical-title.md | 2 +- .../rules/jest/no-restricted-jest-methods.md | 13 +- .../linter/rules/jest/no-test-prefixes.md | 2 +- .../linter/rules/jest/prefer-called-with.md | 14 +++ .../rules/jest/prefer-hooks-in-order.md | 2 +- .../usage/linter/rules/jest/prefer-spy-on.md | 11 ++ .../jest/prefer-to-have-been-called-times.md | 68 +++++++++++ .../rules/jest/prefer-to-have-been-called.md | 65 ++++++++++ .../usage/linter/rules/jest/require-hook.md | 11 ++ .../rules/jest/valid-describe-callback.md | 2 +- .../usage/linter/rules/jest/valid-expect.md | 2 +- .../linter/rules/oxc/bad-bitwise-operator.md | 2 +- .../rules/oxc/misrefactored-assign-op.md | 2 +- .../rules/react/jsx-no-duplicate-props.md | 6 + .../linter/rules/typescript/await-thenable.md | 6 +- .../rules/typescript/no-base-to-string.md | 14 +++ .../linter/rules/typescript/no-deprecated.md | 49 ++++++++ .../rules/typescript/no-inferrable-types.md | 2 +- .../no-meaningless-void-operator.md | 12 ++ .../rules/typescript/no-misused-spread.md | 49 ++++++++ .../typescript/prefer-enum-initializers.md | 2 +- .../typescript/require-array-sort-compare.md | 12 ++ .../unicorn/no-negation-in-equality-check.md | 2 +- .../no-unnecessary-array-flat-depth.md | 2 +- .../guide/usage/linter/rules/version.data.js | 2 +- 36 files changed, 652 insertions(+), 47 deletions(-) create mode 100644 src/docs/guide/usage/linter/rules/eslint/capitalized-comments.md create mode 100644 src/docs/guide/usage/linter/rules/eslint/no-inline-comments.md create mode 100644 src/docs/guide/usage/linter/rules/jest/prefer-to-have-been-called-times.md create mode 100644 src/docs/guide/usage/linter/rules/jest/prefer-to-have-been-called.md diff --git a/src/docs/guide/usage/formatter/generated-config.md b/src/docs/guide/usage/formatter/generated-config.md index 11141222ac..09f2483c3a 100644 --- a/src/docs/guide/usage/formatter/generated-config.md +++ b/src/docs/guide/usage/formatter/generated-config.md @@ -6,7 +6,8 @@ search: false Most options are the same as Prettier's options. See also -But some options are our own extensions. + +In addition, some options are our own extensions. ## arrowParens @@ -59,41 +60,45 @@ type: `string[]` ### experimentalSortImports.ignoreCase -type: `boolean` +type: `boolean | null` -default: `true` +Ignore case when sorting. (Default: `true`) ### experimentalSortImports.internalPattern type: `string[]` +Glob patterns to identify internal imports. + ### experimentalSortImports.newlinesBetween -type: `boolean` +type: `boolean | null` -default: `true` +Add newlines between import groups. (Default: `true`) ### experimentalSortImports.order type: `string | null` +Sort order. (Default: `"asc"`) + ### experimentalSortImports.partitionByComment -type: `boolean` +type: `boolean | null` -default: `false` +Partition imports by comments. (Default: `false`) ### experimentalSortImports.partitionByNewline -type: `boolean` +type: `boolean | null` -default: `false` +Partition imports by newlines. (Default: `false`) ### experimentalSortImports.sortSideEffects -type: `boolean` +type: `boolean | null` -default: `false` +Sort side-effect imports. (Default: `false`) ## experimentalSortPackageJson diff --git a/src/docs/guide/usage/linter/generated-config.md b/src/docs/guide/usage/linter/generated-config.md index 61252cfb17..8d2d8dc4fb 100644 --- a/src/docs/guide/usage/linter/generated-config.md +++ b/src/docs/guide/usage/linter/generated-config.md @@ -50,6 +50,12 @@ Example } ``` +## $schema + +type: `string | null` + +Schema URI for editor tooling. + ## categories type: `object` @@ -143,13 +149,50 @@ Globs to ignore during linting. These are resolved from the configuration file p ## jsPlugins -type: `string[]` +type: `array | null` JS plugins. Note: JS plugins are experimental and not subject to semver. They are not supported in language server at present. +### jsPlugins[n] + +type: `object | string` + +#### jsPlugins[n].name + +type: `string` + +Custom name/alias for the plugin. + +Note: The following plugin names are reserved because they are implemented natively in Rust within oxlint and cannot be used for JS plugins: + +- react (includes react-hooks) +- unicorn +- typescript +- oxc +- import (includes import-x) +- jsdoc +- jest +- vitest +- jsx-a11y +- nextjs +- react-perf +- promise +- node +- regex +- vue +- eslint + +If you need to use the JavaScript version of any of these plugins, provide a custom alias to avoid conflicts. + +#### jsPlugins[n].specifier + +type: `string` + +Path or package name of the plugin + ## overrides type: `array` @@ -178,13 +221,50 @@ Enabled or disabled specific global variables. #### overrides[n].jsPlugins -type: `string[]` +type: `array | null` JS plugins for this override. Note: JS plugins are experimental and not subject to semver. They are not supported in language server at present. +##### overrides[n].jsPlugins[n] + +type: `object | string` + +###### overrides[n].jsPlugins[n].name + +type: `string` + +Custom name/alias for the plugin. + +Note: The following plugin names are reserved because they are implemented natively in Rust within oxlint and cannot be used for JS plugins: + +- react (includes react-hooks) +- unicorn +- typescript +- oxc +- import (includes import-x) +- jsdoc +- jest +- vitest +- jsx-a11y +- nextjs +- react-perf +- promise +- node +- regex +- vue +- eslint + +If you need to use the JavaScript version of any of these plugins, provide a custom alias to avoid conflicts. + +###### overrides[n].jsPlugins[n].specifier + +type: `string` + +Path or package name of the plugin + #### overrides[n].plugins type: `array | null` @@ -504,7 +584,7 @@ type: `object` Configure Vitest plugin rules. -See [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest)'s +See [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest)'s configuration for a full reference. #### settings.vitest.typecheck diff --git a/src/docs/guide/usage/linter/generated-rules.md b/src/docs/guide/usage/linter/generated-rules.md index 2cd2c62c9d..c421e2d501 100644 --- a/src/docs/guide/usage/linter/generated-rules.md +++ b/src/docs/guide/usage/linter/generated-rules.md @@ -6,7 +6,7 @@ search: false The progress of all rule implementations is tracked [here](https://github.com/oxc-project/oxc/issues/481). -- Total number of rules: 630 +- Total number of rules: 634 - Rules turned on by default: 104 **Legend for 'Fixable?' column:** @@ -277,7 +277,7 @@ Lints which prevent the use of language and library features. Must not be enable | [anchor-ambiguous-text](/docs/guide/usage/linter/rules/jsx_a11y/anchor-ambiguous-text.html) | jsx_a11y | | | | [no-new-require](/docs/guide/usage/linter/rules/node/no-new-require.html) | node | | | | [no-process-env](/docs/guide/usage/linter/rules/node/no-process-env.html) | node | | | -| [bad-bitwise-operator](/docs/guide/usage/linter/rules/oxc/bad-bitwise-operator.html) | oxc | | 🚧 | +| [bad-bitwise-operator](/docs/guide/usage/linter/rules/oxc/bad-bitwise-operator.html) | oxc | | 💡 | | [no-async-await](/docs/guide/usage/linter/rules/oxc/no-async-await.html) | oxc | | | | [no-barrel-file](/docs/guide/usage/linter/rules/oxc/no-barrel-file.html) | oxc | | | | [no-const-enum](/docs/guide/usage/linter/rules/oxc/no-const-enum.html) | oxc | | 🛠️ | @@ -346,7 +346,7 @@ code that is most likely wrong or useless. | [no-unassigned-import](/docs/guide/usage/linter/rules/import/no-unassigned-import.html) | import | | | | [no-commented-out-tests](/docs/guide/usage/linter/rules/jest/no-commented-out-tests.html) | jest | | | | [approx-constant](/docs/guide/usage/linter/rules/oxc/approx-constant.html) | oxc | | 💡 | -| [misrefactored-assign-op](/docs/guide/usage/linter/rules/oxc/misrefactored-assign-op.html) | oxc | | 🚧 | +| [misrefactored-assign-op](/docs/guide/usage/linter/rules/oxc/misrefactored-assign-op.html) | oxc | | 💡 | | [no-async-endpoint-handlers](/docs/guide/usage/linter/rules/oxc/no-async-endpoint-handlers.html) | oxc | | | | [no-this-in-exported-function](/docs/guide/usage/linter/rules/oxc/no-this-in-exported-function.html) | oxc | | | | [always-return](/docs/guide/usage/linter/rules/promise/always-return.html) | promise | | | @@ -378,7 +378,7 @@ code that is most likely wrong or useless. | [no-required-prop-with-default](/docs/guide/usage/linter/rules/vue/no-required-prop-with-default.html) | vue | | 🚧 | | [require-default-export](/docs/guide/usage/linter/rules/vue/require-default-export.html) | vue | | | -## Pedantic (111): +## Pedantic (112): Lints which are rather strict or have occasional false positives. | Rule name | Source | Default | Fixable? | @@ -396,6 +396,7 @@ Lints which are rather strict or have occasional false positives. | [no-constructor-return](/docs/guide/usage/linter/rules/eslint/no-constructor-return.html) | eslint | | | | [no-else-return](/docs/guide/usage/linter/rules/eslint/no-else-return.html) | eslint | | 🛠️ | | [no-fallthrough](/docs/guide/usage/linter/rules/eslint/no-fallthrough.html) | eslint | | 🚧 | +| [no-inline-comments](/docs/guide/usage/linter/rules/eslint/no-inline-comments.html) | eslint | | | | [no-inner-declarations](/docs/guide/usage/linter/rules/eslint/no-inner-declarations.html) | eslint | | | | [no-lonely-if](/docs/guide/usage/linter/rules/eslint/no-lonely-if.html) | eslint | | 🚧 | | [no-loop-func](/docs/guide/usage/linter/rules/eslint/no-loop-func.html) | eslint | | | @@ -440,7 +441,7 @@ Lints which are rather strict or have occasional false positives. | [no-unsafe-member-access](/docs/guide/usage/linter/rules/typescript/no-unsafe-member-access.html) | typescript | | 🚧 | | [no-unsafe-return](/docs/guide/usage/linter/rules/typescript/no-unsafe-return.html) | typescript | | 🚧 | | [only-throw-error](/docs/guide/usage/linter/rules/typescript/only-throw-error.html) | typescript | | 🚧 | -| [prefer-enum-initializers](/docs/guide/usage/linter/rules/typescript/prefer-enum-initializers.html) | typescript | | 🚧 | +| [prefer-enum-initializers](/docs/guide/usage/linter/rules/typescript/prefer-enum-initializers.html) | typescript | | 💡 | | [prefer-includes](/docs/guide/usage/linter/rules/typescript/prefer-includes.html) | typescript | | 🚧 | | [prefer-nullish-coalescing](/docs/guide/usage/linter/rules/typescript/prefer-nullish-coalescing.html) | typescript | | 🚧 | | [prefer-promise-reject-errors](/docs/guide/usage/linter/rules/typescript/prefer-promise-reject-errors.html) | typescript | | 🚧 | @@ -460,13 +461,13 @@ Lints which are rather strict or have occasional false positives. | [no-hex-escape](/docs/guide/usage/linter/rules/unicorn/no-hex-escape.html) | unicorn | | 🛠️ | | [no-instanceof-array](/docs/guide/usage/linter/rules/unicorn/no-instanceof-array.html) | unicorn | | 🛠️ | | [no-lonely-if](/docs/guide/usage/linter/rules/unicorn/no-lonely-if.html) | unicorn | | | -| [no-negation-in-equality-check](/docs/guide/usage/linter/rules/unicorn/no-negation-in-equality-check.html) | unicorn | | 🚧 | +| [no-negation-in-equality-check](/docs/guide/usage/linter/rules/unicorn/no-negation-in-equality-check.html) | unicorn | | 💡 | | [no-new-buffer](/docs/guide/usage/linter/rules/unicorn/no-new-buffer.html) | unicorn | | 🚧 | | [no-object-as-default-parameter](/docs/guide/usage/linter/rules/unicorn/no-object-as-default-parameter.html) | unicorn | | | | [no-static-only-class](/docs/guide/usage/linter/rules/unicorn/no-static-only-class.html) | unicorn | | ⚠️🛠️️ | | [no-this-assignment](/docs/guide/usage/linter/rules/unicorn/no-this-assignment.html) | unicorn | | | | [no-typeof-undefined](/docs/guide/usage/linter/rules/unicorn/no-typeof-undefined.html) | unicorn | | 🚧 | -| [no-unnecessary-array-flat-depth](/docs/guide/usage/linter/rules/unicorn/no-unnecessary-array-flat-depth.html) | unicorn | | 🚧 | +| [no-unnecessary-array-flat-depth](/docs/guide/usage/linter/rules/unicorn/no-unnecessary-array-flat-depth.html) | unicorn | | 💡 | | [no-unnecessary-array-splice-count](/docs/guide/usage/linter/rules/unicorn/no-unnecessary-array-splice-count.html) | unicorn | | 🛠️ | | [no-unnecessary-slice-end](/docs/guide/usage/linter/rules/unicorn/no-unnecessary-slice-end.html) | unicorn | | 🛠️ | | [no-unreadable-iife](/docs/guide/usage/linter/rules/unicorn/no-unreadable-iife.html) | unicorn | | | @@ -495,12 +496,13 @@ Lints which are rather strict or have occasional false positives. | [prefer-type-error](/docs/guide/usage/linter/rules/unicorn/prefer-type-error.html) | unicorn | | 🛠️ | | [require-number-to-fixed-digits-argument](/docs/guide/usage/linter/rules/unicorn/require-number-to-fixed-digits-argument.html) | unicorn | | 🛠️ | -## Style (173): +## Style (176): Code that should be written in a more idiomatic way. | Rule name | Source | Default | Fixable? | | ------------------------------------ | ---------- | ------- | -------- | | [arrow-body-style](/docs/guide/usage/linter/rules/eslint/arrow-body-style.html) | eslint | | 🛠️ | +| [capitalized-comments](/docs/guide/usage/linter/rules/eslint/capitalized-comments.html) | eslint | | 🛠️ | | [curly](/docs/guide/usage/linter/rules/eslint/curly.html) | eslint | | 🛠️ | | [default-case-last](/docs/guide/usage/linter/rules/eslint/default-case-last.html) | eslint | | | | [default-param-last](/docs/guide/usage/linter/rules/eslint/default-param-last.html) | eslint | | | @@ -574,7 +576,7 @@ Code that should be written in a more idiomatic way. | [no-test-return-statement](/docs/guide/usage/linter/rules/jest/no-test-return-statement.html) | jest | | | | [no-untyped-mock-factory](/docs/guide/usage/linter/rules/jest/no-untyped-mock-factory.html) | jest | | 🛠️ | | [padding-around-test-blocks](/docs/guide/usage/linter/rules/jest/padding-around-test-blocks.html) | jest | | 🛠️ | -| [prefer-called-with](/docs/guide/usage/linter/rules/jest/prefer-called-with.html) | jest | | | +| [prefer-called-with](/docs/guide/usage/linter/rules/jest/prefer-called-with.html) | jest | | 🛠️ | | [prefer-comparison-matcher](/docs/guide/usage/linter/rules/jest/prefer-comparison-matcher.html) | jest | | 🛠️ | | [prefer-each](/docs/guide/usage/linter/rules/jest/prefer-each.html) | jest | | | | [prefer-equality-matcher](/docs/guide/usage/linter/rules/jest/prefer-equality-matcher.html) | jest | | | @@ -588,6 +590,8 @@ Code that should be written in a more idiomatic way. | [prefer-strict-equal](/docs/guide/usage/linter/rules/jest/prefer-strict-equal.html) | jest | | 🛠️ | | [prefer-to-be](/docs/guide/usage/linter/rules/jest/prefer-to-be.html) | jest | | 🛠️ | | [prefer-to-contain](/docs/guide/usage/linter/rules/jest/prefer-to-contain.html) | jest | | 🛠️ | +| [prefer-to-have-been-called](/docs/guide/usage/linter/rules/jest/prefer-to-have-been-called.html) | jest | | 🛠️ | +| [prefer-to-have-been-called-times](/docs/guide/usage/linter/rules/jest/prefer-to-have-been-called-times.html) | jest | | 🛠️ | | [prefer-to-have-length](/docs/guide/usage/linter/rules/jest/prefer-to-have-length.html) | jest | | 🛠️ | | [prefer-todo](/docs/guide/usage/linter/rules/jest/prefer-todo.html) | jest | | 🛠️ | | [require-hook](/docs/guide/usage/linter/rules/jest/require-hook.html) | jest | | | @@ -619,7 +623,7 @@ Code that should be written in a more idiomatic way. | [consistent-type-definitions](/docs/guide/usage/linter/rules/typescript/consistent-type-definitions.html) | typescript | | ⚠️🛠️️ | | [consistent-type-imports](/docs/guide/usage/linter/rules/typescript/consistent-type-imports.html) | typescript | | 🛠️ | | [no-empty-interface](/docs/guide/usage/linter/rules/typescript/no-empty-interface.html) | typescript | | | -| [no-inferrable-types](/docs/guide/usage/linter/rules/typescript/no-inferrable-types.html) | typescript | | 🚧 | +| [no-inferrable-types](/docs/guide/usage/linter/rules/typescript/no-inferrable-types.html) | typescript | | 💡 | | [prefer-for-of](/docs/guide/usage/linter/rules/typescript/prefer-for-of.html) | typescript | | 🚧 | | [prefer-function-type](/docs/guide/usage/linter/rules/typescript/prefer-function-type.html) | typescript | | 🛠️ | | [prefer-namespace-keyword](/docs/guide/usage/linter/rules/typescript/prefer-namespace-keyword.html) | typescript | | 🛠️ | diff --git a/src/docs/guide/usage/linter/rules/eslint/capitalized-comments.md b/src/docs/guide/usage/linter/rules/eslint/capitalized-comments.md new file mode 100644 index 0000000000..e0d2c41243 --- /dev/null +++ b/src/docs/guide/usage/linter/rules/eslint/capitalized-comments.md @@ -0,0 +1,112 @@ + + + + +# eslint/capitalized-comments + +
+ +🛠️ An auto-fix is available for this rule. + +
+ +### What it does + +Enforces or disallows capitalization of the first letter of a comment. + +### Why is this bad? + +Inconsistent capitalization of comments can make code harder to read. +This rule helps enforce a consistent style across the codebase. + +### Examples + +Examples of **incorrect** code for this rule with the default `"always"` option: + +```js +// lowercase comment +/* lowercase block comment */ +``` + +Examples of **correct** code for this rule with the default `"always"` option: + +```js +// Capitalized comment +/* Capitalized block comment */ +// 123 - comments starting with non-letters are ignored +``` + +## Configuration + +This rule accepts a configuration object with the following properties: + +### block + +type: `object | null` + +#### block.ignoreConsecutiveComments + +type: `boolean | null` + +#### block.ignoreInlineComments + +type: `boolean | null` + +#### block.ignorePattern + +type: `string | null` + +### ignoreConsecutiveComments + +type: `boolean | null` + +### ignoreInlineComments + +type: `boolean | null` + +### ignorePattern + +type: `string | null` + +### line + +type: `object | null` + +#### line.ignoreConsecutiveComments + +type: `boolean | null` + +#### line.ignoreInlineComments + +type: `boolean | null` + +#### line.ignorePattern + +type: `string | null` + +## 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": { + "capitalized-comments": "error" + } +} +``` + +```bash [CLI] +oxlint --deny capitalized-comments +``` + +::: + +## References + +- Rule Source diff --git a/src/docs/guide/usage/linter/rules/eslint/no-inline-comments.md b/src/docs/guide/usage/linter/rules/eslint/no-inline-comments.md new file mode 100644 index 0000000000..ad28196001 --- /dev/null +++ b/src/docs/guide/usage/linter/rules/eslint/no-inline-comments.md @@ -0,0 +1,84 @@ + + + + +# eslint/no-inline-comments + +
+
+ +### What it does + +Disallows comments on the same line as code. + +### Why is this bad? + +Comments placed at the end of a line of code can make code harder to read. +They can easily be missed when scanning vertically, and they make lines longer. +Moving comments to their own lines makes them more prominent and reduces line length. + +### Examples + +Examples of **incorrect** code for this rule: + +```js +var a = 1; // inline comment +var b = 2; /* another inline comment */ +``` + +Examples of **correct** code for this rule: + +```js +// comment on its own line +var a = 1; + +/* block comment on its own line */ +var b = 2; +``` + +## Configuration + +This rule accepts a configuration object with the following properties: + +### ignorePattern + +type: `string | null` + +A regex pattern to ignore certain inline comments. + +Comments matching this pattern will not be reported. + +Example configuration: + +```json +{ + "no-inline-comments": ["error", { "ignorePattern": "webpackChunkName" }] +} +``` + +## 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": { + "no-inline-comments": "error" + } +} +``` + +```bash [CLI] +oxlint --deny no-inline-comments +``` + +::: + +## References + +- Rule Source diff --git a/src/docs/guide/usage/linter/rules/jest/consistent-test-it.md b/src/docs/guide/usage/linter/rules/jest/consistent-test-it.md index e064174425..5bac87bc54 100644 --- a/src/docs/guide/usage/linter/rules/jest/consistent-test-it.md +++ b/src/docs/guide/usage/linter/rules/jest/consistent-test-it.md @@ -57,7 +57,7 @@ describe("foo", function () { }); ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/consistent-test-it.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/consistent-test-it.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/jest/expect-expect.md b/src/docs/guide/usage/linter/rules/jest/expect-expect.md index d6dff0a545..e966614b9b 100644 --- a/src/docs/guide/usage/linter/rules/jest/expect-expect.md +++ b/src/docs/guide/usage/linter/rules/jest/expect-expect.md @@ -29,7 +29,7 @@ it("should be a test", () => { test("should assert something", () => {}); ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/expect-expect.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/expect-expect.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/jest/no-alias-methods.md b/src/docs/guide/usage/linter/rules/jest/no-alias-methods.md index 6acbf52129..1d196059e0 100644 --- a/src/docs/guide/usage/linter/rules/jest/no-alias-methods.md +++ b/src/docs/guide/usage/linter/rules/jest/no-alias-methods.md @@ -56,7 +56,7 @@ expect(a).toHaveNthReturnedWith(); expect(a).toThrow(); ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-alias-methods.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-alias-methods.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/jest/no-commented-out-tests.md b/src/docs/guide/usage/linter/rules/jest/no-commented-out-tests.md index 21d0f549a1..ae81fcd9d4 100644 --- a/src/docs/guide/usage/linter/rules/jest/no-commented-out-tests.md +++ b/src/docs/guide/usage/linter/rules/jest/no-commented-out-tests.md @@ -35,7 +35,7 @@ Examples of **incorrect** code for this rule: // test.skip('foo', () => {}); ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-commented-out-tests.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-commented-out-tests.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/jest/no-disabled-tests.md b/src/docs/guide/usage/linter/rules/jest/no-disabled-tests.md index 6c9f481a4a..fcf12b6e1f 100644 --- a/src/docs/guide/usage/linter/rules/jest/no-disabled-tests.md +++ b/src/docs/guide/usage/linter/rules/jest/no-disabled-tests.md @@ -44,7 +44,7 @@ it("foo", () => { }); ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-disabled-tests.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-disabled-tests.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/jest/no-focused-tests.md b/src/docs/guide/usage/linter/rules/jest/no-focused-tests.md index b0b74ecbc1..2de87e788c 100644 --- a/src/docs/guide/usage/linter/rules/jest/no-focused-tests.md +++ b/src/docs/guide/usage/linter/rules/jest/no-focused-tests.md @@ -44,7 +44,7 @@ fit.each` `(); ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-focused-tests.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-focused-tests.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/jest/no-identical-title.md b/src/docs/guide/usage/linter/rules/jest/no-identical-title.md index c1b443c1e0..5961f673ad 100644 --- a/src/docs/guide/usage/linter/rules/jest/no-identical-title.md +++ b/src/docs/guide/usage/linter/rules/jest/no-identical-title.md @@ -35,7 +35,7 @@ describe("baz", () => { }); ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-identical-title.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-identical-title.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/jest/no-restricted-jest-methods.md b/src/docs/guide/usage/linter/rules/jest/no-restricted-jest-methods.md index 9add071bd6..82bcea9232 100644 --- a/src/docs/guide/usage/linter/rules/jest/no-restricted-jest-methods.md +++ b/src/docs/guide/usage/linter/rules/jest/no-restricted-jest-methods.md @@ -16,10 +16,13 @@ Restrict the use of specific `jest` and `vi` methods. ### Why is this bad? -Certain Jest methods may be deprecated, discouraged in specific +Certain Jest or Vitest methods may be deprecated, discouraged in specific contexts, or incompatible with your testing environment. Restricting them helps maintain consistent and reliable test practices. +By default, no methods are restricted by this rule. +You must configure the rule for it to disable anything. + ### Examples Examples of **incorrect** code for this rule: @@ -47,7 +50,10 @@ to use it, add the following configuration to your `.oxlintrc.json`: ```json { "rules": { - "vitest/no-restricted-vi-methods": "error" + "vitest/no-restricted-vi-methods": [ + "error", + { "badFunction": "Don't use `badFunction`, it is bad." } + ] } } ``` @@ -62,7 +68,8 @@ type: `Record` default: `{}` -A mapping of restricted Jest method names to custom messages. +A mapping of restricted Jest method names to custom messages - or +`null`, for a generic message. ## How to use diff --git a/src/docs/guide/usage/linter/rules/jest/no-test-prefixes.md b/src/docs/guide/usage/linter/rules/jest/no-test-prefixes.md index b34b89a094..4cd130ce91 100644 --- a/src/docs/guide/usage/linter/rules/jest/no-test-prefixes.md +++ b/src/docs/guide/usage/linter/rules/jest/no-test-prefixes.md @@ -39,7 +39,7 @@ xtest("foo"); // invalid xdescribe("foo"); // invalid ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-test-prefixes.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-test-prefixes.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/jest/prefer-called-with.md b/src/docs/guide/usage/linter/rules/jest/prefer-called-with.md index aa7826196f..783d5554fa 100644 --- a/src/docs/guide/usage/linter/rules/jest/prefer-called-with.md +++ b/src/docs/guide/usage/linter/rules/jest/prefer-called-with.md @@ -8,6 +8,9 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin # jest/prefer-called-with
+ +🛠️ An auto-fix is available for this rule. +
### What it does @@ -40,6 +43,17 @@ expect(anyArgsFunction).toBeCalledTimes(1); expect(uncalledFunction).not.toBeCalled(); ``` +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md), +to use it, add the following configuration to your `.oxlintrc.json`: + +```json +{ + "rules": { + "vitest/prefer-called-with": "error" + } +} +``` + ## 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/jest/prefer-hooks-in-order.md b/src/docs/guide/usage/linter/rules/jest/prefer-hooks-in-order.md index 125ab2ed53..b17da64196 100644 --- a/src/docs/guide/usage/linter/rules/jest/prefer-hooks-in-order.md +++ b/src/docs/guide/usage/linter/rules/jest/prefer-hooks-in-order.md @@ -115,7 +115,7 @@ describe("foo", () => { }); ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/prefer-hooks-in-order.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/prefer-hooks-in-order.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/jest/prefer-spy-on.md b/src/docs/guide/usage/linter/rules/jest/prefer-spy-on.md index efea2e851d..aaf63df671 100644 --- a/src/docs/guide/usage/linter/rules/jest/prefer-spy-on.md +++ b/src/docs/guide/usage/linter/rules/jest/prefer-spy-on.md @@ -50,6 +50,17 @@ jest.spyOn(Date, "now"); jest.spyOn(Date, "now").mockImplementation(() => 10); ``` +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md), +to use it, add the following configuration to your `.oxlintrc.json`: + +```json +{ + "rules": { + "vitest/prefer-spy-on": "error" + } +} +``` + ## 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/jest/prefer-to-have-been-called-times.md b/src/docs/guide/usage/linter/rules/jest/prefer-to-have-been-called-times.md new file mode 100644 index 0000000000..fc38e70c10 --- /dev/null +++ b/src/docs/guide/usage/linter/rules/jest/prefer-to-have-been-called-times.md @@ -0,0 +1,68 @@ + + + + +# jest/prefer-to-have-been-called-times + +
+ +🛠️ An auto-fix is available for this rule. + +
+ +### What it does + +In order to have a better failure message, [`toHaveBeenCalledTimes` should be used +instead of directly checking the length of `mock.calls`](https://github.com/jest-community/eslint-plugin-jest/blob/v29.5.0/docs/rules/prefer-to-have-been-called-times.md). + +### Why is this bad? + +This rule triggers a warning if `toHaveLength` is used to assert the number of times a mock is called. + +### Examples + +Examples of **incorrect** code for this rule: + +```js +expect(someFunction.mock.calls).toHaveLength(1); +expect(someFunction.mock.calls).toHaveLength(0); +expect(someFunction.mock.calls).not.toHaveLength(1); +``` + +Examples of **correct** code for this rule: + +```js +expect(someFunction).toHaveBeenCalledTimes(1); +expect(someFunction).toHaveBeenCalledTimes(0); +expect(someFunction).not.toHaveBeenCalledTimes(0); +expect(uncalledFunction).not.toBeCalled(); +expect(method.mock.calls[0][0]).toStrictEqual(value); +``` + +## How to use + +To **enable** this rule using the config file or in the CLI, you can use: + +::: code-group + +```json [Config (.oxlintrc.json)] +{ + "plugins": ["jest"], + "rules": { + "jest/prefer-to-have-been-called-times": "error" + } +} +``` + +```bash [CLI] +oxlint --deny jest/prefer-to-have-been-called-times --jest-plugin +``` + +::: + +## References + +- Rule Source diff --git a/src/docs/guide/usage/linter/rules/jest/prefer-to-have-been-called.md b/src/docs/guide/usage/linter/rules/jest/prefer-to-have-been-called.md new file mode 100644 index 0000000000..8476ddc99d --- /dev/null +++ b/src/docs/guide/usage/linter/rules/jest/prefer-to-have-been-called.md @@ -0,0 +1,65 @@ + + + + +# jest/prefer-to-have-been-called + +
+ +🛠️ An auto-fix is available for this rule. + +
+ +### What it does + +Suggests using `toHaveBeenCalled()` or `not.toHaveBeenCalled()` over `toHaveBeenCalledTimes(0)` or `toBeCalledTimes(0)`. + +### Why is this bad? + +`toHaveBeenCalled()` is more explicit and readable than `toHaveBeenCalledTimes(0)`. + +### Examples + +Examples of **incorrect** code for this rule: + +```js +expect(mock).toHaveBeenCalledTimes(0); +expect(mock).toBeCalledTimes(0); +expect(mock).not.toHaveBeenCalledTimes(0); +``` + +Examples of **correct** code for this rule: + +```js +expect(mock).not.toHaveBeenCalled(); +expect(mock).toHaveBeenCalled(); +expect(mock).toHaveBeenCalledTimes(1); +``` + +## How to use + +To **enable** this rule using the config file or in the CLI, you can use: + +::: code-group + +```json [Config (.oxlintrc.json)] +{ + "plugins": ["jest"], + "rules": { + "jest/prefer-to-have-been-called": "error" + } +} +``` + +```bash [CLI] +oxlint --deny jest/prefer-to-have-been-called --jest-plugin +``` + +::: + +## References + +- Rule Source diff --git a/src/docs/guide/usage/linter/rules/jest/require-hook.md b/src/docs/guide/usage/linter/rules/jest/require-hook.md index f43aed0ba5..c39d4439cb 100644 --- a/src/docs/guide/usage/linter/rules/jest/require-hook.md +++ b/src/docs/guide/usage/linter/rules/jest/require-hook.md @@ -128,6 +128,17 @@ afterEach(() => { }); ``` +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md), +to use it, add the following configuration to your `.oxlintrc.json`: + +```json +{ + "rules": { + "vitest/require-hook": "error" + } +} +``` + ## Configuration This rule accepts a configuration object with the following properties: diff --git a/src/docs/guide/usage/linter/rules/jest/valid-describe-callback.md b/src/docs/guide/usage/linter/rules/jest/valid-describe-callback.md index be664c97d8..a756d66f04 100644 --- a/src/docs/guide/usage/linter/rules/jest/valid-describe-callback.md +++ b/src/docs/guide/usage/linter/rules/jest/valid-describe-callback.md @@ -47,7 +47,7 @@ describe("myFunction", () => })); ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/valid-describe-callback.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/valid-describe-callback.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/jest/valid-expect.md b/src/docs/guide/usage/linter/rules/jest/valid-expect.md index dc7933de3e..aefc750cdc 100644 --- a/src/docs/guide/usage/linter/rules/jest/valid-expect.md +++ b/src/docs/guide/usage/linter/rules/jest/valid-expect.md @@ -39,7 +39,7 @@ expect(true).toBeDefined(); expect(Promise.resolve("Hi!")).resolves.toBe("Hi!"); ``` -This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/valid-expect.md), +This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/valid-expect.md), to use it, add the following configuration to your `.oxlintrc.json`: ```json diff --git a/src/docs/guide/usage/linter/rules/oxc/bad-bitwise-operator.md b/src/docs/guide/usage/linter/rules/oxc/bad-bitwise-operator.md index bdcf94ec22..b5111f66b1 100644 --- a/src/docs/guide/usage/linter/rules/oxc/bad-bitwise-operator.md +++ b/src/docs/guide/usage/linter/rules/oxc/bad-bitwise-operator.md @@ -9,7 +9,7 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin
-🚧 An auto-fix is planned for this rule, but not implemented at this time. +💡 A suggestion is available for this rule.
diff --git a/src/docs/guide/usage/linter/rules/oxc/misrefactored-assign-op.md b/src/docs/guide/usage/linter/rules/oxc/misrefactored-assign-op.md index 5d64f64559..e9bbb27f0b 100644 --- a/src/docs/guide/usage/linter/rules/oxc/misrefactored-assign-op.md +++ b/src/docs/guide/usage/linter/rules/oxc/misrefactored-assign-op.md @@ -9,7 +9,7 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin
-🚧 An auto-fix is planned for this rule, but not implemented at this time. +💡 A suggestion is available for this rule.
diff --git a/src/docs/guide/usage/linter/rules/react/jsx-no-duplicate-props.md b/src/docs/guide/usage/linter/rules/react/jsx-no-duplicate-props.md index 192fba61ef..d6f8152a6e 100644 --- a/src/docs/guide/usage/linter/rules/react/jsx-no-duplicate-props.md +++ b/src/docs/guide/usage/linter/rules/react/jsx-no-duplicate-props.md @@ -35,6 +35,12 @@ Examples of **correct** code for this rule: ; ``` +### Differences from eslint-plugin-react + +This rule does not support the `ignoreCase` option. Props with different cases are +considered distinct and will not be flagged as duplicates (e.g., `` +is allowed). This is intentional, as props are case-sensitive in JSX. + ## 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/typescript/await-thenable.md b/src/docs/guide/usage/linter/rules/typescript/await-thenable.md index 77b17bd261..0fe7e4d23b 100644 --- a/src/docs/guide/usage/linter/rules/typescript/await-thenable.md +++ b/src/docs/guide/usage/linter/rules/typescript/await-thenable.md @@ -32,7 +32,7 @@ While it is valid JavaScript to await a non-Promise-like value (it will resolve Examples of **incorrect** code for this rule: -``` +```ts await 12; await (() => {}); @@ -43,11 +43,12 @@ await { then() {} }; // this is not a Promise - it's a function that returns a Promise declare const getPromise: () => Promise; await getPromise; +await getPromise; ``` Examples of **correct** code for this rule: -``` +```ts await Promise.resolve("value"); await Promise.reject(new Error()); @@ -61,6 +62,7 @@ await { // this is a Promise - produced by calling a function declare const getPromise: () => Promise; await getPromise(); +await getPromise(); ``` ## How to use diff --git a/src/docs/guide/usage/linter/rules/typescript/no-base-to-string.md b/src/docs/guide/usage/linter/rules/typescript/no-base-to-string.md index f6bf74da8f..de9a262b66 100644 --- a/src/docs/guide/usage/linter/rules/typescript/no-base-to-string.md +++ b/src/docs/guide/usage/linter/rules/typescript/no-base-to-string.md @@ -62,6 +62,20 @@ class CustomToString { new CustomToString().toString(); ``` +## Configuration + +This rule accepts a configuration object with the following properties: + +### ignoredTypeNames + +type: `string[]` + +default: `["Error", "RegExp", "URL", "URLSearchParams"]` + +A list of type names to ignore when checking for unsafe toString usage. +These types are considered safe to call toString on even if they don't +provide a custom implementation. + ## 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/typescript/no-deprecated.md b/src/docs/guide/usage/linter/rules/typescript/no-deprecated.md index 5f0cc5ef3f..c1ab705dcf 100644 --- a/src/docs/guide/usage/linter/rules/typescript/no-deprecated.md +++ b/src/docs/guide/usage/linter/rules/typescript/no-deprecated.md @@ -57,6 +57,55 @@ await apiV2(); // Using non-deprecated function const url2 = new URL("/foo", "http://www.example.com"); ``` +## Configuration + +This rule accepts a configuration object with the following properties: + +### allow + +type: `array` + +default: `[]` + +An array of type or value specifiers that are allowed to be used even if deprecated. +Use this to allow specific deprecated APIs that you intentionally want to continue using. + +#### allow[n] + +type: `string` + +Type or value specifier for matching specific declarations + +Supports four types of specifiers: + +1. **String specifier** (deprecated): Universal match by name + +```json +"Promise" +``` + +2. **File specifier**: Match types/values declared in local files + +```json +{ "from": "file", "name": "MyType" } +{ "from": "file", "name": ["Type1", "Type2"] } +{ "from": "file", "name": "MyType", "path": "./types.ts" } +``` + +3. **Lib specifier**: Match TypeScript built-in lib types + +```json +{ "from": "lib", "name": "Promise" } +{ "from": "lib", "name": ["Promise", "PromiseLike"] } +``` + +4. **Package specifier**: Match types/values from npm packages + +```json +{ "from": "package", "name": "Observable", "package": "rxjs" } +{ "from": "package", "name": ["Observable", "Subject"], "package": "rxjs" } +``` + ## 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/typescript/no-inferrable-types.md b/src/docs/guide/usage/linter/rules/typescript/no-inferrable-types.md index f0d79e6636..dd6071677b 100644 --- a/src/docs/guide/usage/linter/rules/typescript/no-inferrable-types.md +++ b/src/docs/guide/usage/linter/rules/typescript/no-inferrable-types.md @@ -9,7 +9,7 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin
-🚧 An auto-fix is planned for this rule, but not implemented at this time. +💡 A suggestion is available for this rule.
diff --git a/src/docs/guide/usage/linter/rules/typescript/no-meaningless-void-operator.md b/src/docs/guide/usage/linter/rules/typescript/no-meaningless-void-operator.md index e28efe196e..5747e484a0 100644 --- a/src/docs/guide/usage/linter/rules/typescript/no-meaningless-void-operator.md +++ b/src/docs/guide/usage/linter/rules/typescript/no-meaningless-void-operator.md @@ -64,6 +64,18 @@ function processData() { processData(); // no void needed since we don't care about return value ``` +## Configuration + +This rule accepts a configuration object with the following properties: + +### checkNever + +type: `boolean` + +default: `false` + +Whether to check `void` applied to expressions of type `never`. + ## 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/typescript/no-misused-spread.md b/src/docs/guide/usage/linter/rules/typescript/no-misused-spread.md index a29a84bfce..94bcb73485 100644 --- a/src/docs/guide/usage/linter/rules/typescript/no-misused-spread.md +++ b/src/docs/guide/usage/linter/rules/typescript/no-misused-spread.md @@ -66,6 +66,55 @@ const str = "hello"; const arr4 = Array.from(str); // ['h', 'e', 'l', 'l', 'o'] ``` +## Configuration + +This rule accepts a configuration object with the following properties: + +### allow + +type: `array` + +default: `[]` + +An array of type or value specifiers that are allowed to be spread +even if they would normally be flagged as misused. + +#### allow[n] + +type: `string` + +Type or value specifier for matching specific declarations + +Supports four types of specifiers: + +1. **String specifier** (deprecated): Universal match by name + +```json +"Promise" +``` + +2. **File specifier**: Match types/values declared in local files + +```json +{ "from": "file", "name": "MyType" } +{ "from": "file", "name": ["Type1", "Type2"] } +{ "from": "file", "name": "MyType", "path": "./types.ts" } +``` + +3. **Lib specifier**: Match TypeScript built-in lib types + +```json +{ "from": "lib", "name": "Promise" } +{ "from": "lib", "name": ["Promise", "PromiseLike"] } +``` + +4. **Package specifier**: Match types/values from npm packages + +```json +{ "from": "package", "name": "Observable", "package": "rxjs" } +{ "from": "package", "name": ["Observable", "Subject"], "package": "rxjs" } +``` + ## 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/typescript/prefer-enum-initializers.md b/src/docs/guide/usage/linter/rules/typescript/prefer-enum-initializers.md index 2a98888607..b1137ecdde 100644 --- a/src/docs/guide/usage/linter/rules/typescript/prefer-enum-initializers.md +++ b/src/docs/guide/usage/linter/rules/typescript/prefer-enum-initializers.md @@ -9,7 +9,7 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin
-🚧 An auto-fix is planned for this rule, but not implemented at this time. +💡 A suggestion is available for this rule.
diff --git a/src/docs/guide/usage/linter/rules/typescript/require-array-sort-compare.md b/src/docs/guide/usage/linter/rules/typescript/require-array-sort-compare.md index db86460937..7277a4e98f 100644 --- a/src/docs/guide/usage/linter/rules/typescript/require-array-sort-compare.md +++ b/src/docs/guide/usage/linter/rules/typescript/require-array-sort-compare.md @@ -72,6 +72,18 @@ people.sort((a, b) => a.age - b.age); people.sort((a, b) => a.name.localeCompare(b.name)); ``` +## Configuration + +This rule accepts a configuration object with the following properties: + +### ignoreStringArrays + +type: `boolean` + +default: `true` + +Whether to ignore arrays in which all elements are strings. + ## 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/unicorn/no-negation-in-equality-check.md b/src/docs/guide/usage/linter/rules/unicorn/no-negation-in-equality-check.md index 2b482df310..589021116f 100644 --- a/src/docs/guide/usage/linter/rules/unicorn/no-negation-in-equality-check.md +++ b/src/docs/guide/usage/linter/rules/unicorn/no-negation-in-equality-check.md @@ -9,7 +9,7 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin
-🚧 An auto-fix is planned for this rule, but not implemented at this time. +💡 A suggestion is available for this rule.
diff --git a/src/docs/guide/usage/linter/rules/unicorn/no-unnecessary-array-flat-depth.md b/src/docs/guide/usage/linter/rules/unicorn/no-unnecessary-array-flat-depth.md index 69817495c8..0664931158 100644 --- a/src/docs/guide/usage/linter/rules/unicorn/no-unnecessary-array-flat-depth.md +++ b/src/docs/guide/usage/linter/rules/unicorn/no-unnecessary-array-flat-depth.md @@ -9,7 +9,7 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin
-🚧 An auto-fix is planned for this rule, but not implemented at this time. +💡 A suggestion is available for this rule.
diff --git a/src/docs/guide/usage/linter/rules/version.data.js b/src/docs/guide/usage/linter/rules/version.data.js index 6f06a4187f..24b3261305 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 "5b1bf4a0fbf5cbe158cff25423ee176e29f283c0"; + return "853f6596db4980911dfa2fb421b04ae748de3e6d"; }, }; From c22c05985a9c37c7d8aa35df207f32987cfee55a Mon Sep 17 00:00:00 2001 From: Boshen Date: Fri, 19 Dec 2025 12:13:19 +0800 Subject: [PATCH 2/2] u --- .../guide/usage/linter/rules/typescript/await-thenable.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/docs/guide/usage/linter/rules/typescript/await-thenable.md b/src/docs/guide/usage/linter/rules/typescript/await-thenable.md index 0fe7e4d23b..77b17bd261 100644 --- a/src/docs/guide/usage/linter/rules/typescript/await-thenable.md +++ b/src/docs/guide/usage/linter/rules/typescript/await-thenable.md @@ -32,7 +32,7 @@ While it is valid JavaScript to await a non-Promise-like value (it will resolve Examples of **incorrect** code for this rule: -```ts +``` await 12; await (() => {}); @@ -43,12 +43,11 @@ await { then() {} }; // this is not a Promise - it's a function that returns a Promise declare const getPromise: () => Promise; await getPromise; -await getPromise; ``` Examples of **correct** code for this rule: -```ts +``` await Promise.resolve("value"); await Promise.reject(new Error()); @@ -62,7 +61,6 @@ await { // this is a Promise - produced by calling a function declare const getPromise: () => Promise; await getPromise(); -await getPromise(); ``` ## How to use