Use JSON output for ESLint and fix tsserver column #2551
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes ale use ESLint's JSON formatter/reporter instead of the default line-based one. Besides being cleaner, this has the added benefit of giving us native
end_col
values:Old vs. New
I have kept the old parser around, because the
standard
linter does not support JSON output yet, and uses the ESLint output parser internally. Thexo
linter has been migrated to the JSON parser though.The new handler is at
ale#handlers#eslint#HandleJSON
, while the old line-based parser is still atale#handlers#eslint#Handle
.I have added tests 1:1 as they existed for the old parser, except this time for JSON output of course.
There was a test that dealt with something that is only relevant for the old parser, which is for ESLint adding "Error/" in front of some error codes. ESLint doesn't do this with JSON output, so that test has no equivalent.
Additionally tsserver appears to report
[a, b[
ranges instead of[a,b]
, so I fixed that off-by-one error as well. This is also visible in the screenshot above (red error).