-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed as not planned
Closed as not planned
Copy link
Labels
enhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleNew rule option for an existing eslint-plugin rulepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a lookWaiting for team members to take a look
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/require-await
Description
"require-await" rule asserts an existence of await
inside async
function. However, when a class method is inherited from a parent async
method, sometimes it's inevitable to keep async
signature even when the body doesn't have any await
. Of course, one workaround is declaring it as a sync function then returning Promise.resolve(...)
but that's less ergonomic.
So my proposal is adding an option called, let's say "AllowInOverriddenFunctions", that allows async
functions without await
for overridden functions. Please take a look at the example below.
Pass
abstract class A {
abstract func(): Promise<undefined>;
}
class B extends A {
override async func() {
return undefined;
}
}
Additional Info
No response
Metadata
Metadata
Assignees
Labels
enhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleNew rule option for an existing eslint-plugin rulepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a lookWaiting for team members to take a look