require-atomic-updates false positive
See original GitHub issueTell us about your environment
- ESLint Version: 6.0.1
- Node Version: 12.4.0
- npm Version: 6.9.0
What parser (default, Babel-ESLint, etc.) are you using?
Default
Please show your full configuration:
https://github.com/medikoo/eslint-config-medikoo/blob/master/index.js
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
const fn = async someObj => {
let { foo } = someObj;
await Promise.resolve();
// Possible race condition: `someObj.bar` might be reassigned based on an outdated value of `someObj.bar`
someObj.bar = "whatever";
};
What did you expect to happen?
No error reported
What actually happened? Please include the actual, raw output from ESLint.
Error reported:
Possible race condition: `someObj.bar` might be reassigned based on an outdated value of
Are you willing to submit a pull request to fix this bug?
Not at this point
Issue Analytics
- State:
- Created 4 years ago
- Reactions:127
- Comments:57 (11 by maintainers)
Top Results From Across the Web
await async - race condition error in ESLint require-atomic ...
This looks very much like a false positive. I can't see how the rule conditions apply to your code. If this is your...
Read more >require-atomic-updates - ESLint - Pluggable JavaScript Linter
This rule has an object option: "allowProperties" : When set to true , the rule does not report assignments to properties. Default is...
Read more >require-atomic-updates false positive, eslint:recommended, eslint ...
The "extends": "eslint:recommended" property in a configuration file enables rules that report common problems, which have a check mark below. The --fix option ......
Read more >Migrating to v6.0.0 - ESLint中文文档
To address: Make sure you upgrade to at least Node.js 8 when using ESLint v6. ... might need to disable additional rules to...
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
I would say that if nothing else, error message is pretty misleading.
That is simply not true, because
someObj.bar = "whatever";
assigns string"whatever"
which is not depending onsomeObj.bar
in any way.Also, it’s not following the rule definition which clearly states that following must be true:
Ok, but that’s pretty aggressive assumption, as in many cases that can be an intentional well-thought construct
In place where it reported for me, it’s totally intentional and there’s no way to write it differently (aside of dropping async/await), due to that I needed to turn off this rule globally.
Still I’d love it to report for me cases as
count += await getCount()
which are error-prone obviously (and even if not, easy to write in a way they do not report)