eslint-plugin-promise
eslint-plugin-promise copied to clipboard
prefer-await-to-then not throwing an error
trafficstars
Description
I configured the rule like that:
'promise/prefer-await-to-then': 'error'
This code doesn't give me an error, though:
function foo(): void {
alert('test');
}
const test = new Promise(foo);
test.then(foo).then(foo);
The other rules work fine, though.
Is there anything special about this rule?
I read the source code for the prefer-await-to-then rule.
It looks like we're intentionally excluding the top-level then. I think it's because there are platforms where top-level await is not yet available.
I think this should be configurable now.