Skip to content

Commit fc70077

Browse files
authored
Merge pull request #2354 from golopot/patch-1
[docs] remove outdated docs for `no-unused-prop-types`
2 parents 49343d4 + f2891d9 commit fc70077

File tree

1 file changed

+0
-48
lines changed

1 file changed

+0
-48
lines changed

docs/rules/no-unused-prop-types.md

-48
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ This rule can take one argument to ignore some specific props during validation.
5858
## Known Issues/Limitations
5959

6060
- [False Positives: SFC (helper render methods)](#false-positives-sfc)
61-
- [False Positives: Intermediate variables](#false-positives-intermediate-variables)
6261

6362
### False positives SFC
6463
For components with Stateless Functional Components (often used as helper render methods);
@@ -109,50 +108,3 @@ AComponent.propTypes = {
109108
bProp: PropTypes.string
110109
};
111110
```
112-
113-
### False positives intermediate variables
114-
when assigning a part or a whole props object to a variable and using it to access a prop value.
115-
116-
```js
117-
class AComponent extends React.Component {
118-
render() {
119-
const { props } = this;
120-
121-
return <div>{props.aProp}</div>;
122-
}
123-
}
124-
AComponent.propTypes = {
125-
aProp: PropTypes.string // aProp PropType is defined but prop is never used
126-
};
127-
```
128-
129-
suggested code structure to avoid the issue:
130-
131-
- accessing prop directly
132-
```js
133-
class AComponent extends React.Component {
134-
render() {
135-
return <div>{this.props.aProp}</div>;
136-
}
137-
}
138-
AComponent.propTypes = {
139-
aProp: PropTypes.string
140-
};
141-
```
142-
143-
- or assigning a final prop to a variable.
144-
145-
```js
146-
class AComponent extends React.Component {
147-
const { aProp } = this.props;
148-
render() {
149-
return <div>{aProp}</div>;
150-
}
151-
}
152-
AComponent.propTypes = {
153-
aProp: PropTypes.string
154-
};
155-
```
156-
157-
Using Intermediate variables might be desired and unavoidable for more complex props structure.
158-
Like for shape prop types. To avoid false positive in this case make sure `skipShapeProps` is set to `true`.

0 commit comments

Comments
 (0)