{"action":"created","issue":{"url":"https://api.github.com/repos/yannickcr/eslint-plugin-react/issues/1448","repository_url":"https://api.github.com/repos/yannickcr/eslint-plugin-react","labels_url":"https://api.github.com/repos/yannickcr/eslint-plugin-react/issues/1448/labels{/name}","comments_url":"https://api.github.com/repos/yannickcr/eslint-plugin-react/issues/1448/comments","events_url":"https://api.github.com/repos/yannickcr/eslint-plugin-react/issues/1448/events","html_url":"https://github.com/yannickcr/eslint-plugin-react/issues/1448","id":260319685,"number":1448,"title":"no-unused-prop-types false positives for HoCs (ex: react-redux connect)","user":{"login":"rsolomon","id":448432,"avatar_url":"https://avatars1.githubusercontent.com/u/448432?v=4","gravatar_id":"","url":"https://api.github.com/users/rsolomon","html_url":"https://github.com/rsolomon","followers_url":"https://api.github.com/users/rsolomon/followers","following_url":"https://api.github.com/users/rsolomon/following{/other_user}","gists_url":"https://api.github.com/users/rsolomon/gists{/gist_id}","starred_url":"https://api.github.com/users/rsolomon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsolomon/subscriptions","organizations_url":"https://api.github.com/users/rsolomon/orgs","repos_url":"https://api.github.com/users/rsolomon/repos","events_url":"https://api.github.com/users/rsolomon/events{/privacy}","received_events_url":"https://api.github.com/users/rsolomon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-09-25T15:31:33Z","updated_at":"2017-11-21T05:08:57Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"If you have a set of props that are only used in functions passed to an HoC, `no-unused-prop-types` will erroneously say that the props are unused. This is a major issue for any app that uses react-redux.\r\n\r\nExample component that fails:\r\n\r\n```\r\ntype User = { name: string };\r\ntype AppState = { [id: string]: Array<User> };\r\ntype OwnProps = { id: string };\r\ntype PropsFromState = { users: Array<User> };\r\n\r\nfunction mapStateToProps(state: AppState, ownProps: OwnProps): PropsFromState {\r\n  const { id } = ownProps;\r\n  return state[id];\r\n}\r\n\r\nclass UsersViewer extends React.Component<OwnProps & PropsFromState> {\r\n  render(): React.Node {\r\n    const { users } = this.props;\r\n    return <ul>{users.map(user => <li>user.name</li>)}</ul>;\r\n  }\r\n}\r\n\r\nexport default connect(mapStateToProps)(UsersViewer);\r\n```\r\n\r\nEven though the `id` prop is used in `mapStateToProps`, the following error will still throw:\r\n\r\n```\r\nerror  'id' PropType is defined but prop is never used  react/no-unused-prop-types\r\n```\r\n\r\nThis is an issue in v7.4.0 only"},"comment":{"url":"https://api.github.com/repos/yannickcr/eslint-plugin-react/issues/comments/345918569","html_url":"https://github.com/yannickcr/eslint-plugin-react/issues/1448#issuecomment-345918569","issue_url":"https://api.github.com/repos/yannickcr/eslint-plugin-react/issues/1448","id":345918569,"user":{"login":"ardok","id":1380581,"avatar_url":"https://avatars2.githubusercontent.com/u/1380581?v=4","gravatar_id":"","url":"https://api.github.com/users/ardok","html_url":"https://github.com/ardok","followers_url":"https://api.github.com/users/ardok/followers","following_url":"https://api.github.com/users/ardok/following{/other_user}","gists_url":"https://api.github.com/users/ardok/gists{/gist_id}","starred_url":"https://api.github.com/users/ardok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ardok/subscriptions","organizations_url":"https://api.github.com/users/ardok/orgs","repos_url":"https://api.github.com/users/ardok/repos","events_url":"https://api.github.com/users/ardok/events{/privacy}","received_events_url":"https://api.github.com/users/ardok/received_events","type":"User","site_admin":false},"created_at":"2017-11-21T05:08:57Z","updated_at":"2017-11-21T05:08:57Z","author_association":"NONE","body":"Also, is destructuring from function param a known false positive as well?\r\n```\r\nonFilterChange = ({id}: {id: string}) => {\r\n    this.setState({\r\n      selectedId: id,\r\n    });\r\n};\r\n```\r\n\r\nThat will complain about:\r\n`error  'id' PropType is defined but prop is never used  react/no-unused-prop-types`\r\n\r\nIt's not even a \"PropType\".\r\nI have the skip shape props on already: `\"react/no-unused-prop-types\": [2, { \"skipShapeProps\": true }],`"}}
{"actor":{"display_login":"ardok"}}