eslint-plugin-react
eslint-plugin-react copied to clipboard
[Fix] `no-unused-prop-types`: detect used props in nested components
Fixes #3524
This PR fixes a bug where react/no-unused-prop-types was not properly detecting unused props in components wrapped with nested wrapper functions like React.memo(React.forwardRef()).
- Enhanced component detection logic to properly traverse nested wrapper functions when looking for propType definitions
- Added logic to find the actual component node that declares propTypes when dealing with nested wrapper patterns
- The fix ensures that prop usage is correctly detected by finding the component that actually defines the propTypes, regardless of how many wrapper functions are nested