-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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: cannot opt-out of handler prefix independent of prop prefix #2400
Comments
I'm not very clear on what actual code you want to be allowed, and what disallowed? |
I want to be able to set |
Can you provide raw source code that you want to allow or disallow, without speaking in any way about linter rules or configuration options? |
Assuming hypothetical config: "react/jsx-handler-names": ['error', {
"eventHandlerPrefix": false,
"eventHandlerPropPrefix": 'on',
}], Allow: <Foo
onSubmit={this.submit}
/>
<Foo
onSubmit={this.handleSubmit}
/>
<Foo
onSubmit={this.whateverAnythingIsOkay}
/> Disallow: <Foo
submit={this.submit} // error, prop handler must be prefixed with 'on'
/> |
Thanks. Adding support for |
Awesome; will see if I can give it a shot in the coming week. |
<3 |
Issue
I only want to enforce
eventHandlerPropPrefix
, but I cannot selectively opt out ofeventHandlerPrefix
.1. Rule always plugs in a default value 'handle' into
eventHandlerPrefix
when supplied value is an empty string''
(falsy)Problematic code:
source
2. Rule prevents "whitelist" JS regex workarounds noted in #1687 because a capital letter must succeed the allowed prefix.
Example Config: I want to whitelist
submit
select
verbatim andhandle*
prefix:Problematic code:
source
The text was updated successfully, but these errors were encountered: