File tree 1 file changed +20
-1
lines changed
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -186,13 +186,32 @@ module.exports = {
186
186
} ) ;
187
187
}
188
188
189
+ /**
190
+ * @param {Object } curComponent The current component to process
191
+ * @param {Object } prevComponent The prev component to process
192
+ * @returns {Boolean } True if the component is nested False if not.
193
+ */
194
+ function checkNestedComponent ( curComponent , prevComponent ) {
195
+ if ( curComponent . node . callee && curComponent . node . callee . name === 'memo' && prevComponent ) {
196
+ const prevComponentRange = prevComponent . node . range ;
197
+ const currentComponentRange = curComponent . node . arguments [ 0 ] . range ;
198
+
199
+ if ( prevComponentRange [ 0 ] === currentComponentRange [ 0 ]
200
+ && prevComponentRange [ 1 ] === currentComponentRange [ 1 ] ) {
201
+ return true ;
202
+ }
203
+ }
204
+ return false ;
205
+ }
206
+
189
207
return {
190
208
'Program:exit' ( ) {
191
209
const list = components . list ( ) ;
192
210
// Report undeclared proptypes for all classes
193
211
values ( list )
194
212
. filter ( ( component ) => mustBeValidated ( component ) )
195
- . forEach ( ( component ) => {
213
+ . forEach ( ( component , index , array ) => {
214
+ if ( checkNestedComponent ( component , array [ index - 1 ] ) ) return ;
196
215
reportUndeclaredPropTypes ( component ) ;
197
216
} ) ;
198
217
} ,
You can’t perform that action at this time.
0 commit comments