From 9aefedab2ad76f42f7249383a9c75984644d1cc8 Mon Sep 17 00:00:00 2001 From: shulaoda Date: Fri, 31 Jan 2025 10:40:38 +0800 Subject: [PATCH] refactor(linter): correctly handle loose options for eslint/eqeqeq --- crates/oxc_linter/src/rules/eslint/eqeqeq.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/oxc_linter/src/rules/eslint/eqeqeq.rs b/crates/oxc_linter/src/rules/eslint/eqeqeq.rs index 265edce0c4580..804320c40271d 100644 --- a/crates/oxc_linter/src/rules/eslint/eqeqeq.rs +++ b/crates/oxc_linter/src/rules/eslint/eqeqeq.rs @@ -42,7 +42,7 @@ declare_oxc_lint!( impl Rule for Eqeqeq { fn from_configuration(value: serde_json::Value) -> Self { - let first_arg = value.get(0).and_then(serde_json::Value::as_str).map(CompareType::from); + let first_arg = value.get(0).and_then(serde_json::Value::as_str); let null_type = value .get(usize::from(first_arg.is_some())) @@ -51,7 +51,7 @@ impl Rule for Eqeqeq { .map(NullType::from) .unwrap_or_default(); - let compare_type = first_arg.unwrap_or_default(); + let compare_type = first_arg.map(CompareType::from).unwrap_or_default(); Self { compare_type, null_type } }