Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.7k
Closed
Description
Overview
Seen another instance of theCannot read property 'name' issue which has already been raised in issue#1021. Again using the following package versions:
- eslint-config-airbnb@14.0.0
- eslint-plugin-react@6.9.0
Error returned is:
Cannotreadproperty'name'ofundefinedTypeError:Cannotreadproperty'name'ofundefinedatisPropTypeAnnotation(/Users/user/path/org/project/node_modules/eslint-plugin-react/lib/rules/require-default-props.js:291:23)atObject.ClassProperty(/Users/user/path/org/project/node_modules/eslint-plugin-react/lib/rules/require-default-props.js:461:13)
After checkingrequire-default-props.js its failing at this point:
functionisPropTypeAnnotation(node){return(node.key.name==='props'&&!!node.typeAnnotation);}
After inspecting the node I have the following returned:
Node{type:'ClassProperty',start:301,end:414,loc:SourceLocation{start:Position{line:11,column:2},end:Position{line:15,column:3}},computed:false,variance:null,static:true,value:Node{type:'ObjectExpression',start:320,end:414,loc:SourceLocation{start:[Object],end:[Object]},properties:[[Object],[Object],[Object]],range:[320,414],_babelType:'ObjectExpression'},range:[301,414],_babelType:'ClassProperty',parent:Node{type:'ClassBody',start:296,end:1235,loc:SourceLocation{start:[Object],end:[Object]},body:[[Circular],[Object],[Object],[Object]],range:[296,1235],_babelType:'ClassBody',parent:Node{type:'ClassDeclaration',start:265,end:1235,loc:[Object],id:[Object],superClass:[Object],body:[Circular],decorators:[Object],range:[Object],_babelType:'ClassDeclaration',parent:[Object]}}}
After inspecting then source in question returned fromcontext.getFilename() and checking the line number, I have the following code:
exportdefaultclassAnchorextendsComponent{staticpropTypes={active:PropTypes.bool,underline:PropTypes.bool,tooltip:PropTypes.array,}...}
After checking the source commentshere this all appears to be valid.
As you can see in the above node output there is nokey property? Has there been a breaking change here? Any insight would be greatly appreciated.
Metadata
Metadata
Assignees
Labels
No labels