Skip to content

Commit b08de1a

Browse files
fix: getReturnNode without body (#35)
1 parent a8b31c2 commit b08de1a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const isObject = node => node && (
55
);
66

77
const getReturnNode = (node) => {
8-
const body = node.body;
8+
const body = node && node.body;
99
if (!body) {
1010
return node;
1111
} else if (isObject(body)) {

tests/lib/rules/mapStateToProps-prefer-hoisted.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ ruleTester.run('mapStateToProps-prefer-hoisted', rule, {
9393
}
9494
}
9595
};`,
96+
`const createConnectedToolbarItem = (icon, onClick) => {
97+
const mapStateToProps = { onClick }
98+
99+
connect(
100+
null,
101+
mapStateToProps
102+
)(createToolbarItem(icon))
103+
}`,
96104
],
97105
invalid: [{
98106
code: `const mapStateToProps = (state) => {

0 commit comments

Comments
 (0)