vitest/no-conditional-in-test
@vitest/eslint-plugin
No autofix
eslint.config.js
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/no-conditional-in-test": "error",
},
},
];test('my test', () => {
if (true) {
doTheThing()
}
})test('my test', () => {
expect(true).toBe(true)
})Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
vitest/no-conditional-in-test
@vitest/eslint-plugin
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/no-conditional-in-test": "error",
},
},
];vitest/no-conditional-in-test
vitest plugin · pedantic
{
"plugins": [
"vitest"
],
"rules": {
"vitest/no-conditional-in-test": "error"
}
}Biome does not have this rule.
Enforce hoisted APIs to be on top of the file