diff --git a/lib/rules/display-name.js b/lib/rules/display-name.js index 96a007460f..cacd75f8b6 100644 --- a/lib/rules/display-name.js +++ b/lib/rules/display-name.js @@ -158,6 +158,10 @@ module.exports = function(context) { ObjectExpression: function(node) { // Search for the displayName declaration node.properties.forEach(function(property) { + if (!property.key) { + return; + } + if (!isDisplayNameDeclaration(property.key)) { return; } diff --git a/lib/rules/jsx-sort-prop-types.js b/lib/rules/jsx-sort-prop-types.js index 6db316d3db..7e832d1db3 100644 --- a/lib/rules/jsx-sort-prop-types.js +++ b/lib/rules/jsx-sort-prop-types.js @@ -81,6 +81,10 @@ module.exports = function(context) { ObjectExpression: function(node) { node.properties.forEach(function(property) { + if (!property.key) { + return; + } + if (!isPropTypesDeclaration(property.key)) { return; }