require-await: triggers with no `await` statement, but returns `Promise`
See original GitHub issueTell us about your environment
- ESLint Version: v6.8.0
- Node Version: v14.10.1
- npm Version: v6.14.8
- pnpm Version: v5.5.4
What parser (default, @babel/eslint-parser
, @typescript-eslint/parser
, etc.) are you using?
default
Please show your full configuration:
https://github.com/nektro/mantle/blob/v49-a2d6e3d/.eslintrc
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
https://github.com/nektro/mantle/blob/v49-a2d6e3d/www/chat/js/api/user.js#L21-L25
async getRoles() {
return Promise.all(this.roles.map((v) => api.M.roles.get(v))).then((l) => {
return l.sort((a,b) => a.position - b.position);
});
}
./node_modules/.bin/eslint ./www/chat/js/
What did you expect to happen? No error.
What actually happened? Please include the actual, raw output from ESLint.
/home/meghan/dev/golang/mantle/www/chat/js/api/user.js
21:5 error Async method 'getRoles' has no 'await' expression require-await
Are you willing to submit a pull request to fix this bug? Unfamiliar with eslint code and do not know how one would go about fixing this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
require-await - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Why do I need to await an async function when it is not ...
I'm confused because based on the documentation, await should pause the execution till the promise is resolved. In which case, the first example ......
Read more >javascript - await does not wait for Promise to finish
I have read lots of documentation about this and I had hoped that await would have the code wait until the Apex method...
Read more >Async/await - Wikipedia
In computer programming, the async/await pattern is a syntactic feature of many programming languages that allows an asynchronous, non-blocking function to ...
Read more >return-await | typescript-eslint
Returning an awaited promise can make sense for better stack trace information as well as for consistent error handling (returned promises will not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Good to know. Regardless, the name of this issue has been solved. Thanks for the help y’all 😃
I would not expect any builtin eslint rule to treat a nonstandard comment format specially.
Either way, jsdoc comments wouldn’t tell you what a function from another file returns, without cross-file linting, which virtually no eslint rules in the entire ecosystem do (outside of eslint-plugin-import)