Bug: [@typescript-eslint/require-await] False positive when implementing async interface with sync function #7450
Labels
bug
Something isn't working
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
working as intended
Issues that are closed as they are working as intended
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.1.6&fileType=.ts&code=LAKAlgdgLgpgTgMwIYGMYAICCBnAnhFAZQAsB7Ad3QG9R071szyAudACgEp0BeAPnQAKcUgFsw2GAB4AbqTAATXqAC%2BoUAgCuBKGFIR0I0igDWOfCgBiETqzMESFarXpwYUDXH00Q9X%2BiR4BAxMnE4%2BfhEoetikADYwAHSxpADmbADkEKQADukczhG%2Bru6eBX6q4XQVFUA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6aRAR1ko9oEMA7v0r50URNGgB7aJHBgAviEVA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
No error.
Actual Result
Error on
show
implementation: Async method 'show' has no 'await' expression.Additional Info
Since the method just implement an interface (which might be out of scope), it shouldn't require await keyword if it is not necessary for this specific implementation.
The way to fix this is to use
Promise.resolve()
inside non-async function, but that's unnecessarily verbose.The text was updated successfully, but these errors were encountered: