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 doesn't enforce .then/.catch/.finally #294

Open
bisubus opened this issue Apr 22, 2022 · 2 comments
Open

prefer-await-to-then doesn't enforce .then/.catch/.finally #294

bisubus opened this issue Apr 22, 2022 · 2 comments

Comments

@bisubus
Copy link

bisubus commented Apr 22, 2022

Description

Currently the rule is not enforced if a chain in async/await is correctly established. It could possibly have strict option to get rid of promise methods and prefer await completely.

Steps to Reproduce

async function doQuery() {
  await query
    .then(() => { console.log('complete'))
    .catch(() => { console.log('error'))
}

Expected behavior:

Both then and catch trigger linter error.

Actual behavior:

The error is triggered with then and only if await is missing.

Versions

[Please fill this in if you are submitting a bug report]

  • Node version: v16.13.2
  • ESLint version: 7.32.0
  • eslint-plugin-promise version: 6.0.0

Additional Information

Related: #187

@thodoo
Copy link

thodoo commented Oct 11, 2022

Wanting to enforce this was the reason I found this plugin. I also expected the same behavior.

@netotz
Copy link

netotz commented Mar 30, 2023

Wanting to enforce this was the reason I found this plugin

same lmao @xjamundx @macklinu @aaditmshah

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

No branches or pull requests

3 participants