diff --git a/lib/rules/style-prop-object.js b/lib/rules/style-prop-object.js index 2a67137360..1b861ca160 100644 --- a/lib/rules/style-prop-object.js +++ b/lib/rules/style-prop-object.js @@ -48,7 +48,7 @@ module.exports = { ) { if (node.arguments[1].type === 'ObjectExpression') { var style = node.arguments[1].properties.find(function(property) { - return property.key.name === 'style'; + return property.key.name === 'style' && !property.computed; }); if (style) { if (style.value.type === 'Identifier') { diff --git a/tests/lib/rules/style-prop-object.js b/tests/lib/rules/style-prop-object.js index 90860e9206..19db43518a 100644 --- a/tests/lib/rules/style-prop-object.js +++ b/tests/lib/rules/style-prop-object.js @@ -106,6 +106,14 @@ ruleTester.run('style-prop-object', rule, { { code: '
', parserOptions: parserOptions + }, + { + code: [ + 'React.createElement(MyCustomElem, {', + ' [style]: true', + '}, \'My custom Elem\')' + ].join('\n'), + parserOptions: parserOptions } ], invalid: [