From 41382fd0f66a06a1310407cafd84288f5e142aff Mon Sep 17 00:00:00 2001 From: shulaoda Date: Sat, 31 Aug 2024 23:09:50 +0800 Subject: [PATCH] chore: add why is this bad --- crates/oxc_linter/src/rules/vitest/prefer_to_be_object.rs | 4 ++++ 1 file changed, 4 insertions(+) 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 e7d0d4884fa6c..cfd966d51512e 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 @@ -40,6 +40,10 @@ declare_oxc_lint!( /// /// This rule enforce using `toBeObject()` when expect typeof `Object`. /// + /// ### Why is this bad? + /// + /// Using other methods such as `toBeInstanceOf(Object)` or `instanceof Object` can be less clear and potentially misleading. Enforcing the use of `toBeObject()` provides more explicit and readable code, making your intentions clear and improving the overall maintainability and readability of your tests. + /// /// ### Examples /// /// Examples of **incorrect** code for this rule: