feat(lint): remove unnecessary check (#1185)

This commit is contained in:
cin 2023-11-08 04:32:18 +08:00 committed by GitHub
parent 9369424d8e
commit 6e76669a3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View file

@ -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()));
}
}

View file

@ -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,