Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(linter): eslint-plugin-jest/prefer-comparison-matcher #2806

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/oxc_linter/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ mod jest {
pub mod no_test_return_statement;
pub mod no_untyped_mock_factory;
pub mod prefer_called_with;
pub mod prefer_comparison_matcher;
pub mod prefer_equality_matcher;
pub mod prefer_expect_resolves;
pub mod prefer_spy_on;
Expand Down Expand Up @@ -487,6 +488,7 @@ oxc_macros::declare_all_lint_rules! {
jest::no_test_return_statement,
jest::no_untyped_mock_factory,
jest::prefer_called_with,
jest::prefer_comparison_matcher,
jest::prefer_equality_matcher,
jest::prefer_expect_resolves,
jest::prefer_spy_on,
Expand Down
13 changes: 4 additions & 9 deletions crates/oxc_linter/src/rules/jest/prefer_called_with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,10 @@ impl PreferCalledWith {
return;
};

let mut has_not_modifier = false;
for modifier in jest_fn_call.modifiers() {
if let Some(modifier_name) = modifier.name() {
if modifier_name.eq("not") {
has_not_modifier = true;
break;
}
}
}
let has_not_modifier = jest_fn_call
.modifiers()
.iter()
.any(|modifier| modifier.is_name_equal("not"));;

if has_not_modifier {
return;
Expand Down
Loading
Loading