From 283e4c7cd9896cf77d61d544e6f9aa0ecc33ff53 Mon Sep 17 00:00:00 2001 From: shulaoda <165626830+shulaoda@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:20:38 +0000 Subject: [PATCH] perf(linter): replace `phf_set` with `array` in `react/exhaustive-deps` (#10337) Related to #10076 --- crates/oxc_linter/src/rules/react/exhaustive_deps.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/oxc_linter/src/rules/react/exhaustive_deps.rs b/crates/oxc_linter/src/rules/react/exhaustive_deps.rs index 1b16dc5dd7fb4..3a44744812a02 100644 --- a/crates/oxc_linter/src/rules/react/exhaustive_deps.rs +++ b/crates/oxc_linter/src/rules/react/exhaustive_deps.rs @@ -1,7 +1,6 @@ use std::hash::Hash; use itertools::Itertools; -use phf::phf_set; use rustc_hash::FxHashSet; use oxc_ast::{ @@ -194,8 +193,7 @@ declare_oxc_lint!( nursery ); -const HOOKS_USELESS_WITHOUT_DEPENDENCIES: phf::Set<&'static str> = - phf_set!("useCallback", "useMemo"); +const HOOKS_USELESS_WITHOUT_DEPENDENCIES: [&str; 2] = ["useCallback", "useMemo"]; impl Rule for ExhaustiveDeps { fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) { @@ -227,7 +225,7 @@ impl Rule for ExhaustiveDeps { let is_effect = hook_name.as_str().contains("Effect"); if dependencies_node.is_none() && !is_effect { - if HOOKS_USELESS_WITHOUT_DEPENDENCIES.contains(hook_name.as_str()) { + if HOOKS_USELESS_WITHOUT_DEPENDENCIES.contains(&hook_name.as_str()) { ctx.diagnostic(dependency_array_required_diagnostic( hook_name.as_str(), call_expr.span(),