15

Enable ESLint rule no-async-promise-executor on the remainder of the tree (mainl...

 3 years ago
source link: https://bugzilla.mozilla.org/show_bug.cgi?id=1683340
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Details

When we upgraded to ESLint 6, we disabled the no-async-promise-executor rule for various files as it wasn't a quick enable.

This bug is for dom/ and the final file in netwerk/

Some notes about this rule (from ESlint's site):

The Promise executor function can be an async function. However, this is usually a mistake, for a few reasons:

  • If an async executor function throws an error, the error will be lost and won’t cause the newly-constructed Promise to reject. This could make it difficult to debug and handle some errors.
  • If a Promise executor function is using await, this is usually a sign that it is not actually necessary to use the new Promise constructor, or the scope of the new Promise constructor can be reduced.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK