Permalink
Browse files

Fix: prefer-destructuring reporting compound assignments (fixes #7881) (

  • Loading branch information...
1 parent f90462e commit 3fc4e3f7a5e0d04950490ed8af08dfba0b270ecc @not-an-aardvark not-an-aardvark committed with ilyavolodin Jan 9, 2017
Showing with 6 additions and 4 deletions.
  1. +3 −1 lib/rules/prefer-destructuring.js
  2. +3 −3 tests/lib/rules/prefer-destructuring.js
@@ -158,7 +158,9 @@ module.exports = {
* @returns {void}
*/
function checkAssigmentExpression(node) {
- performCheck(node.left, node.right, node);
+ if (node.operator === "=") {
+ performCheck(node.left, node.right, node);
+ }
}
//--------------------------------------------------------------------------
@@ -72,9 +72,9 @@ ruleTester.run("prefer-destructuring", rule, {
{
code: "({ foo } = object);"
},
- {
- code: "[foo] = array;"
- }
+ "[foo] = array;",
+ "foo += array[0]",
+ "foo += bar.foo"
],
invalid: [

0 comments on commit 3fc4e3f

Please sign in to comment.