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

react/jsx-handler-names should not trigger on "only" #571

Closed
tkers opened this issue Apr 25, 2016 · 4 comments · Fixed by #705
Closed

react/jsx-handler-names should not trigger on "only" #571

tkers opened this issue Apr 25, 2016 · 4 comments · Fixed by #705

Comments

@tkers
Copy link

tkers commented Apr 25, 2016

The rule was triggered for a property only. I assume it checks for any prop key starting with on, but it would maybe make sense changing this to match on[A-Z] (i.e. camelcased keys) instead?

@tkers tkers changed the title react/jsx-handler-names triggers on "only" react/jsx-handler-names should not trigger on "only" Apr 25, 2016
@yannickcr
Copy link
Member

Yep, maybe it would be more convenient to use a regex (and make it customizable) to check the handler names instead of using a simple prefix like today.

@mik01aj
Copy link

mik01aj commented Jul 19, 2016

+1. I often use _.noop as a handler in my tests. I'd like to ignore this specific case.

lencioni added a commit to lencioni/eslint-plugin-react that referenced this issue Jul 24, 2016
The rule was triggered for a property `only`. This is because the regex
was checking for the prefix (by default "on") followed by any
characters. We can fix this by ensuring that the prefix we are checking
for is always followed by an uppercase character.

It was suggested in the issue that we might want to allow this rule to
accept a regex, which would allow for more flexibility in how this rule
is configured. I think this might be a nice enhancement, but since this
fix was so simple I decided to go with the quick and easy win at this
time.

Fixes jsx-eslint#571
lencioni added a commit to lencioni/eslint-plugin-react that referenced this issue Jul 30, 2016
The rule was triggered for a property `only`. This is because the regex
was checking for the prefix (by default "on") followed by any
characters. We can fix this by ensuring that the prefix we are checking
for is always followed by an uppercase character.

It was suggested in the issue that we might want to allow this rule to
accept a regex, which would allow for more flexibility in how this rule
is configured. I think this might be a nice enhancement, but since this
fix was so simple I decided to go with the quick and easy win at this
time.

Fixes jsx-eslint#571
@mik01aj
Copy link

mik01aj commented Aug 1, 2016

should I open another issue for making this regex configurable so that I can exclude _.noop?

@ljharb
Copy link
Member

ljharb commented Aug 1, 2016

@mik01aj yes, I think a separate issue is better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants