-
-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule proposal: prefer-queue-microtask
#1346
Comments
I never used |
Good points. Lots of APIs with subtle differences. I've also used those at different times, or for different purposes. It's complicated. @fisker Any reservations about a rule to prefer |
What I was saying, I think |
I will try to summarize the differences as far as I know it:
|
We could support (async () => {
// Cannot use `queueMicrotask` here.
await ''; // Defer a micro-task tick.
console.log('Hello');
})(); |
|
Ideally, we would have a rule |
Seems like we'll eventually get another alternative, so we can put this rule on hold until it's a reality: |
Doesn't look like it will happen anytime soon, so this is now accepted. Let's start with preferring |
queueMicrotask()
serves a similar purpose toprocess.nextTick()
with the additional advantage thatqueueMicrotask()
is specified in the WHATWG HTML Living Standard and supported on both modern browsers and Node.js (v11.0.0 and later).When to use
queueMicrotask()
vs.process.nextTick()
in the Node.js API documentation states:I propose adding a rule to warn when
process.nextTick
is used, and suggestqueueMicrotask()
as an alternative.Fail
Pass
The text was updated successfully, but these errors were encountered: