Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] remove outdated docs for no-unused-prop-types #2354

Merged
merged 1 commit into from Jul 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 0 additions & 48 deletions docs/rules/no-unused-prop-types.md
Expand Up @@ -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);
Expand Down Expand Up @@ -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 <div>{props.aProp}</div>;
}
}
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 <div>{this.props.aProp}</div>;
}
}
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 <div>{aProp}</div>;
}
}
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`.