Skip to content

Commit dbdd689

Browse files
committed
add defensive coding to support experimental object spread properties
1 parent 5194c50 commit dbdd689

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/rules/display-name.js

+4
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ module.exports = function(context) {
158158
ObjectExpression: function(node) {
159159
// Search for the displayName declaration
160160
node.properties.forEach(function(property) {
161+
if (!property.key) {
162+
return;
163+
}
164+
161165
if (!isDisplayNameDeclaration(property.key)) {
162166
return;
163167
}

lib/rules/jsx-sort-prop-types.js

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ module.exports = function(context) {
8181

8282
ObjectExpression: function(node) {
8383
node.properties.forEach(function(property) {
84+
if (!property.key) {
85+
return;
86+
}
87+
8488
if (!isPropTypesDeclaration(property.key)) {
8589
return;
8690
}

0 commit comments

Comments
 (0)