prefer-destructuring reports false positives with compound assignments
See original GitHub issueTell us about your environment
- ESLint Version: 3.13.0
- Node Version: 7.3.0
- npm Version: 4.0.5
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
{ "parserOptions": { "ecmaVersion": 6 } }
What did you do? Please include the actual source code causing the issue.
/* eslint prefer-destructuring: error */
let foo = 0;
foo += bar.foo;
What did you expect to happen?
No error, I guess.
What actually happened? Please include the actual, raw output from ESLint.
4:1 error Use object destructuring prefer-destructuring
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Bayes' Theorem Example: Surprising False Positives - YouTube
We apply Bayes' Theorem to decide the conditional probability that you have an illness given that you have tested positive for a disease....
Read more >eslint/CHANGELOG.md
143, * 240c1a4 Fix: prefer-const object destructuring false positive (fixes ... 1114, * 3fc4e3f Fix: prefer-destructuring reporting compound assignments ...
Read more >node_modules/eslint/CHANGELOG.md · master · tbrousso ...
39dfe08 Update: false positives in function-call-argument-newline ... 3fc4e3f Fix: prefer-destructuring reporting compound assignments ...
Read more >eslint-config-canonical
Rule CN AB GG SD XO
@babel/new‑cap ❌ 👻 👻 👻 👻
@babel/no‑invalid‑this 🚨 👻 👻 👻 👻
@babel/no‑unused‑expressions 🚨 👻 👻 👻 👻
Read more >How to Decipher False Positives (and Negatives) with Bayes ...
When I teach conditional probability, I tell my students to pay close attention to the vertical line in the formula above.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kaicataldo I personally am not that big on helping people 😃 Creating and properly writing an issue just seems like too much work, sorry 😊
And my suggestion is already out there, it’s pretty simple. It goes like this:
This rule should completely ignore everything but variable definitions (var, const, let, function arguments, commonjs imports) and ignore things that are already a destructuring assignment.
That’s it, at least I cannot think of any other valid use for this rule.
I can reproduce this, thanks for the report.
It’s happening because the rule is treating the line the same as
…which could be fixed to