Closed kirkwaiblinger closed 3 weeks ago
Thanks for the suggestion. We generally don't accept proposals for changing internal logic on their own. To proceed, we'd need you to outline what the problems are with the current approach from the end-user perspective. That means finding all the rules that use this function and showing before/after of the highlighted areas.
Closing since I am feeling lazy, and the arrow function part of this seems DOA at this point anyway a la #18339 😄
It looks like there wasn't enough information for us to know how to help you, so we're closing the issue.
Thanks for your understanding.
ESLint version
main
What problem do you want to solve?
getFunctionHeadLoc
is an excellent utility for making reports on function nodes less noisy than just highlighting the whole thing. Love it!There are a few things about the report locations, though, that I would change, ranging from outright buggy IMO to more opinion-based.
What do you think is the correct solution?
I'd like to make the following changes to the defined behavior for
getFunctionHeadLoc
.=
sign either when solving 1.=>
as the loc for arrow functions (async or not). This is a really difficult one, since there is no good spot. But I think that highlighting from the start of the arrow fn through the end of the parameter list is a significantly better loc than just=>
, even though it's a bit noisier. There's no right answer here, though, so I'll happily drop this point if it doesn't have consensus.Examples of changes looking at the JSDoc for
getFunctionHeadLoc
Participation
Additional comments
Alluded to item 1. above in https://github.com/eslint/eslint/issues/18339, but I now think these should be considered as completely separate issues (in part because I don't think that
require-await
should usegetFunctionHeadLoc
at all)