Skip to content

Commit

Permalink
Fix: prefer-destructuring reporting compound assignments (fixes #7881) (
Browse files Browse the repository at this point in the history
  • Loading branch information
not-an-aardvark authored and ilyavolodin committed Jan 9, 2017
1 parent f90462e commit 3fc4e3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/rules/prefer-destructuring.js
Expand Up @@ -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);
}
}

//--------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/rules/prefer-destructuring.js
Expand Up @@ -72,9 +72,9 @@ ruleTester.run("prefer-destructuring", rule, {
{
code: "({ foo } = object);"
},
{
code: "[foo] = array;"
}
"[foo] = array;",
"foo += array[0]",
"foo += bar.foo"
],

invalid: [
Expand Down

0 comments on commit 3fc4e3f

Please sign in to comment.