Skip to content
This repository was archived by the owner on May 12, 2025. It is now read-only.
This repository was archived by the owner on May 12, 2025. It is now read-only.

V16.1.1 throw error for return await within a try-catch block. #280

@steven-g-w

Description

@steven-g-w

version 16.1.1 will throw error for return await within a try-catch block.

async function doSomething() {
  try {
    return await doSomethingAsync();
  } catch (err) {
    console.log('we have an error!');
  }
}

Above code will fail lint check, and even gets auto fixed by removing the await if run lint --fix, which will change the error handling behaviour.

This can be fixed by changing the rule to:

'@typescript-eslint/return-await': [baseBestPracticesRules['no-return-await'], 'in-try-catch'],

I'm happy to create a PR if we agree on that change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions