-
-
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
feature request: [react/prop-types] recognize generics passed to React.memo #3866
Comments
@NuclleaR memo<Props>(({ foo, bar }) => {
// ...
}); If you instead use memo(({ foo, bar }: Props) => {
// ...
}); the |
@rjgotten this is not how it should work. If React allows us to use generics, eslint should respect them |
@NuclleaR sure but someone would have to manually update the rule to support the generics, which are a recent addition to the TS types. Are you volunteering? |
Oh, different from some of the maintainers - apparently, I actually agree with you there. I was just giving you a potential workaround. |
@rjgotten no, it means the lint rule was written before the TS type took generics, and nobody noticed to update it until this issue. |
No, it means the rule was implemented poorly. See also: Concrete relevant lines being: const services = ESLintUtils.getParserServices(context);
const type = services.getTypeAtLocation(node); If the rule were implemented correctly, it would have been implemented as two rules. |
@rjgotten PRs are welcome, but that is not the correct description of how a rule should be implemented, because this is a JavaScript project. It is not a bug, it’s just a missing enhancement. |
Is there an existing issue for this?
Description Overview
eslint v8.57.1
eslint-plugin-react: 7.37.2
Expected Behavior
eslint-plugin-react version
v7.37.2
eslint version
v8.57.1
node version
v18.17.1
The text was updated successfully, but these errors were encountered: