-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[Bug]: display-name false positive when React is shadowed #3924
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
Comments
Fair, but how would you have even run into this? Prior to the new jsx renderer, this wouldn't have even been possible, but certainly it could be with the new renderer. |
I couldn't find a codemod that added the |
Here's the test that was catching this: https://github.com/knightedcodemonkey/display-name/blob/main/test/displayName.ts#L10-L42 For now I've disabled the rule around those lines. |
Hi! I'd like to work on this issue if it's still available. Let me know if that works for you. |
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
Description Overview
react/display-name
will report an errorComponent definition is missing display name
when theReact
global import is shadowed within a function scope.The same error does not occur for shadowed
memo
orforwardRef
though.Example
Running eslint from the command line you'll see the error:
Expected Behavior
I know most people won't shadow
React
,memo
orforwardRef
, but I'd still expect the error to not be reported in this case.eslint-plugin-react version
v7.37.5
eslint version
v9.26.0
node version
v22.15.0
The text was updated successfully, but these errors were encountered: