fix(eslint-plugin): [require-await] Allow concise arrow function bodies #826
+62
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
@typescript-eslint/require-await
rule exists to allow exceptions to the core ESLintrequire-await
rule for async functions that return a promise (where adding anawait
to the return to suppress therequire-await
warnings would in turn trigger warnings forno-return-await
).The initial implementation of the
@typescript-eslint/require-await
rule allowed the following exceptions:(the rule was only checking
ReturnStatement
nodes)This PR adds support for:
(single-line expressions that don't explicitly include a
return
statement)Prior to this PR, the following code would fall through to the core ESLint
require-await
rule and trigger warnings:After this PR, only the last example should fall through to the core rule and triggers a warning: