Skip to content

Commit 5748611

Browse files
committed
add comments on the cases that are removed from the name patterns of handlers and props
1 parent b585030 commit 5748611

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
@@ -316,13 +316,14 @@ impl Rule for JsxHandlerNames {
316316
}
317317
};
318318

319+
// "ref" prop is allowed to be assigned to a function with any name.
319320
if prop_key == "ref" {
320321
return;
321322
}
322323

323324
let prop_is_event_handler = self.match_event_handler_props_name(prop_key);
324325
let is_handler_name_correct = handler_name.as_ref().map_or(Some(false), |name| {
325-
// if the event handler is a property of "props", the handler name can also start with the prop prefix.
326+
// if the event handler is "this.props.*" or "props.*", the handler name can be the pattern of event handler props.
326327
if is_props_handler && self.match_event_handler_props_name(name).unwrap_or(false) {
327328
return Some(true);
328329
}

0 commit comments

Comments
 (0)