Skip to content

Commit c0f0369

Browse files
committed
perf(linter): replace phf_set with array in utils/vitest (#10427)
Related to #10076 Benchmark repo: https://github.com/shulaoda/rust-benchmark-test Benchmark result: https://codspeed.io/shulaoda/rust-benchmark-test/benchmarks BTW, the `VALID_VITEST_FN_CALL_CHAINS` is really huge. I plan to try optimizing it when I have some time later.
1 parent 7284135 commit c0f0369

File tree

3 files changed

+1202
-1205
lines changed

3 files changed

+1202
-1205
lines changed

crates/oxc_linter/src/utils/jest/parse_jest_fn.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ use oxc_span::Span;
1313

1414
use crate::{
1515
context::LintContext,
16-
utils::{
17-
jest::{JestFnKind, JestGeneralFnKind, PossibleJestNode, is_pure_string},
18-
vitest::VALID_VITEST_FN_CALL_CHAINS,
19-
},
16+
utils::jest::{JestFnKind, JestGeneralFnKind, PossibleJestNode, is_pure_string},
17+
utils::valid_vitest_fn::is_valid_vitest_call,
2018
};
2119

2220
pub fn parse_jest_fn_call<'a>(
@@ -309,10 +307,6 @@ fn is_valid_jest_call(members: &[Cow<str>]) -> bool {
309307
.is_ok()
310308
}
311309

312-
fn is_valid_vitest_call(members: &[Cow<str>]) -> bool {
313-
VALID_VITEST_FN_CALL_CHAINS.contains(&members.join("."))
314-
}
315-
316310
fn resolve_to_jest_fn<'a>(
317311
call_expr: &'a CallExpression<'a>,
318312
original: Option<&'a str>,

crates/oxc_linter/src/utils/vitest.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ use oxc_ast::ast::CallExpression;
33
use super::{ParsedExpectFnCall, ParsedJestFnCallNew, PossibleJestNode, parse_jest_fn_call};
44
use crate::LintContext;
55

6-
mod valid_vitest_fn;
7-
pub use crate::utils::vitest::valid_vitest_fn::VALID_VITEST_FN_CALL_CHAINS;
6+
pub mod valid_vitest_fn;
87

98
pub fn parse_expect_and_typeof_vitest_fn_call<'a>(
109
call_expr: &'a CallExpression<'a>,

0 commit comments

Comments
 (0)