You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a very strange pattern - why pass a component and a props object around instead of just passing an element directly?
Either way, you’re meant to access all of the props individually in each component in which it’s defined, so if you want to write your code this way, then you may need go use an override comment in Component3.
I didn't include the whole complexity here to keep this example minimal. In the use case, Component2 is rather complex and generates additional properties that are fed into Component1. Now we have ~10 components that can be used for Component1, and each of these should receive an abstraction in the form of Component3.
I would be happy to suppress this warning via // eslint-disable-next-line at Component3, but that does not fix the issue since the problem is raised in line 2 at name: string;. I can only suppress the warning for the whole file or line by line in the type definition. In either case, I lose the ability to check whether all properties are used in Component2 (which works just fine when Component3 is disabled).
Is there an existing issue for this?
Description Overview
The following code causes a false positive on
react/no-unused-prop-types
:Error:
'name' PropType is defined but prop is never used
.The error goes away when commenting out
Component3
.Expected Behavior
The code above should be accepted by the linter.
eslint-plugin-react version
v7.37.4
eslint version
v8.57.1
node version
v20.15.0
The text was updated successfully, but these errors were encountered: