-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Added handling in no-multi-comp for forwardRef and memo wrapping comp… #2184
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
…pping components declared in the same file - getComponentNameFromJSXElement returns null when node.type is not JSXElement
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.
Can you confirm this will fix component detection for any case where a component is passed as the argument to a function?
7965c22
to
3ddce46
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.
Thanks! made some final tweaks to get this in.
Added handling in no-multi-comp for forwardRef and memo wrapping components declared in the same file.
Fixes #2172
Changes
While checking for
isPragmaComponentWrapper
code will also check whether the wrapper is wrapping existing component or creating a new one.If it's is wrapping existing component in extra JSX element then it will be considered as a separate component else it won't.
In the example below the second abc won't be considered as extra component
but in the second case abc will be considered as a separate component