Skip to content

Commit 9842eb6

Browse files
committed
Merge pull request jsx-eslint#189 from teambox/fix/defensive-coding-to-support-object-spread
Fix object rest/spread handling in display-name and jsx-sort-prop-types
2 parents 5194c50 + dbdd689 commit 9842eb6

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)