-
-
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-no-bind false positive? #1417
Comments
Indeed, that should not complain because it's not passing the new function as a prop anywhere. |
I will give this one a look. 😄 |
Seems like the rule needs a bit more fixing than I thought it would to only check for The current logic in the rule checks for all I understand that based on the rule doc, it should only check for JSX props. However, based on the purpose of such checks, wouldn't it make sense to check for all This is just my 2 cents. If we have to write the rule to fulfill exactly its purpose as documented, I will probably have to refactor a portion of its logic, have some new logic to deal with aliases like what If my opinion seems reasonable, we would only have to improve the docs. Let me know your thoughts. 😄 |
The rule is to avoid new functions being created and passed as props to an element (it should really apply not just to jsx, but to createElement calls as well). |
It's hard to evaluate without an actual PR; I'd love to look at the test case and docs changes in particular that you're suggesting. |
Thanks for replying! I think I know the direction I'm going with to fix this issue now. Will open a PR soon. 😄 |
Example snippet:
this.wrap.bind
triggers the rule, even though the bound function isn't the actual prop being passed, but is being used during the render to build the children, so it shouldn't break purity.The text was updated successfully, but these errors were encountered: