vitest/prefer-to-be-truthy
@vitest/eslint-plugin
Safe autofix
eslint.config.js
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/prefer-to-be-truthy": "error",
},
},
];expect(foo).toBe(true)
expectTypeOf(foo).toBe(true)expect(foo).toBeTruthy()
expectTypeOf(foo).toBeTruthy()Examples from the Oxlint 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/prefer-to-be-truthy
@vitest/eslint-plugin
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/prefer-to-be-truthy": "error",
},
},
];vitest/prefer-to-be-truthy
vitest plugin · style
{
"plugins": [
"vitest"
],
"rules": {
"vitest/prefer-to-be-truthy": "error"
}
}Biome does not have this rule.
Ensure that every expect.poll call is awaited