Skip to content

Commit d4a9191

Browse files
takujiCopilot
andauthored
Update crates/oxc_linter/src/rules/react/jsx_handler_names.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 6043ccf commit d4a9191

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/oxc_linter/src/rules/react/jsx_handler_names.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@ fn get_member_expression_name(member_expr: &JSXMemberExpression) -> CompactStr {
369369

370370
fn normalize_handler_name(s: &str) -> CompactStr {
371371
let s1 = regex!(r"\s*").replace_all(s, "");
372-
regex!(r"^this\.|\S*::").replace(s1.as_ref(), "").into()
372+
// Combine whitespace removal and prefix stripping into a single regex operation.
373+
regex!(r"\s+|^this\.|\S*::").replace_all(s, "").into()
373374
}
374375

375376
// Tests for the normalize_handler_name function to ensure it correctly strips prefixes and whitespace.

0 commit comments

Comments
 (0)