Closed hsxfjames closed 7 years ago
I think return values of extract()
should include dedent length, which can be passed to code.originalLocation()
, then subtract it some where. Subtracting it at return value of indexToLocation()
looks good.
I will look into it, but dedent informations should already be taken into account. The issue may be linked to the usage of a "custom" formatter. Can you confirm that without specifying the --format
option, columns are reported correctly?
I published a fix, let me know if it works for you.
Hi, @BenoitZugmeyer
Without specifying --format
option, ESLint will use default stylish formatter and show the same column.
The fix works fine, since the original location is matched with original line. Thx.
This is a plunker to reproduce the problem: http://plnkr.co/edit/SKvcqNj8S3KiG4x7GRsL .
I installed eslint-plugin-html and eslint-friendly-formatter to lint my code. But I found if I let eslint-plugin-html to dedent by default, I'll get a wrong message. e.g. for this code:
The code violates
space-before-blocks
andspace-before-function-paren
rules, but error messages from formatter shows:And I write a simple formatter.js, and just return some fields from reports structure, get
You can see the source code is dedented, but the code location isn't recalculated, so we get a wrong
column
field.I've tried modifying line 107 in TransformableString.js to
then we'll get correct
column
field. Though it works, I haven't completely figure out how plugin works. Hope you can find a better way to subtract the dedent length.