Skip to content

Commit

Permalink
chore: follow the suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
shulaoda committed Aug 31, 2024
1 parent 41382fd commit 486fcbc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions crates/oxc_linter/src/rules/vitest/prefer_to_be_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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?
///
Expand All @@ -50,7 +50,7 @@ declare_oxc_lint!(
/// ```js
/// expectTypeOf({}).toBeInstanceOf(Object);
/// expectTypeOf({} instanceof Object).toBeTruthy();
/// ```
/// ```xw
///
/// Examples of **correct** code for this rule:
/// ```js
Expand Down
32 changes: 16 additions & 16 deletions crates/oxc_linter/src/snapshots/prefer_to_be_object.snap
Original file line number Diff line number Diff line change
@@ -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]
1expectTypeOf({} 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]
1expectTypeOf({} 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]
1expectTypeOf({} 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]
1expectTypeOf({} 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]
1expectTypeOf({}).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]
1expectTypeOf({}).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]
1expectTypeOf(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]
1expectTypeOf(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.

0 comments on commit 486fcbc

Please sign in to comment.