eslint-plugin-promise icon indicating copy to clipboard operation
eslint-plugin-promise copied to clipboard

`promise/prefer-await-to-then` ignore constructor scope

Open dimaMachina opened this issue 2 years ago • 1 comments
trafficstars

Description

promise/prefer-await-to-then should not report errors if .then/.catch calls are inside constructor of some class

Because we can't have async constructor

dimaMachina avatar Mar 31 '23 23:03 dimaMachina

You could always define an async function and call that function in the constructor without awaiting.

yacinehmito avatar Jul 18 '23 09:07 yacinehmito

While I think this could be done with configuration, I think some projects may prefer to avoid such usages in case there is something wrong with using Promises at all in a constructor.

brettz9 avatar Jul 20 '24 10:07 brettz9