Skip to content
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

Issue #1686 - jsx-handler-names: false positive when handler name begins with number #1689

Merged
merged 1 commit into from Sep 20, 2020

Conversation

@jsphstls
Copy link
Contributor

@jsphstls jsphstls commented Feb 10, 2018

Updated unit test and EVENT_HANDLER_REGEX regex.

…th number

Fixes #1686.
Copy link
Collaborator

@ljharb ljharb left a comment

Seems reasonable to me.

Could you also add some invalid test cases that use numbers?

@jsphstls
Copy link
Contributor Author

@jsphstls jsphstls commented Feb 19, 2018

I adjusted the regex so that a capital letter is still required at some point after the word "handle" and added more test cases to demonstrate that minimum requirement.

errors: [{message: 'Handler function for onChange prop key must begin with \'handle\''}]
}, {
code: '<TestComponent onChange={this.handle4change} />',
errors: [{message: 'Handler function for onChange prop key must begin with \'handle\''}]

This comment has been minimized.

@ljharb

ljharb Feb 19, 2018
Collaborator

hm, we should probably change the error message to add " and be in camelCase", otherwise this one's pretty confusing

This comment has been minimized.

@jsphstls

jsphstls Feb 21, 2018
Author Contributor

I updated the error message to be more specific and removed the handleC test case that does pass, but should not be considered valid.

This comment has been minimized.

@ljharb

ljharb Feb 23, 2018
Collaborator

if the test wrongly passes, we should move it to the "invalid" section, even if it's commented out for now.

@ljharb
ljharb approved these changes Feb 23, 2018
@ljharb ljharb added the bug label Sep 20, 2020
@ljharb ljharb force-pushed the jsphstls:master branch from 1e6728b to ac49944 Sep 20, 2020
@ljharb ljharb merged commit ac49944 into yannickcr:master Sep 20, 2020
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 97.495%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.