mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(lint): remove unnecessary check (#1185)
This commit is contained in:
parent
9369424d8e
commit
6e76669a3f
2 changed files with 2 additions and 6 deletions
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue