@@ -272,10 +272,13 @@ function doLint(
272
272
) {
273
273
let isSameMicroTask = pIsSameTask
274
274
275
+ const differentMicroTaskEnterNodes : TSESTree . Node [ ] = [ ]
276
+
275
277
traverseNodes ( ast , {
276
278
enterNode ( node ) {
277
279
// Promise.then() or Promise.catch() is called.
278
280
if ( isPromiseThenOrCatchBody ( node ) ) {
281
+ differentMicroTaskEnterNodes . push ( node )
279
282
isSameMicroTask = false
280
283
}
281
284
@@ -285,6 +288,7 @@ function doLint(
285
288
...taskReferences ,
286
289
] ) {
287
290
if ( isChildNode ( callExpression , node ) ) {
291
+ differentMicroTaskEnterNodes . push ( node )
288
292
isSameMicroTask = false
289
293
}
290
294
}
@@ -295,6 +299,7 @@ function doLint(
295
299
node . parent ?. right . type === "AwaitExpression" &&
296
300
node . parent ?. left === node
297
301
) {
302
+ differentMicroTaskEnterNodes . push ( node )
298
303
isSameMicroTask = false
299
304
}
300
305
@@ -355,27 +360,7 @@ function doLint(
355
360
}
356
361
}
357
362
358
- // Promise.then() or Promise.catch() is called.
359
- if ( isPromiseThenOrCatchBody ( node ) ) {
360
- isSameMicroTask = true
361
- }
362
-
363
- // `tick`, `setTimeout`, `setInterval` , `queueMicrotask` is called
364
- for ( const { node : callExpression } of [
365
- ...tickCallExpressions ,
366
- ...taskReferences ,
367
- ] ) {
368
- if ( isChildNode ( callExpression , node ) ) {
369
- isSameMicroTask = true
370
- }
371
- }
372
-
373
- // left side of await block
374
- if (
375
- node . parent ?. type === "AssignmentExpression" &&
376
- node . parent ?. right . type === "AwaitExpression" &&
377
- node . parent ?. left === node
378
- ) {
363
+ if ( differentMicroTaskEnterNodes . includes ( node ) ) {
379
364
isSameMicroTask = true
380
365
}
381
366
} ,
0 commit comments