eslint-plugin-react icon indicating copy to clipboard operation
eslint-plugin-react copied to clipboard

[Fix] `no-unused-prop-types`: detect used props in nested components

Open avaice opened this issue 2 months ago • 0 comments

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

avaice avatar Sep 22 '25 09:09 avaice