Skip to content

Commit 4828aef

Browse files
authored
Release 0.9.0 (oxc-project#178)
Co-authored-by: oxc-bot <[email protected]>
1 parent caf9c1a commit 4828aef

20 files changed

+130
-45
lines changed

oxc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit aa7718ab7bf0544b21564658a919307022f8824a
1+
Subproject commit 8109ed046d0e5c4274a9d2ba914090f80456f519

src/docs/guide/usage/linter/generated-cli.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<!-- textlint-disable -->
2-
31
## Usage
42

53
**`oxlint`** \[**`-c`**=_`<./oxlintrc.json>`_\] \[_`PATH`_\]...
@@ -123,5 +121,3 @@ Arguments:
123121
Prints help information
124122
- **`-V`**, **`--version`** &mdash;
125123
Prints version information
126-
127-
<!-- textlint-enable -->

src/docs/guide/usage/linter/generated-rules.md

+17-19
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
The progress of all rule implementations is tracked [here](https://github.com/oxc-project/oxc/issues/481).
44

5-
- Total number of rules: 411
6-
- Rules turned on by default: 92
5+
- Total number of rules: 413
6+
- Rules turned on by default: 93
77

8-
<!-- textlint-disable terminology -->
9-
10-
## Correctness (164):
8+
## Correctness (165):
119

1210
Code that is outright wrong or useless.
1311
| Rule name | Source | Default | Fixable? |
@@ -50,6 +48,7 @@ Code that is outright wrong or useless.
5048
| [no-unsafe-negation](/docs/guide/usage/linter/rules/eslint/no-unsafe-negation.html) | eslint || 🛠️ |
5149
| [no-unused-labels](/docs/guide/usage/linter/rules/eslint/no-unused-labels.html) | eslint || 🛠️ |
5250
| [no-unused-private-class-members](/docs/guide/usage/linter/rules/eslint/no-unused-private-class-members.html) | eslint || |
51+
| [no-unused-vars](/docs/guide/usage/linter/rules/eslint/no-unused-vars.html) | eslint || ⚠️💡 |
5352
| [no-useless-catch](/docs/guide/usage/linter/rules/eslint/no-useless-catch.html) | eslint || |
5453
| [no-useless-escape](/docs/guide/usage/linter/rules/eslint/no-useless-escape.html) | eslint || 🛠️ |
5554
| [no-useless-rename](/docs/guide/usage/linter/rules/eslint/no-useless-rename.html) | eslint || |
@@ -99,7 +98,7 @@ Code that is outright wrong or useless.
9998
| [no-aria-hidden-on-focusable](/docs/guide/usage/linter/rules/jsx_a11y/no-aria-hidden-on-focusable.html) | jsx_a11y | | 🛠️ |
10099
| [no-autofocus](/docs/guide/usage/linter/rules/jsx_a11y/no-autofocus.html) | jsx_a11y | | 🛠️ |
101100
| [no-distracting-elements](/docs/guide/usage/linter/rules/jsx_a11y/no-distracting-elements.html) | jsx_a11y | | |
102-
| [no-redundant-roles](/docs/guide/usage/linter/rules/jsx_a11y/no-redundant-roles.html) | jsx_a11y | | 🚧 |
101+
| [no-redundant-roles](/docs/guide/usage/linter/rules/jsx_a11y/no-redundant-roles.html) | jsx_a11y | | 🛠️ |
103102
| [prefer-tag-over-role](/docs/guide/usage/linter/rules/jsx_a11y/prefer-tag-over-role.html) | jsx_a11y | | |
104103
| [role-has-required-aria-props](/docs/guide/usage/linter/rules/jsx_a11y/role-has-required-aria-props.html) | jsx_a11y | | |
105104
| [role-supports-aria-props](/docs/guide/usage/linter/rules/jsx_a11y/role-supports-aria-props.html) | jsx_a11y | | |
@@ -144,7 +143,7 @@ Code that is outright wrong or useless.
144143
| [jsx-no-duplicate-props](/docs/guide/usage/linter/rules/react/jsx-no-duplicate-props.html) | react || |
145144
| [jsx-no-target-blank](/docs/guide/usage/linter/rules/react/jsx-no-target-blank.html) | react || |
146145
| [jsx-no-undef](/docs/guide/usage/linter/rules/react/jsx-no-undef.html) | react || |
147-
| [jsx-props-no-spread-multi](/docs/guide/usage/linter/rules/react/jsx-props-no-spread-multi.html) | react || 🚧 |
146+
| [jsx-props-no-spread-multi](/docs/guide/usage/linter/rules/react/jsx-props-no-spread-multi.html) | react || 🛠️ |
148147
| [no-children-prop](/docs/guide/usage/linter/rules/react/no-children-prop.html) | react || |
149148
| [no-direct-mutation-state](/docs/guide/usage/linter/rules/react/no-direct-mutation-state.html) | react || |
150149
| [no-find-dom-node](/docs/guide/usage/linter/rules/react/no-find-dom-node.html) | react || |
@@ -172,7 +171,7 @@ Code that is outright wrong or useless.
172171
| [no-useless-fallback-in-spread](/docs/guide/usage/linter/rules/unicorn/no-useless-fallback-in-spread.html) | unicorn || 🛠️ |
173172
| [no-useless-length-check](/docs/guide/usage/linter/rules/unicorn/no-useless-length-check.html) | unicorn || |
174173
| [no-useless-spread](/docs/guide/usage/linter/rules/unicorn/no-useless-spread.html) | unicorn || 🛠️ |
175-
| [prefer-set-size](/docs/guide/usage/linter/rules/unicorn/prefer-set-size.html) | unicorn || 🚧 |
174+
| [prefer-set-size](/docs/guide/usage/linter/rules/unicorn/prefer-set-size.html) | unicorn || 🛠️ |
176175
| [prefer-string-starts-ends-with](/docs/guide/usage/linter/rules/unicorn/prefer-string-starts-ends-with.html) | unicorn || 🛠️ |
177176
| [no-conditional-tests](/docs/guide/usage/linter/rules/vitest/no-conditional-tests.html) | vitest | | |
178177
| [require-local-test-context-for-concurrent-snapshots](/docs/guide/usage/linter/rules/vitest/require-local-test-context-for-concurrent-snapshots.html) | vitest | | |
@@ -326,8 +325,8 @@ Lints which are rather strict or have occasional false positives.
326325
| [no-useless-promise-resolve-reject](/docs/guide/usage/linter/rules/unicorn/no-useless-promise-resolve-reject.html) | unicorn | | 🛠️ |
327326
| [no-useless-switch-case](/docs/guide/usage/linter/rules/unicorn/no-useless-switch-case.html) | unicorn | | |
328327
| [no-useless-undefined](/docs/guide/usage/linter/rules/unicorn/no-useless-undefined.html) | unicorn | | 🛠️ |
329-
| [prefer-array-flat](/docs/guide/usage/linter/rules/unicorn/prefer-array-flat.html) | unicorn | | 🚧 |
330-
| [prefer-array-some](/docs/guide/usage/linter/rules/unicorn/prefer-array-some.html) | unicorn | | 🚧 |
328+
| [prefer-array-flat](/docs/guide/usage/linter/rules/unicorn/prefer-array-flat.html) | unicorn | | 🛠️ |
329+
| [prefer-array-some](/docs/guide/usage/linter/rules/unicorn/prefer-array-some.html) | unicorn | | 🛠️ |
331330
| [prefer-blob-reading-methods](/docs/guide/usage/linter/rules/unicorn/prefer-blob-reading-methods.html) | unicorn | | |
332331
| [prefer-code-point](/docs/guide/usage/linter/rules/unicorn/prefer-code-point.html) | unicorn | | 🛠️ |
333332
| [prefer-date-now](/docs/guide/usage/linter/rules/unicorn/prefer-date-now.html) | unicorn | | 🚧 |
@@ -339,13 +338,13 @@ Lints which are rather strict or have occasional false positives.
339338
| [prefer-native-coercion-functions](/docs/guide/usage/linter/rules/unicorn/prefer-native-coercion-functions.html) | unicorn | | 🚧 |
340339
| [prefer-prototype-methods](/docs/guide/usage/linter/rules/unicorn/prefer-prototype-methods.html) | unicorn | | 🛠️ |
341340
| [prefer-query-selector](/docs/guide/usage/linter/rules/unicorn/prefer-query-selector.html) | unicorn | | 🛠️ |
342-
| [prefer-regexp-test](/docs/guide/usage/linter/rules/unicorn/prefer-regexp-test.html) | unicorn | | 🚧 |
341+
| [prefer-regexp-test](/docs/guide/usage/linter/rules/unicorn/prefer-regexp-test.html) | unicorn | | 🛠️ |
343342
| [prefer-string-replace-all](/docs/guide/usage/linter/rules/unicorn/prefer-string-replace-all.html) | unicorn | | 🛠️ |
344-
| [prefer-string-slice](/docs/guide/usage/linter/rules/unicorn/prefer-string-slice.html) | unicorn | | 🚧 |
343+
| [prefer-string-slice](/docs/guide/usage/linter/rules/unicorn/prefer-string-slice.html) | unicorn | | 🛠️ |
345344
| [prefer-type-error](/docs/guide/usage/linter/rules/unicorn/prefer-type-error.html) | unicorn | | 🚧 |
346345
| [require-number-to-fixed-digits-argument](/docs/guide/usage/linter/rules/unicorn/require-number-to-fixed-digits-argument.html) | unicorn | | 🛠️ |
347346

348-
## Style (92):
347+
## Style (94):
349348

350349
Code that should be written in a more idiomatic way.
351350
| Rule name | Source | Default | Fixable? |
@@ -435,15 +434,17 @@ Code that should be written in a more idiomatic way.
435434
| [prefer-reflect-apply](/docs/guide/usage/linter/rules/unicorn/prefer-reflect-apply.html) | unicorn | | |
436435
| [prefer-spread](/docs/guide/usage/linter/rules/unicorn/prefer-spread.html) | unicorn | | 🛠️ |
437436
| [prefer-string-trim-start-end](/docs/guide/usage/linter/rules/unicorn/prefer-string-trim-start-end.html) | unicorn | | 🛠️ |
438-
| [require-array-join-separator](/docs/guide/usage/linter/rules/unicorn/require-array-join-separator.html) | unicorn | | 🚧 |
437+
| [prefer-structured-clone](/docs/guide/usage/linter/rules/unicorn/prefer-structured-clone.html) | unicorn | | 🚧 |
438+
| [require-array-join-separator](/docs/guide/usage/linter/rules/unicorn/require-array-join-separator.html) | unicorn | | 🛠️ |
439439
| [switch-case-braces](/docs/guide/usage/linter/rules/unicorn/switch-case-braces.html) | unicorn | | 🛠️ |
440-
| [text-encoding-identifier-case](/docs/guide/usage/linter/rules/unicorn/text-encoding-identifier-case.html) | unicorn | | 🚧 |
440+
| [text-encoding-identifier-case](/docs/guide/usage/linter/rules/unicorn/text-encoding-identifier-case.html) | unicorn | | 🛠️ |
441441
| [throw-new-error](/docs/guide/usage/linter/rules/unicorn/throw-new-error.html) | unicorn | | 🚧 |
442442
| [no-import-node-test](/docs/guide/usage/linter/rules/vitest/no-import-node-test.html) | vitest | | 🛠️ |
443+
| [prefer-each](/docs/guide/usage/linter/rules/vitest/prefer-each.html) | vitest | | |
443444
| [prefer-to-be-falsy](/docs/guide/usage/linter/rules/vitest/prefer-to-be-falsy.html) | vitest | | 🛠️ |
444445
| [prefer-to-be-truthy](/docs/guide/usage/linter/rules/vitest/prefer-to-be-truthy.html) | vitest | | 🛠️ |
445446

446-
## Nursery (11):
447+
## Nursery (10):
447448

448449
New lints that are still under development.
449450
| Rule name | Source | Default | Fixable? |
@@ -452,12 +453,9 @@ New lints that are still under development.
452453
| [getter-return](/docs/guide/usage/linter/rules/eslint/getter-return.html) | eslint | | |
453454
| [no-undef](/docs/guide/usage/linter/rules/eslint/no-undef.html) | eslint | | |
454455
| [no-unreachable](/docs/guide/usage/linter/rules/eslint/no-unreachable.html) | eslint | | |
455-
| [no-unused-vars](/docs/guide/usage/linter/rules/eslint/no-unused-vars.html) | eslint | | ⚠️💡 |
456456
| [export](/docs/guide/usage/linter/rules/import/export.html) | import | | |
457457
| [no-return-in-finally](/docs/guide/usage/linter/rules/promise/no-return-in-finally.html) | promise | | |
458458
| [require-render-return](/docs/guide/usage/linter/rules/react/require-render-return.html) | react | | |
459459
| [rules-of-hooks](/docs/guide/usage/linter/rules/react/rules-of-hooks.html) | react | | |
460460
| [no-side-effects-in-initialization](/docs/guide/usage/linter/rules/tree_shaking/no-side-effects-in-initialization.html) | tree_shaking | | |
461461
| [consistent-type-imports](/docs/guide/usage/linter/rules/typescript/consistent-type-imports.html) | typescript | | 🛠️ |
462-
463-
<!-- textlint-enable -->

src/docs/guide/usage/linter/rules/eslint/func-names.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ the name of the function expression in the stack trace.
2424

2525
This rule has a string option:
2626

27-
- `"always"` requires a function expression to have a name under all circumstances.
28-
- `"as-needed"` requires a function expression to have a name only when one will not be automatically inferred by the runtime.
29-
- `"never"` requires a function expression to not have a name under any circumstances.
27+
- `"always"` requires a function expression to have a name under all
28+
circumstances.
29+
- `"as-needed"` requires a function expression to have a name only when
30+
one will not be automatically inferred by the runtime.
31+
- `"never"` requires a function expression to not have a name under any
32+
circumstances.
3033

3134
### Example
3235

src/docs/guide/usage/linter/rules/eslint/no-unused-vars.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
22

3-
# eslint/no-unused-vars <Badge type="info" text="Nursery" />
3+
# eslint/no-unused-vars <Badge type="info" text="Correctness" />
44

55
<div class="rule-meta">
6+
<Alert class="default-on" type="success">
7+
<span class="emoji">✅</span> This rule is turned on by default.
8+
</Alert>
69
<Alert class="fix" type="info">
710
<span class="emoji">⚠️💡</span> A dangerous suggestion is available for this rule.
811
</Alert>
@@ -33,7 +36,8 @@ true:
3336
- It is called (`foo()`) or constructed (`new foo()`)
3437
- It is read (`var bar = foo`)
3538
- It is passed into a function or constructor as an argument (`doSomething(foo)`)
36-
- It is read inside of a function that is passed to another function (`doSomething(function() { foo(); })`)
39+
- It is read inside of a function that is passed to another function
40+
(`doSomething(function() { foo(); })`)
3741
- It is exported (`export const foo = 42`)
3842
- It is used as an operand to TypeScript's `typeof` operator (`const bar:
3943
typeof foo = 4`)

src/docs/guide/usage/linter/rules/jest/prefer-expect-resolves.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
When working with promises, there are two primary ways you can test the resolved
1414
value:
1515

16-
1. use the `resolve` modifier on `expect` (`await expect(...).resolves.<matcher>` style)
17-
2. `await` the promise and assert against its result (`expect(await ...).<matcher>` style)
16+
1. use the `resolve` modifier on `expect`
17+
(`await expect(...).resolves.<matcher>` style)
18+
2. `await` the promise and assert against its result
19+
(`expect(await ...).<matcher>` style)
1820

1921
While the second style is arguably less dependent on `jest`, if the promise
2022
rejects it will be treated as a general error, resulting in less predictable

src/docs/guide/usage/linter/rules/jsx_a11y/anchor-is-valid.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ All these anchor implementations indicate that the element is only used to execu
4646

4747
There are **many reasons** why an anchor should not have a logic and have a correct `href` attribute:
4848

49-
- it can disrupt the correct flow of the user navigation e.g. a user that wants to open the link in another tab, but the default "click" behaviour is prevented
49+
- it can disrupt the correct flow of the user navigation e.g. a user that wants to open the link
50+
in another tab, but the default "click" behaviour is prevented
5051
- it can source of invalid links, and crawlers can't navigate the website, risking to penalise SEO ranking
5152

5253
### Example

src/docs/guide/usage/linter/rules/jsx_a11y/no-redundant-roles.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
7-
<span class="emoji">🚧</span> An auto-fix is still under development.
7+
<span class="emoji">🛠️</span> An auto-fix is available for this rule.
88
</Alert>
99
</div>
1010

src/docs/guide/usage/linter/rules/react/jsx-curly-brace-presence.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ that option for checking on both JSX props and children.
163163
The fix also deals with template literals, strings with quotes, and
164164
strings with escapes characters.
165165

166-
- If the rule is set to get rid of unnecessary curly braces and the template literal inside a JSX expression has no expression, it will throw a warning and be fixed with double quotes. For example:
166+
- If the rule is set to get rid of unnecessary curly braces and the
167+
template literal inside a JSX expression has no expression, it will
168+
throw a warning and be fixed with double quotes. For example:
167169

168170
```jsx
169171
<App prop={`Hello world`}>{`Hello world`}</App>
@@ -175,7 +177,10 @@ strings with escapes characters.
175177
<App prop="Hello world">Hello world</App>
176178
```
177179

178-
- If the rule is set to enforce curly braces and the strings have quotes, it will be fixed with double quotes for JSX children and the normal way for JSX attributes. Also, double quotes will be escaped in the fix.
180+
- If the rule is set to enforce curly braces and the strings have
181+
quotes, it will be fixed with double quotes for JSX children and the
182+
normal way for JSX attributes. Also, double quotes will be escaped in
183+
the fix.
179184

180185
For example:
181186

@@ -189,7 +194,12 @@ strings with escapes characters.
189194
<App prop={'Hello "foo" world'}>{"Hello 'foo' \"bar\" world"}</App>
190195
```
191196

192-
- If the rule is set to get rid of unnecessary curly braces(JSX expression) and there are characters that need to be escaped in its JSX form, such as quote characters, [forbidden JSX text characters](https://facebook.github.io/jsx/), escaped characters and anything that looks like HTML entity names, the code will not be warned because the fix may make the code less readable.
197+
- If the rule is set to get rid of unnecessary curly braces(JSX
198+
expression) and there are characters that need to be escaped in its JSX
199+
form, such as quote characters, [forbidden JSX text
200+
characters](https://facebook.github.io/jsx/), escaped characters and
201+
anything that looks like HTML entity names, the code will not be warned
202+
because the fix may make the code less readable.
193203

194204
Examples of **correct** code for this rule, even when configured with `"never"`:
195205

src/docs/guide/usage/linter/rules/react/jsx-props-no-spread-multi.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<span class="emoji">✅</span> This rule is turned on by default.
88
</Alert>
99
<Alert class="fix" type="info">
10-
<span class="emoji">🚧</span> An auto-fix is still under development.
10+
<span class="emoji">🛠️</span> An auto-fix is available for this rule.
1111
</Alert>
1212
</div>
1313

src/docs/guide/usage/linter/rules/unicorn/no-null.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
7-
<span class="emoji">🛠️</span> An auto-fix is available for this rule.
7+
<span class="emoji">🛠️</span> An auto-fix is available for this rule for some violations.
88
</Alert>
99
</div>
1010

src/docs/guide/usage/linter/rules/unicorn/prefer-array-flat.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
7-
<span class="emoji">🚧</span> An auto-fix is still under development.
7+
<span class="emoji">🛠️</span> An auto-fix is available for this rule for some violations.
88
</Alert>
99
</div>
1010

src/docs/guide/usage/linter/rules/unicorn/prefer-array-some.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
7-
<span class="emoji">🚧</span> An auto-fix is still under development.
7+
<span class="emoji">🛠️</span> An auto-fix is available for this rule.
88
</Alert>
99
</div>
1010

src/docs/guide/usage/linter/rules/unicorn/prefer-regexp-test.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
7-
<span class="emoji">🚧</span> An auto-fix is still under development.
7+
<span class="emoji">🛠️</span> An auto-fix is available for this rule.
88
</Alert>
99
</div>
1010

src/docs/guide/usage/linter/rules/unicorn/prefer-set-size.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<span class="emoji">✅</span> This rule is turned on by default.
88
</Alert>
99
<Alert class="fix" type="info">
10-
<span class="emoji">🚧</span> An auto-fix is still under development.
10+
<span class="emoji">🛠️</span> An auto-fix is available for this rule.
1111
</Alert>
1212
</div>
1313

src/docs/guide/usage/linter/rules/unicorn/prefer-string-slice.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
7-
<span class="emoji">🚧</span> An auto-fix is still under development.
7+
<span class="emoji">🛠️</span> An auto-fix is available for this rule.
88
</Alert>
99
</div>
1010

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
2+
3+
# unicorn/prefer-structured-clone <Badge type="info" text="Style" />
4+
5+
<div class="rule-meta">
6+
<Alert class="fix" type="info">
7+
<span class="emoji">🚧</span> An auto-fix is still under development.
8+
</Alert>
9+
</div>
10+
11+
### What it does
12+
13+
Prefer using structuredClone to create a deep clone.
14+
15+
### Why is this bad?
16+
17+
structuredClone is the modern way to create a deep clone of a value.
18+
19+
### Examples
20+
21+
Examples of **incorrect** code for this rule:
22+
23+
```js
24+
const clone = JSON.parse(JSON.stringify(foo));
25+
26+
const clone = _.cloneDeep(foo);
27+
```
28+
29+
Examples of **correct** code for this rule:
30+
31+
```js
32+
const clone = structuredClone(foo);
33+
```
34+
35+
## References
36+
37+
- [Rule Source](https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/rules/unicorn/prefer_structured_clone.rs)

src/docs/guide/usage/linter/rules/unicorn/require-array-join-separator.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
7-
<span class="emoji">🚧</span> An auto-fix is still under development.
7+
<span class="emoji">🛠️</span> An auto-fix is available for this rule for some violations.
88
</Alert>
99
</div>
1010

src/docs/guide/usage/linter/rules/unicorn/text-encoding-identifier-case.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
7-
<span class="emoji">🚧</span> An auto-fix is still under development.
7+
<span class="emoji">🛠️</span> An auto-fix is available for this rule.
88
</Alert>
99
</div>
1010

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
2+
3+
# vitest/prefer-each <Badge type="info" text="Style" />
4+
5+
<div class="rule-meta">
6+
</div>
7+
8+
### What it does
9+
10+
This rule enforces using `each` rather than manual loops.
11+
12+
### Examples
13+
14+
Examples of **incorrect** code for this rule:
15+
16+
```js
17+
for (const item of items) {
18+
describe(item, () => {
19+
expect(item).toBe("foo");
20+
});
21+
}
22+
```
23+
24+
Examples of **correct** code for this rule:
25+
26+
```js
27+
describe.each(items)("item", (item) => {
28+
expect(item).toBe("foo");
29+
});
30+
```
31+
32+
## References
33+
34+
- [Rule Source](https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/rules/vitest/prefer_each.rs)

0 commit comments

Comments
 (0)