New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: require-await has a bad report loc for arrow functions. #18339
Comments
Thanks for the report. The location is being returned from @eslint/eslint-team thoughts? |
I think My understanding of this issue is that, in this particular rule, the question is whether we should mark the function as a whole, or specifically |
That makes sense, although I disagree that the point of the rule is to suggest removing
To that end, it seems correct to flag the entire function as the problem rather than just However, I don't feel very strongly, so happy to go along with the consensus of the team here. |
IMO underlining the |
In other words, I personally read the linter underline as "Why is this here?" not "You should remove this.". |
Yeah, not everyone reads the red squigglies the same way. Our intent is to say "this is the location of the problem", but not everyone reads it that way. |
Well, right, and fair enough. |
True enough, but we're in a no-win situation with arrow functions because they don't have any formal declaration syntax to hook onto except the arrow. So if we're going to highlight "this function has a problem" highlighting the arrow represents the least confusion vs. highlights the (potentially non-existent) arguments or the entire body. The arrow is, in fact, the only syntax for arrow functions that is guaranteed to be there 100% of the time. @mdjermanovic @fasttime still waiting for your feedback on this issue. |
Completely agree! 🙂
In general, yes. But, not in this rule, since we'll always have the |
I still think the official point of this rule is to suggest removing eslint/docs/src/rules/require-await.md Line 25 in eeec413
That said, I completely agree that this rule can catch missing The fact that the function is
So I also don't feel strongly about making any changes here. If no one from the team has a strong opinion that the location should be changed, it is probably best to leave it as it is now. |
All right, it seems that we don't have anyone on the team that feels strongly to make this change, so closing. We appreciate the thoughtful discussion @kirkwaiblinger! |
Makes sense! Likewise 🙂 |
Environment
Node version:
npm version:
Local ESLint version:
Global ESLint version:
Operating System:
What parser are you using?
Default (Espree)
What did you do?
What did you expect to happen?
What actually happened?
Link to Minimal Reproducible Example
https://eslint.org/play/#eyJ0ZXh0IjoiYXN5bmMgKCkgPT4geyByZXR1cm47IH1cbiIsIm9wdGlvbnMiOnsicnVsZXMiOnsicmVxdWlyZS1hd2FpdCI6WyJlcnJvciJdfSwibGFuZ3VhZ2VPcHRpb25zIjp7ImVjbWFWZXJzaW9uIjoibGF0ZXN0Iiwic291cmNlVHlwZSI6Im1vZHVsZSIsInBhcnNlck9wdGlvbnMiOnsiZWNtYUZlYXR1cmVzIjp7fX19fX0=
Participation
Additional comments
Note that the named function case is much more sensible
but the non-arrow anonymous function expressions could use a little cleanup as well:
The text was updated successfully, but these errors were encountered: