From bb4347c65b2d36d12bc4364ce04f51667de781cf Mon Sep 17 00:00:00 2001 From: camchenry <1514176+camchenry@users.noreply.github.com> Date: Mon, 20 Oct 2025 16:50:20 +0000 Subject: [PATCH] perf(linter): use precomputed extension (#14819) Very marginally faster to use the precomputed file extension now. --- crates/oxc_linter/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/oxc_linter/src/lib.rs b/crates/oxc_linter/src/lib.rs index 6591d76c241bc..0b451ce6d0a4b 100644 --- a/crates/oxc_linter/src/lib.rs +++ b/crates/oxc_linter/src/lib.rs @@ -167,10 +167,9 @@ impl Linter { #[cfg(debug_assertions)] let mut current_diagnostic_index = 0; - let is_partial_loader_file = path - .extension() - .and_then(|ext| ext.to_str()) - .is_some_and(|ext| LINT_PARTIAL_LOADER_EXTENSIONS.contains(&ext)); + let is_partial_loader_file = ctx_host + .file_extension() + .is_some_and(|ext| LINT_PARTIAL_LOADER_EXTENSIONS.iter().any(|e| e == &ext)); loop { let mut rules = rules