Closed as not planned
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Link to the rule's documentation
https://typescript-eslint.io/rules/return-await/
Description
From #9030 (comment)
Another approach here might be restructuring the options as
"affectsControlFlow": "always" | "never" | "dontCare", "doesNotAffectControlFlow": "always" | "never" | "dontCare"
but that seems needlessly breaking 🤷
and #9364 (comment)
Maybe change the option so that instead of a string it's an object:
{ default: "always" | "never" | "ignore", inTryCatch?: "always" | "never" | "ignore", // undefined means "same as default" }And make the string options aliases for backward compatibility:
- "always" -
{ default: "always" }
- "in-try-catch" -
{ default: "never", inTryCatch: "always" }
- "never" -
{ default: "never" }
The new option would be
{ default: "ignore", inTryCatch: "always" }
In the future, there could be more conditions added. For example, someone might want to use "always" but make an exception for single-line arrow functions to make them less noisy:
/* eslint @typescript-eslint/promise-function-async: "error" */ /* eslint @typescript-eslint/return-await: ["error", { default: "always", inArrowFunction: "ignore" }] */ promise.then(async (v) => doSomethingAsync(v)) // allowed
Fail
// no changes
Pass
// no changes
Additional Info
No response