Skip to content

Commit

Permalink
fix: syntax crashing rule (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
DianaSuvorova committed Jan 7, 2021
1 parent fc1841f commit cfffab2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const getReturnNode = (node) => {
for (let i = body.length - 1; i >= 0; i -= 1) {
if (body[i].type === 'ReturnStatement') {
const arg = body[i].argument;
if (arg.type === 'ArrowFunctionExpression' || arg.type === 'FunctionExpression') {
if (arg && (arg.type === 'ArrowFunctionExpression' || arg.type === 'FunctionExpression')) {
return getReturnNode(arg);
}
return arg;
Expand Down
3 changes: 3 additions & 0 deletions tests/code-sanity-samples.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ module.exports = [
}
}
`,
`const mapStateToProps = () => {
return;
};`,
];

0 comments on commit cfffab2

Please sign in to comment.