-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Enhancement: [return-await] change rule option to object #9546
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
Comments
Reply to @Josh-Cena
Then remove the possibilities that don't make sense from the types (assuming "never" is deprecated): type Options = "always" | {
default: "always" | "ignore" | "never",
// inTryCatch: "always", // not even necessary because you can't disable it
inArrowFunctionShorthand?: "ignore" | "never",
}
This was just an example of how it would look if the rule had to be extended again. But if we assume we never want another modifier then all we are left with is just: type Options =
| "always"
| { default: "ignore", /* inTryCatch: "always" */ }
| { default: "never", /* inTryCatch: "always" */ } Which could be simplified to just @kirkwaiblinger maybe use one of these names in your PR? And even make an alias for the current "in-try-catch" |
TLDR; IMO we should not change the rule structure unless/until there are other concrete options added to the rule. The way I, personally, see the rule for now is that, after #9364, it should always enforce We have two stylistic choices
As for the other options, we have
So, that gives us three options states that we need to think about. I do not believe that there is a benefit to restructuring to an options object to support just those options. If a concrete proposal for an option is created and accepted, I think that switching to an object-based options structure (with aliases to avoid breaking changes) may well be a viable solution. But IMO that needs to exist first, before it's worth considering this issue. |
(I acknowledge that my current position may appear at odds with some of my previous comments referenced in the issue report. The context around why I considered that idea at the time has changed, and so has my opinion. I don't mean to pull the rug out from under @phaux 🙂) |
I agree. The current three choices: always, in-try-catch, in-try-catch-only (?) correspond to |
Closing for now, but I would invite this to be reopened/refiled if a concrete option proposal is created as discussed. |
Before You File a Proposal Please Confirm You Have Done The Following...
My proposal is suitable for this project
Link to the rule's documentation
https://typescript-eslint.io/rules/return-await/
Description
From #9030 (comment)
and #9364 (comment)
Fail
// no changes
Pass
// no changes
Additional Info
No response
The text was updated successfully, but these errors were encountered: