refactor(linter): move rule prefer-each from vitest to jest + remapping (#8448)

they are the same: 

https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/prefer-each.ts


https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/src/rules/prefer-each.ts
This commit is contained in:
Alexander S. 2025-01-14 10:41:41 +01:00 committed by GitHub
parent c6260c278b
commit bf00f82268
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 542 additions and 126 deletions

View file

@ -238,6 +238,7 @@ mod jest {
pub mod no_untyped_mock_factory;
pub mod prefer_called_with;
pub mod prefer_comparison_matcher;
pub mod prefer_each;
pub mod prefer_equality_matcher;
pub mod prefer_expect_resolves;
pub mod prefer_hooks_in_order;
@ -517,7 +518,6 @@ mod promise {
mod vitest {
pub mod no_conditional_tests;
pub mod no_import_node_test;
pub mod prefer_each;
pub mod prefer_to_be_falsy;
pub mod prefer_to_be_object;
pub mod prefer_to_be_truthy;
@ -708,6 +708,7 @@ oxc_macros::declare_all_lint_rules! {
jest::no_test_prefixes,
jest::no_test_return_statement,
jest::no_untyped_mock_factory,
jest::prefer_each,
jest::prefer_called_with,
jest::prefer_comparison_matcher,
jest::prefer_equality_matcher,
@ -1004,7 +1005,6 @@ oxc_macros::declare_all_lint_rules! {
unicorn::throw_new_error,
vitest::no_conditional_tests,
vitest::no_import_node_test,
vitest::prefer_each,
vitest::prefer_to_be_falsy,
vitest::prefer_to_be_object,
vitest::prefer_to_be_truthy,

View file

@ -64,7 +64,7 @@ declare_oxc_lint!(
/// })
/// ```
PreferEach,
vitest,
jest,
style,
);
@ -147,7 +147,140 @@ impl PreferEach {
fn test() {
use crate::tester::Tester;
let pass = vec![
let pass_jest = vec![
r#"it("is true", () => { expect(true).toBe(false) });"#,
r#"it.each(getNumbers())("only returns numbers that are greater than seven", number => {
expect(number).toBeGreaterThan(7);
});"#,
r#"it("returns numbers that are greater than five", function () {
for (const number of getNumbers()) {
expect(number).toBeGreaterThan(5);
}
});"#,
r#"it("returns things that are less than ten", function () {
for (const thing in things) {
expect(thing).toBeLessThan(10);
}
});"#,
r#"it("only returns numbers that are greater than seven", function () {
const numbers = getNumbers();
for (let i = 0; i < numbers.length; i++) {
expect(numbers[i]).toBeGreaterThan(7);
}
});"#,
];
let fail_jest = vec![
"for (const [input, expected] of data) {
it(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}",
"for (const [input, expected] of data) {
describe(\\`when the input is $\\{input}\\`, () => {
it(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
});
}",
"for (const [input, expected] of data) {
describe(\\`when the input is $\\{input}\\`, () => {
it(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
});
}
for (const [input, expected] of data) {
it.skip(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}",
"for (const [input, expected] of data) {
it.skip(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}",
"it('is true', () => {
expect(true).toBe(false);
});
for (const [input, expected] of data) {
it.skip(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}",
"for (const [input, expected] of data) {
it.skip(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}
it('is true', () => {
expect(true).toBe(false);
});",
"it('is true', () => {
expect(true).toBe(false);
});
for (const [input, expected] of data) {
it.skip(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}
it('is true', () => {
expect(true).toBe(false);
});",
"for (const [input, expected] of data) {
it(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
it(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}",
"for (const [input, expected] of data) {
it(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}
for (const [input, expected] of data) {
it(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}",
"for (const [input, expected] of data) {
it(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}
for (const [input, expected] of data) {
test(\\`results in $\\{expected}\\`, () => {
expect(fn(input)).toBe(expected)
});
}",
"for (const [input, expected] of data) {
beforeEach(() => setupSomething(input));
test(\\`results in $\\{expected}\\`, () => {
expect(doSomething()).toBe(expected)
});
}",
r#"for (const [input, expected] of data) {
it("only returns numbers that are greater than seven", function () {
const numbers = getNumbers(input);
for (let i = 0; i < numbers.length; i++) {
expect(numbers[i]).toBeGreaterThan(7);
}
});
}"#,
r#"for (const [input, expected] of data) {
beforeEach(() => setupSomething(input));
it("only returns numbers that are greater than seven", function () {
const numbers = getNumbers();
for (let i = 0; i < numbers.length; i++) {
expect(numbers[i]).toBeGreaterThan(7);
}
});
}"#,
];
let pass_vitest = vec![
r#"it("is true", () => { expect(true).toBe(false) });"#,
r#"it.each(getNumbers())("only returns numbers that are greater than seven", number => {
expect(number).toBeGreaterThan(7);
@ -171,7 +304,7 @@ fn test() {
});"#,
];
let fail = vec![
let fail_vitest = vec![
" for (const [input, expected] of data) {
it(`results in ${expected}`, () => {
expect(fn(input)).toBe(expected)
@ -286,5 +419,12 @@ fn test() {
"#,
];
let mut pass = vec![];
pass.extend(pass_jest);
pass.extend(pass_vitest);
let mut fail = vec![];
fail.extend(fail_jest);
fail.extend(fail_vitest);
Tester::new(PreferEach::NAME, PreferEach::PLUGIN, pass, fail).test_and_snapshot();
}

View file

@ -0,0 +1,396 @@
---
source: crates/oxc_linter/src/tester.rs
snapshot_kind: text
---
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:10]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:24]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Expected `,` but found `}`
╭─[prefer_each.tsx:2:33]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ┬
· ╰── `,` expected
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:16]
1 │ for (const [input, expected] of data) {
2 │ describe(\`when the input is $\{input}\`, () => {
· ─
3 │ it(\`results in $\{expected}\`, () => {
╰────
× Expected `,` but found `Identifier`
╭─[prefer_each.tsx:2:22]
1 │ for (const [input, expected] of data) {
2 │ describe(\`when the input is $\{input}\`, () => {
· ─┬─
· ╰── `,` expected
3 │ it(\`results in $\{expected}\`, () => {
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:16]
1 │ for (const [input, expected] of data) {
2 │ describe(\`when the input is $\{input}\`, () => {
· ─
3 │ it(\`results in $\{expected}\`, () => {
╰────
× Expected `,` but found `Identifier`
╭─[prefer_each.tsx:2:22]
1 │ for (const [input, expected] of data) {
2 │ describe(\`when the input is $\{input}\`, () => {
· ─┬─
· ╰── `,` expected
3 │ it(\`results in $\{expected}\`, () => {
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:15]
1 │ for (const [input, expected] of data) {
2 │ it.skip(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:29]
1 │ for (const [input, expected] of data) {
2 │ it.skip(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Expected `,` but found `}`
╭─[prefer_each.tsx:2:38]
1 │ for (const [input, expected] of data) {
2 │ it.skip(\`results in $\{expected}\`, () => {
· ┬
· ╰── `,` expected
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:5:15]
4 │ for (const [input, expected] of data) {
5 │ it.skip(\`results in $\{expected}\`, () => {
· ─
6 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:5:29]
4 │ for (const [input, expected] of data) {
5 │ it.skip(\`results in $\{expected}\`, () => {
· ─
6 │ expect(fn(input)).toBe(expected)
╰────
× Expected `,` but found `}`
╭─[prefer_each.tsx:5:38]
4 │ for (const [input, expected] of data) {
5 │ it.skip(\`results in $\{expected}\`, () => {
· ┬
· ╰── `,` expected
6 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:15]
1 │ for (const [input, expected] of data) {
2 │ it.skip(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:29]
1 │ for (const [input, expected] of data) {
2 │ it.skip(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Expected `,` but found `}`
╭─[prefer_each.tsx:2:38]
1 │ for (const [input, expected] of data) {
2 │ it.skip(\`results in $\{expected}\`, () => {
· ┬
· ╰── `,` expected
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:5:15]
4 │ for (const [input, expected] of data) {
5 │ it.skip(\`results in $\{expected}\`, () => {
· ─
6 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:5:29]
4 │ for (const [input, expected] of data) {
5 │ it.skip(\`results in $\{expected}\`, () => {
· ─
6 │ expect(fn(input)).toBe(expected)
╰────
× Expected `,` but found `}`
╭─[prefer_each.tsx:5:38]
4 │ for (const [input, expected] of data) {
5 │ it.skip(\`results in $\{expected}\`, () => {
· ┬
· ╰── `,` expected
6 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:10]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:24]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Expected `,` but found `}`
╭─[prefer_each.tsx:2:33]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ┬
· ╰── `,` expected
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:10]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:24]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Expected `,` but found `}`
╭─[prefer_each.tsx:2:33]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ┬
· ╰── `,` expected
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:10]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:2:24]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ─
3 │ expect(fn(input)).toBe(expected)
╰────
× Expected `,` but found `}`
╭─[prefer_each.tsx:2:33]
1 │ for (const [input, expected] of data) {
2 │ it(\`results in $\{expected}\`, () => {
· ┬
· ╰── `,` expected
3 │ expect(fn(input)).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:3:12]
2 │ beforeEach(() => setupSomething(input));
3 │ test(\`results in $\{expected}\`, () => {
· ─
4 │ expect(doSomething()).toBe(expected)
╰────
× Invalid Unicode escape sequence
╭─[prefer_each.tsx:3:26]
2 │ beforeEach(() => setupSomething(input));
3 │ test(\`results in $\{expected}\`, () => {
· ─
4 │ expect(doSomething()).toBe(expected)
╰────
× Expected `,` but found `}`
╭─[prefer_each.tsx:3:35]
2 │ beforeEach(() => setupSomething(input));
3 │ test(\`results in $\{expected}\`, () => {
· ┬
· ╰── `,` expected
4 │ expect(doSomething()).toBe(expected)
╰────
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it("only returns numbers that are greater than seven", function () {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ beforeEach(() => setupSomething(input));
╰────
help: Prefer using `describe.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:3]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:2]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ describe(`when the input is ${input}`, () => {
╰────
help: Prefer using `describe.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ describe(`when the input is ${input}`, () => {
╰────
help: Prefer using `describe.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:9:11]
8 │
9 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
10 │ it.skip(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it.skip(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:5:11]
4 │
5 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
6 │ it.skip(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:2]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it.skip(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:5:11]
4 │
5 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
6 │ it.skip(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:7:11]
6 │
7 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
8 │ it(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ beforeEach(() => setupSomething(input));
╰────
help: Prefer using `describe.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:2:11]
1 │
2 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
3 │ it("only returns numbers that are greater than seven", function () {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-jest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:2:11]
1 │
2 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
3 │ beforeEach(() => setupSomething(input));
╰────
help: Prefer using `describe.each` rather than a manual loop.

View file

@ -1,121 +0,0 @@
---
source: crates/oxc_linter/src/tester.rs
snapshot_kind: text
---
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:3]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:2]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ describe(`when the input is ${input}`, () => {
╰────
help: Prefer using `describe.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ describe(`when the input is ${input}`, () => {
╰────
help: Prefer using `describe.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:9:11]
8 │
9 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
10 │ it.skip(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it.skip(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:5:11]
4 │
5 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
6 │ it.skip(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:2]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it.skip(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:5:11]
4 │
5 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
6 │ it.skip(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ it(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:7:11]
6 │
7 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
8 │ it(`results in ${expected}`, () => {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:1:1]
1 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
2 │ beforeEach(() => setupSomething(input));
╰────
help: Prefer using `describe.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:2:11]
1 │
2 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
3 │ it("only returns numbers that are greater than seven", function () {
╰────
help: Prefer using `it.each` rather than a manual loop.
⚠ eslint-plugin-vitest(prefer-each): Enforce using `each` rather than manual loops
╭─[prefer_each.tsx:2:11]
1 │
2 │ for (const [input, expected] of data) {
· ──────────────────────────────────────
3 │ beforeEach(() => setupSomething(input));
╰────
help: Prefer using `describe.each` rather than a manual loop.

View file

@ -29,6 +29,7 @@ const VITEST_COMPATIBLE_JEST_RULES: phf::Set<&'static str> = phf::phf_set! {
"no-identical-title",
"no-restricted-jest-methods",
"no-test-prefixes",
"prefer-each",
"prefer-hooks-in-order",
"valid-describe-callback",
"valid-expect",