Repository: yannickcr/eslint-plugin-react (js)

Issue:
`boolean-prop-naming` triggers "Cannot read property 'type' of undefined"
Hello,

When I add this rule to my .eslintrc file Visual Studio Code triggers a popup error `Cannot read property 'type' of undefined`.

This is my rule:
`"react/boolean-prop-naming": [1, { "rule": "(^(is|has)[A-Z]([A-Za-z0-9]?)+)|(^[a-z]+(ed|able)$)" }],`

I think this is related somehow to the spread operator as the errors trigger when I type `...test`

Pull request description:
Fixes #1369
Fixed a crash in the boolean-prop-naming rule.

Patch:
diff --git a/lib/rules/boolean-prop-naming.js b/lib/rules/boolean-prop-naming.js
index 105b3efa..66462acd 100644
--- a/lib/rules/boolean-prop-naming.js
+++ b/lib/rules/boolean-prop-naming.js
@@ -1,6 +1,6 @@
 /**
  * @fileoverview Enforces consistent naming for boolean props
- * @author Evgueni Naverniouk
+ * @author Ev Haus
  */
 'use strict';
 
@@ -57,7 +57,7 @@ module.exports = {
     function isPropTypesDeclaration(node) {
       // Special case for class properties
       // (babel-eslint does not expose property name so we have to rely on tokens)
-      if (node.type === 'ClassProperty') {
+      if (node && node.type === 'ClassProperty') {
         const tokens = context.getFirstTokens(node, 2);
         if (tokens[0].value === 'propTypes' || (tokens[1] && tokens[1].value === 'propTypes')) {
           return true;


Test patch:
diff --git a/tests/lib/rules/boolean-prop-naming.js b/tests/lib/rules/boolean-prop-naming.js
index 5ff5cc28..3c538703 100644
--- a/tests/lib/rules/boolean-prop-naming.js
+++ b/tests/lib/rules/boolean-prop-naming.js
@@ -1,6 +1,6 @@
 /**
  * @fileoverview Enforces consistent naming for boolean props
- * @author Evgueni Naverniouk
+ * @author Ev Haus
  */
 'use strict';
 
@@ -247,6 +247,16 @@ ruleTester.run('boolean-prop-naming', rule, {
       rule: '^is[A-Z]([A-Za-z0-9]?)+'
     }],
     parser: 'babel-eslint'
+  }, {
+    // Ensure rule doesn't crash on destructured objects [Issue #1369]
+    code: [
+      'var x = {a: 1}',
+      'var y = {...x}'
+    ].join('\n'),
+    options: [{
+      rule: '^is[A-Z]([A-Za-z0-9]?)+'
+    }],
+    parser: 'babel-eslint'
   }],
 
   invalid: [{