You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at Object.utils.findReturnStatement (/home/nodejsTest/testingProject/demo-for-ghooks/node_modules/.6.3.0@eslint-plugin-react/lib/util/Components.js:281:35)
at Object.utils.isReturningJSX (/home/nodejsTest/testingProject/demo-for-ghooks/node_modules/.6.3.0@eslint-plugin-react/lib/util/Components.js:233:24)
at EventEmitter.CallExpression (/home/nodejsTest/testingProject/demo-for-ghooks/node_modules/.6.3.0@eslint-plugin-react/lib/rules/jsx-no-bind.js:62:23)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:188:7)
at NodeEventGenerator.enterNode (/home/nodejsTest/testingProject/demo-for-ghooks/node_modules/.3.5.0@eslint/lib/util/node-event-generator.js:40:22)
at CodePathAnalyzer.enterNode (/home/nodejsTest/testingProject/demo-for-ghooks/node_modules/.3.5.0@eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)
at CommentEventGenerator.enterNode (/home/nodejsTest/testingProject/demo-for-ghooks/node_modules/.3.5.0@eslint/lib/util/comment-event-generator.js:97:23)
at Controller.enter (/home/nodejsTest/testingProject/demo-for-ghooks/node_modules/.3.5.0@eslint/lib/eslint.js:918:36)
at Controller.__execute (/home/nodejsTest/testingProject/demo-for-ghooks/node_modules/.4.2.0@estraverse/estraverse.js:397:31)
I had print the log before reported this error, as following:
/**
* Find a return statment in the current node
*
* @param {ASTNode} ASTnode The AST node being checked
*/
findReturnStatement: function(node) {
if (!node.value || !node.value.body) {
return false;
}
console.log(node.value.body);
var i = node.value.body.body.length - 1;
for (; i >= 0; i--) {
if (node.value.body.body[i].type === 'ReturnStatement') {
return node.value.body.body[i];
}
}
return false;
},
Hi guys,
I had met a problem, I am not sure this is a bug, so can you help me to check this ?
Scenerio:
The source code you can checkout from: https://github.com/linxiaowu66/demo-for-ghooks.git (Branch: eslint-react-issue)
The key location is
and the report error:
I had print the log before reported this error, as following:
create
(lib/rules/jsx-no-bind.js)==>isReturningJSX
(lib/util/Components.js) ==> findReturnStatement(lib/util/Components.js)and print location:
log:
Thanks in advance.
The text was updated successfully, but these errors were encountered: