vitest/prefer-to-be
@vitest/eslint-plugin
Safe autofix
eslint.config.js
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/prefer-to-be": "error",
},
},
];import { test } from 'vitest'
test('foo', () => {
expect(1).toEqual(1)
})import { test } from 'vitest'
test('foo', () => {
expect(1).toBe(1)
})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/prefer-to-be
@vitest/eslint-plugin
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/prefer-to-be": "error",
},
},
];vitest/prefer-to-be
vitest plugin · style
{
"plugins": [
"vitest"
],
"rules": {
"vitest/prefer-to-be": "error"
}
}Biome does not have this rule.
Enforce using toBe(true) and toBe(false) over matchers that coerce types to boolean
Enforce including a hint with external snapshots