javascript icon indicating copy to clipboard operation
javascript copied to clipboard

[perf] disallow async/await

Open aladdin-add opened this issue 7 years ago • 9 comments

aladdin-add avatar Jul 03 '18 09:07 aladdin-add

async/await is already disallowed by this guide due to the regenerator-runtime requirement; however, once that is obviated, we'll be allowing it.

ljharb avatar Jul 03 '18 17:07 ljharb

however I'm not seeing it in the guide, am I missing something?

aladdin-add avatar Jul 03 '18 17:07 aladdin-add

It's handled by the linter.

ljharb avatar Jul 03 '18 17:07 ljharb

no-restricted-syntax? I was not seeing it either. (I am using eslint-config-airbnb, it doesn't report the usage)

aladdin-add avatar Jul 03 '18 17:07 aladdin-add

oh hm, maybe we haven't restricted it explicitly just yet. However, since babel-preset-airbnb doesn't transpile it, and since we use the default parser, it shouldn't parse at all.

If you're using babel-eslint, you've already deviated from the guide.

ljharb avatar Jul 03 '18 17:07 ljharb

async/await has been included in ES spec. maybe we can add it in the config.

I can make a PR if no objection. :)

aladdin-add avatar Jul 03 '18 17:07 aladdin-add

That's been true for over a year; there's a number of things in the spec that we don't support because the default eslint parser doesn't yet parse them.

Sure, a PR to add a section to the guide about async/await would be fine.

ljharb avatar Jul 03 '18 17:07 ljharb

@ljharb Is async/await still discouraged? I can use it without babel (hence no increase in bundle size). It's not supported in IE but Promise isn't either.

riwu avatar May 04 '20 09:05 riwu

@riwu but Promise is shimmable/polyfillable, and you should be shimming in your app regardless - async/await is not.

ljharb avatar May 05 '20 16:05 ljharb