From 6e76669a3f2ff7eb91f4f3664752a4310d761077 Mon Sep 17 00:00:00 2001 From: cin Date: Wed, 8 Nov 2023 04:32:18 +0800 Subject: [PATCH] feat(lint): remove unnecessary check (#1185) --- crates/oxc_linter/src/rules/jest/no_hooks.rs | 6 ++---- crates/oxc_linter/src/utils/jest.rs | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/oxc_linter/src/rules/jest/no_hooks.rs b/crates/oxc_linter/src/rules/jest/no_hooks.rs index d9cb43a76..ca47d7220 100644 --- a/crates/oxc_linter/src/rules/jest/no_hooks.rs +++ b/crates/oxc_linter/src/rules/jest/no_hooks.rs @@ -9,7 +9,7 @@ use oxc_span::{GetSpan, Span}; use crate::{ context::LintContext, rule::Rule, - utils::{is_type_of_jest_fn_call, JestFnKind, JestGeneralFnKind, JEST_HOOK_NAMES}, + utils::{is_type_of_jest_fn_call, JestFnKind, JestGeneralFnKind}, AstNode, }; @@ -99,9 +99,7 @@ impl Rule for NoHooks { } if let Expression::Identifier(ident) = &call_expr.callee { - if JEST_HOOK_NAMES.contains(&ident.name.as_str()) - && !self.allow.contains(&ident.name.to_string()) - { + if !self.allow.contains(&ident.name.to_string()) { ctx.diagnostic(UnexpectedHookDiagonsitc(call_expr.callee.span())); } } diff --git a/crates/oxc_linter/src/utils/jest.rs b/crates/oxc_linter/src/utils/jest.rs index 1e2f75a6d..01b4fec3d 100644 --- a/crates/oxc_linter/src/utils/jest.rs +++ b/crates/oxc_linter/src/utils/jest.rs @@ -31,8 +31,6 @@ const JEST_METHOD_NAMES: [&str; 14] = [ "xtest", ]; -pub const JEST_HOOK_NAMES: [&str; 4] = ["afterAll", "afterEach", "beforeAll", "beforeEach"]; - #[derive(Clone, Copy, PartialEq, Eq)] pub enum JestFnKind { Expect,