vitest/prefer-to-be-object
@vitest/eslint-plugin
Safe autofix
eslint.config.js
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/prefer-to-be-object": "error",
},
},
];expectTypeOf({}).toBeInstanceOf(Object);
expectTypeOf({} instanceof Object).toBeTruthy();expectTypeOf({}).toBeObject();
expectTypeOf({}).toBeObject();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-object
@vitest/eslint-plugin
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/prefer-to-be-object": "error",
},
},
];vitest/prefer-to-be-object
vitest plugin · style
{
"plugins": [
"vitest"
],
"rules": {
"vitest/prefer-to-be-object": "error"
}
}Biome does not have this rule.
Enforce using toBe(true) and toBe(false) over matchers that coerce types to boolean
Ensure that every expect.poll call is awaited