Change Request: Some tweaks to getFunctionHeadLoc #18371
Labels
core
Relates to ESLint's core APIs and features
enhancement
This change enhances an existing feature of ESLint
needs info
Not enough information has been provided to triage this issue
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 #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)The text was updated successfully, but these errors were encountered: