diff --git a/crates/oxc_linter/src/rules/vitest/prefer_to_be_object.rs b/crates/oxc_linter/src/rules/vitest/prefer_to_be_object.rs index cfd966d51512e..7550ce70a70ca 100644 --- a/crates/oxc_linter/src/rules/vitest/prefer_to_be_object.rs +++ b/crates/oxc_linter/src/rules/vitest/prefer_to_be_object.rs @@ -16,8 +16,8 @@ use crate::{ }; fn prefer_to_be_object(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Enforce using `toBeObject()`") - .with_help("Prefer `toBeObject()` to test if a value is an object.") + OxcDiagnostic::warn("Prefer `toBeObject()` for object assertions") + .with_help("Consider using `toBeObject()` to test if a value is an object.") .with_label(span) } @@ -38,7 +38,7 @@ pub struct PreferToBeObject; declare_oxc_lint!( /// ### What it does /// - /// This rule enforce using `toBeObject()` when expect typeof `Object`. + /// This rule enforces using `toBeObject()` to check if a value is of type `Object`. /// /// ### Why is this bad? /// diff --git a/crates/oxc_linter/src/snapshots/prefer_to_be_object.snap b/crates/oxc_linter/src/snapshots/prefer_to_be_object.snap index 5ec35feaeefd4..1593342d17949 100644 --- a/crates/oxc_linter/src/snapshots/prefer_to_be_object.snap +++ b/crates/oxc_linter/src/snapshots/prefer_to_be_object.snap @@ -1,58 +1,58 @@ --- source: crates/oxc_linter/src/tester.rs --- - ⚠ eslint-plugin-vitest(prefer-to-be-object): Enforce using `toBeObject()` + ⚠ eslint-plugin-vitest(prefer-to-be-object): Prefer `toBeObject()` for object assertions ╭─[prefer_to_be_object.tsx:1:36] 1 │ expectTypeOf({} instanceof Object).toBeTruthy(); · ────────── ╰──── - help: Prefer `toBeObject()` to test if a value is an object. + help: Consider using `toBeObject()` to test if a value is an object. - ⚠ eslint-plugin-vitest(prefer-to-be-object): Enforce using `toBeObject()` + ⚠ eslint-plugin-vitest(prefer-to-be-object): Prefer `toBeObject()` for object assertions ╭─[prefer_to_be_object.tsx:1:40] 1 │ expectTypeOf({} instanceof Object).not.toBeTruthy(); · ────────── ╰──── - help: Prefer `toBeObject()` to test if a value is an object. + help: Consider using `toBeObject()` to test if a value is an object. - ⚠ eslint-plugin-vitest(prefer-to-be-object): Enforce using `toBeObject()` + ⚠ eslint-plugin-vitest(prefer-to-be-object): Prefer `toBeObject()` for object assertions ╭─[prefer_to_be_object.tsx:1:36] 1 │ expectTypeOf({} instanceof Object).toBeFalsy(); · ───────── ╰──── - help: Prefer `toBeObject()` to test if a value is an object. + help: Consider using `toBeObject()` to test if a value is an object. - ⚠ eslint-plugin-vitest(prefer-to-be-object): Enforce using `toBeObject()` + ⚠ eslint-plugin-vitest(prefer-to-be-object): Prefer `toBeObject()` for object assertions ╭─[prefer_to_be_object.tsx:1:40] 1 │ expectTypeOf({} instanceof Object).not.toBeFalsy(); · ───────── ╰──── - help: Prefer `toBeObject()` to test if a value is an object. + help: Consider using `toBeObject()` to test if a value is an object. - ⚠ eslint-plugin-vitest(prefer-to-be-object): Enforce using `toBeObject()` + ⚠ eslint-plugin-vitest(prefer-to-be-object): Prefer `toBeObject()` for object assertions ╭─[prefer_to_be_object.tsx:1:18] 1 │ expectTypeOf({}).toBeInstanceOf(Object); · ────────────── ╰──── - help: Prefer `toBeObject()` to test if a value is an object. + help: Consider using `toBeObject()` to test if a value is an object. - ⚠ eslint-plugin-vitest(prefer-to-be-object): Enforce using `toBeObject()` + ⚠ eslint-plugin-vitest(prefer-to-be-object): Prefer `toBeObject()` for object assertions ╭─[prefer_to_be_object.tsx:1:22] 1 │ expectTypeOf({}).not.toBeInstanceOf(Object); · ────────────── ╰──── - help: Prefer `toBeObject()` to test if a value is an object. + help: Consider using `toBeObject()` to test if a value is an object. - ⚠ eslint-plugin-vitest(prefer-to-be-object): Enforce using `toBeObject()` + ⚠ eslint-plugin-vitest(prefer-to-be-object): Prefer `toBeObject()` for object assertions ╭─[prefer_to_be_object.tsx:1:40] 1 │ expectTypeOf(requestValues()).resolves.toBeInstanceOf(Object); · ────────────── ╰──── - help: Prefer `toBeObject()` to test if a value is an object. + help: Consider using `toBeObject()` to test if a value is an object. - ⚠ eslint-plugin-vitest(prefer-to-be-object): Enforce using `toBeObject()` + ⚠ eslint-plugin-vitest(prefer-to-be-object): Prefer `toBeObject()` for object assertions ╭─[prefer_to_be_object.tsx:1:39] 1 │ expectTypeOf(queryApi()).resolves.not.toBeInstanceOf(Object); · ────────────── ╰──── - help: Prefer `toBeObject()` to test if a value is an object. + help: Consider using `toBeObject()` to test if a value is an object.