End location inference doesn't work for rules using the new-style context.report API #8980
Labels
accepted
There is consensus among the team that this change meets the criteria for inclusion
archived due to age
This issue has been archived; please open a new issue for any further discussion
bug
ESLint is working incorrectly
core
Relates to ESLint's core APIs and features
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
I expected the resulting problem to have an
endLine
andendColumn
, because theno-whitespace-before-property
rule reports a node.What actually happened? Please include the actual, raw output from ESLint.
Note that there is no
endLine
andendColumn
.The issue is that the change in b0c63f0 was incomplete. It modifies the logic in
lib/eslint.js
(which has now been renamed tolib/linter.js
) to correctly handle the case where no location is provided. However, the report conversion logic for the object-basedcontext.report
API inrule-context.js
incorrectly passes thestart
of a node as an explicit location. The result is thatlib/linter.js
does not add an end location because it thinks an explicit start location was already provided.The quick fix would be to replace
descriptor.node.loc.start
on this line withdescriptor.node.loc
. As a potentially separate fix, I think we should refactor the interaction betweenLinter#report
andRuleContext#report
. This bug occurred because the two methods don't have a clear separation of responsibilities with regard to handling locations that weren't provided by the rule.The text was updated successfully, but these errors were encountered: