diff --git a/lib/rules/prop-types.js b/lib/rules/prop-types.js index 8b2856e01a..b56165dd96 100644 --- a/lib/rules/prop-types.js +++ b/lib/rules/prop-types.js @@ -338,6 +338,8 @@ module.exports = function(context) { return '__COMPUTED_PROP__'; } return property.name; + case 'MemberExpression': + return void 0; case 'Literal': // Accept computed properties that are literal strings if (typeof property.value === 'string') { diff --git a/tests/lib/rules/prop-types.js b/tests/lib/rules/prop-types.js index 372fdd81b2..a45570528a 100644 --- a/tests/lib/rules/prop-types.js +++ b/tests/lib/rules/prop-types.js @@ -493,6 +493,25 @@ eslintTester.addRuleTest('lib/rules/prop-types', { classes: true, jsx: true } + }, { + code: [ + 'var TestComp1 = React.createClass({', + ' propTypes: {', + ' size: React.PropTypes.string', + ' },', + ' render: function() {', + ' var foo = {', + ' baz: \'bar\'', + ' };', + ' var icons = foo[this.props.size].salut;', + ' return
{icons}
;', + ' }', + '});' + ].join('\n'), + ecmaFeatures: { + classes: true, + jsx: true + } } ],