-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginworking as intendedIssues that are closed as they are working as intendedIssues that are closed as they are working as intended
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
interface AsyncShow {
show: () => Promise<void>
}
function mockAsyncFn(): AsyncShow {
return {
async show() {
console.log('nop')
return
}
}
}
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/require-await": "error"
},
};
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.
KuSh
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginworking as intendedIssues that are closed as they are working as intendedIssues that are closed as they are working as intended