Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Columns of parse errors are off by 1 #4896
@nightwing Thanks for the issue! If you're reporting a bug, please be sure to include:
Requesting a new rule? Please see Proposing a New Rule for instructions.
It should be fixed in Espree, though we need to verify that Esprima uses zero-based columns for errors to be sure it's the right change.
@nightwing when reporting bugs, please be sure to include all the information requested, as this issue has barely enough information. We get a lot of bugs, so providing all of what we ask for greatly improves our ability to triage.
Here is the output from the different parsers for this code:
Notice the correct column number is
tl;dr Espree is fine, we should just fix ESLint, but not at the spot indicating the original description
Verified that Espree@3 is behaving the same as Espree@2:
So, there's not an Espree issue here. The fact is that different parsers account for things like whitespace differently when reporting errors. My only concern is that the way Espree works remains consistent with itself and with Esprima.
The relevant part is here, which does appear to add a column to parsing errors. I'm not sure why we're doing that, but it does seem incorrect.