Skip to content

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

@bisubus

Description

@bisubus

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions