File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -186,13 +186,32 @@ module.exports = {
186186 } ) ;
187187 }
188188
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+
189207 return {
190208 'Program:exit' ( ) {
191209 const list = components . list ( ) ;
192210 // Report undeclared proptypes for all classes
193211 values ( list )
194212 . filter ( ( component ) => mustBeValidated ( component ) )
195- . forEach ( ( component ) => {
213+ . forEach ( ( component , index , array ) => {
214+ if ( checkNestedComponent ( component , array [ index - 1 ] ) ) return ;
196215 reportUndeclaredPropTypes ( component ) ;
197216 } ) ;
198217 } ,
You can’t perform that action at this time.
0 commit comments