Bug: [return-await] should handle nested try-catch-finally blocks with "in-try-catch" option #8907
Closed
4 tasks done
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
locked due to age
Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Milestone
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.2.2&showAST=es&fileType=.tsx&code=IYZwngdgxgBAZgV2gFwJYHsLwBQEoYDeAUDDMgE5iEmlmXW0wC%2B8qEwANh1cY6QPT8YwOHACmUZCBhjy5dORgALYBAAmHNgHMY6OLoTJZMKMGRQlNRuTHIE5LAAV5AW1QgxAOhsArCcjwAbitmGhZTcyVqMKImIiJQSFhEFAwsOAAmPAY6HjCTMwsc0go8xhY4Nk5uYtpBYVF-aVl5RRV1TQgdPQMjRUr2LjAQ0hs7BxhndDcPbzE-SSCQuNIKqqHamKYgA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6aRfWaJ2gQwDufSvnRgA2pETRoAe2iQANFGa180QrTJ98ZABaQAuuDABfEKaA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
I expect that the commented promises should flag as requiring await.
Actual Result
no errors
Additional Info
The
in-try-catch
deductions are generally buggy. Note that putting anawait
doesn't cause the rule to flag that it's unnecessary either, despite the rule's documentation implying that there will only be one correct choice in each scenario.See also #8663
Note that putting a
return
in acatch
suffers the same defect and is probably a more realistic example for this issue.The text was updated successfully, but these errors were encountered: