@@ -58,7 +58,6 @@ This rule can take one argument to ignore some specific props during validation.
58
58
## Known Issues/Limitations
59
59
60
60
- [ False Positives: SFC (helper render methods)] ( #false-positives-sfc )
61
- - [ False Positives: Intermediate variables] ( #false-positives-intermediate-variables )
62
61
63
62
### False positives SFC
64
63
For components with Stateless Functional Components (often used as helper render methods);
@@ -109,50 +108,3 @@ AComponent.propTypes = {
109
108
bProp: PropTypes .string
110
109
};
111
110
```
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