diff --git a/docs/rules/no-unused-prop-types.md b/docs/rules/no-unused-prop-types.md index 338c99f392..6760e8c857 100644 --- a/docs/rules/no-unused-prop-types.md +++ b/docs/rules/no-unused-prop-types.md @@ -58,7 +58,6 @@ This rule can take one argument to ignore some specific props during validation. ## Known Issues/Limitations - [False Positives: SFC (helper render methods)](#false-positives-sfc) -- [False Positives: Intermediate variables](#false-positives-intermediate-variables) ### False positives SFC For components with Stateless Functional Components (often used as helper render methods); @@ -109,50 +108,3 @@ AComponent.propTypes = { bProp: PropTypes.string }; ``` - -### False positives intermediate variables -when assigning a part or a whole props object to a variable and using it to access a prop value. - -```js -class AComponent extends React.Component { - render() { - const { props } = this; - - return
{props.aProp}
; - } -} -AComponent.propTypes = { - aProp: PropTypes.string // aProp PropType is defined but prop is never used -}; -``` - -suggested code structure to avoid the issue: - -- accessing prop directly -```js -class AComponent extends React.Component { - render() { - return
{this.props.aProp}
; - } -} -AComponent.propTypes = { - aProp: PropTypes.string -}; -``` - -- or assigning a final prop to a variable. - -```js -class AComponent extends React.Component { - const { aProp } = this.props; - render() { - return
{aProp}
; - } -} -AComponent.propTypes = { - aProp: PropTypes.string -}; -``` - -Using Intermediate variables might be desired and unavoidable for more complex props structure. -Like for shape prop types. To avoid false positive in this case make sure `skipShapeProps` is set to `true`.