question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

require-await: triggers with no `await` statement, but returns `Promise`

See original GitHub issue

Tell 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:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nektrocommented, Sep 17, 2020

Good to know. Regardless, the name of this issue has been solved. Thanks for the help y’all 😃

0reactions
ljharbcommented, Sep 17, 2020

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found