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

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

Closed
steven-g-w opened this issue Mar 11, 2022 · 3 comments
Closed

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

steven-g-w opened this issue Mar 11, 2022 · 3 comments
Labels

Comments

@steven-g-w
Copy link
Contributor

steven-g-w commented Mar 11, 2022

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.

@iamturns
Copy link
Owner

Thanks @steven-g-w - good catch. Your proposed changes make sense to me. A PR would be great, if you're keen!

@steven-g-w
Copy link
Contributor Author

Thanks @iamturns, created above PR: #282

@iamturns
Copy link
Owner

🎉 This issue has been resolved in version 16.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this issue Mar 23, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [eslint-config-airbnb-typescript](https://github.com/iamturns/eslint-config-airbnb-typescript) | devDependencies | patch | [`16.1.2` -> `16.1.4`](https://renovatebot.com/diffs/npm/eslint-config-airbnb-typescript/16.1.2/16.1.4) |

---

### Release Notes

<details>
<summary>iamturns/eslint-config-airbnb-typescript</summary>

### [`v16.1.4`](https://github.com/iamturns/eslint-config-airbnb-typescript/releases/v16.1.4)

[Compare Source](iamturns/eslint-config-airbnb-typescript@v16.1.3...v16.1.4)

##### Bug Fixes

-   disable additional rules handled by TypeScript compiler ([#&#8203;283](iamturns/eslint-config-airbnb-typescript#283)) ([11185a9](iamturns/eslint-config-airbnb-typescript@11185a9))

### [`v16.1.3`](https://github.com/iamturns/eslint-config-airbnb-typescript/releases/v16.1.3)

[Compare Source](iamturns/eslint-config-airbnb-typescript@v16.1.2...v16.1.3)

##### Bug Fixes

-   allow `return await` in `try-catch` block ([#&#8203;282](iamturns/eslint-config-airbnb-typescript#282)) ([221be43](iamturns/eslint-config-airbnb-typescript@221be43)), closes [#&#8203;280](iamturns/eslint-config-airbnb-typescript#280)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Co-authored-by: 6543 <6543@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1230
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants