@@ -26,6 +26,7 @@ const messages = {
2626  forbiddenPropType : 'Prop type "{{target}}" is forbidden' , 
2727} ; 
2828
29+ /** @type  {import('eslint').Rule.RuleModule } */ 
2930module . exports  =  { 
3031  meta : { 
3132    docs : { 
@@ -192,7 +193,9 @@ module.exports = {
192193          } 
193194          if  ( node . specifiers . length  >=  1 )  { 
194195            const  propTypesSpecifier  =  node . specifiers . find ( ( specifier )  =>  ( 
195-               specifier . imported  &&  specifier . imported . name  ===  'PropTypes' 
196+               'imported'  in  specifier 
197+               &&  specifier . imported 
198+               &&  specifier . imported . name  ===  'PropTypes' 
196199            ) ) ; 
197200            if  ( propTypesSpecifier )  { 
198201              propTypesPackageName  =  propTypesSpecifier . local . name ; 
@@ -228,12 +231,13 @@ module.exports = {
228231          return ; 
229232        } 
230233
231-         checkNode ( node . parent . right ) ; 
234+         checkNode ( 'right'   in   node . parent   &&   node . parent . right ) ; 
232235      } , 
233236
234237      CallExpression ( node )  { 
235238        if  ( 
236-           node . callee . object 
239+           node . callee . type  ===  'MemberExpression' 
240+           &&  node . callee . object 
237241          &&  ! isPropTypesPackage ( node . callee . object ) 
238242          &&  ! propsUtil . isPropTypesDeclaration ( node . callee ) 
239243        )  { 
@@ -242,9 +246,12 @@ module.exports = {
242246
243247        if  ( 
244248          node . arguments . length  >  0 
245-           &&  ( node . callee . name  ===  'shape'  ||  astUtil . getPropertyName ( node . callee )  ===  'shape' ) 
249+           &&  ( 
250+             ( 'name'  in  node . callee  &&  node . callee . name  ===  'shape' ) 
251+             ||  astUtil . getPropertyName ( node . callee )  ===  'shape' 
252+           ) 
246253        )  { 
247-           checkProperties ( node . arguments [ 0 ] . properties ) ; 
254+           checkProperties ( 'properties'   in   node . arguments [ 0 ]   &&   node . arguments [ 0 ] . properties ) ; 
248255        } 
249256      } , 
250257
@@ -267,7 +274,7 @@ module.exports = {
267274
268275      ObjectExpression ( node )  { 
269276        node . properties . forEach ( ( property )  =>  { 
270-           if  ( ! property . key )  { 
277+           if  ( ! ( 'key'   in   property )   ||   ! property . key )  { 
271278            return ; 
272279          } 
273280
0 commit comments