Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Commit cfffab2

Browse files
fix: syntax crashing rule (DianaSuvorova#64)
1 parent fc1841f commit cfffab2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const getReturnNode = (node) => {
1616
for (let i = body.length - 1; i >= 0; i -= 1) {
1717
if (body[i].type === 'ReturnStatement') {
1818
const arg = body[i].argument;
19-
if (arg.type === 'ArrowFunctionExpression' || arg.type === 'FunctionExpression') {
19+
if (arg && (arg.type === 'ArrowFunctionExpression' || arg.type === 'FunctionExpression')) {
2020
return getReturnNode(arg);
2121
}
2222
return arg;

tests/code-sanity-samples.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ module.exports = [
66
}
77
}
88
`,
9+
`const mapStateToProps = () => {
10+
return;
11+
};`,
912
];

0 commit comments

Comments
 (0)