-
-
Notifications
You must be signed in to change notification settings - Fork 722
feat(linter): add react/jsx-handler-names rule #13079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
d6dba5f to
b3dd362
Compare
CodSpeed Instrumentation Performance ReportMerging #13079 will not alter performanceComparing Summary
|
mind expanding on this with an example of what the parser is failing to parse |
|
@camc314 I've added details in the PR description. |
thanks, not sure why the library has test cases like that, the proposal hasn't been updated in 8 yrs and was never shipped |
# Conflicts: # crates/oxc_linter/src/rules.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ef80ff4 to
e810b2d
Compare
e810b2d to
6043ccf
Compare
d4a9191 to
6043ccf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the react/jsx-handler-names rule to enforce consistent naming conventions for JSX event handlers and their corresponding props. The rule ensures handler functions start with specified prefixes (default "handle") and prop names start with specified prefixes (default "on").
- Adds complete implementation of the jsx-handler-names rule with configurable options
- Includes comprehensive test coverage for various scenarios and edge cases
- Handles component name ignore patterns using glob matching
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| crates/oxc_linter/src/rules/react/jsx_handler_names.rs | Complete rule implementation with configuration parsing, regex compilation, and handler/prop validation logic |
| crates/oxc_linter/src/rules.rs | Rule registration in the linter module system |
| crates/oxc_linter/src/snapshots/react_jsx_handler_names.snap | Test output snapshots showing expected diagnostic messages |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
camc314
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you
This PR adds the react/jsx-handler-names rule.
Dropped test cases
Test cases where the bind-this operator
::is used are dropped because the current oxc parser doesn't seem to understand it.For example, if you test the following code:
You'll get an output like this:
All the dropped test cases are in this commit: d80dcfa
works towards #1022