Skip to content

Commit

Permalink
Fix style-prop-object crash (fixes #834)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickcr committed Sep 14, 2016
1 parent 6b58f21 commit a2a3de1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/style-prop-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = {
},

JSXAttribute: function(node) {
if (node.name.name !== 'style') {
if (!node.value || node.name.name !== 'style') {
return;
}

Expand Down
4 changes: 4 additions & 0 deletions tests/lib/rules/style-prop-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ ruleTester.run('style-prop-object', rule, {
'React.createElement("div", { style: styles });'
].join('\n'),
parserOptions: Object.assign({sourceType: 'module'}, parserOptions)
},
{
code: '<div style></div>',
parserOptions: parserOptions
}
],
invalid: [
Expand Down

0 comments on commit a2a3de1

Please sign in to comment.