Skip to content

Commit

Permalink
fix: getReturnNode without body (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
DianaSuvorova authored Feb 1, 2019
1 parent a8b31c2 commit b08de1a
Show file tree
Hide file tree
Showing 2 changed files with 9 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 @@ -5,7 +5,7 @@ const isObject = node => node && (
);

const getReturnNode = (node) => {
const body = node.body;
const body = node && node.body;
if (!body) {
return node;
} else if (isObject(body)) {
Expand Down
8 changes: 8 additions & 0 deletions tests/lib/rules/mapStateToProps-prefer-hoisted.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ ruleTester.run('mapStateToProps-prefer-hoisted', rule, {
}
}
};`,
`const createConnectedToolbarItem = (icon, onClick) => {
const mapStateToProps = { onClick }
connect(
null,
mapStateToProps
)(createToolbarItem(icon))
}`,
],
invalid: [{
code: `const mapStateToProps = (state) => {
Expand Down

0 comments on commit b08de1a

Please sign in to comment.