Skip to content
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

prefer-await-to-then not throwing an error #179

Open
alfechner opened this issue Jan 15, 2020 · 2 comments
Open

prefer-await-to-then not throwing an error #179

alfechner opened this issue Jan 15, 2020 · 2 comments

Comments

@alfechner
Copy link

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?

@ota-meshi
Copy link
Member

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.

@brettz9
Copy link
Member

brettz9 commented Jul 20, 2024

I think this should be configurable now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants