Skip to content
Permalink
Browse files
Fix: require-atomic-updates false positive across await (fixes #11954) (
  • Loading branch information
buhichan committed Dec 18, 2020
1 parent 301d0c0 commit f85b4c72668c95c79fdb342b74dbd53d21baa93f
Showing with 15 additions and 0 deletions.
  1. +3 −0 lib/rules/require-atomic-updates.js
  2. +12 −0 tests/lib/rules/require-atomic-updates.js
@@ -113,6 +113,9 @@ class SegmentInfo {

if (info) {
info.freshReadVariableNames.add(variableName);

// If a variable is freshly read again, then it's no more out-dated.
info.outdatedReadVariableNames.delete(variableName);
}
}
}
@@ -150,6 +150,18 @@ ruleTester.run("require-atomic-updates", rule, {
let bar = await get(foo.id);
foo.prop = bar.prop;
}
`,

// https://github.com/eslint/eslint/issues/11954
`
let count = 0
let queue = []
async function A(...args) {
count += 1
await new Promise(resolve=>resolve())
count -= 1
return
}
`
],

0 comments on commit f85b4c7

Please sign in to comment.