Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[parser] x2028 and x2029 should increment location lines #10435

pvdz opened this issue Sep 13, 2019 · 2 comments


Copy link

commented Sep 13, 2019

Bug Report

Current Behavior

While line terminators are not allowed in strings (unless continuation), and \u2028 and \u2029 are considered line terminators explicitly, they are still allowed inside a string without needing to be escaped. Should this increase the line counter? If multi-line comments and templates do, then I think this should as well.

The same goes for 2028 and 2029 in templates.

Input Code

Unfortunately it's not "safe" to just copy paste these characters for a test so I'll try to make it very unambiguous;


Expected behavior/code

The location should have its line incremented.

>    Babel AST is different:
>    -  loc:{start:{line:1,column:0},end:{line:2,column:2}},
>    +  loc:{start:{line:1,column:0},end:{line:2,column:4}},
>    -        loc:{start:{line:1,column:0},end:{line:2,column:1}},
>    +        loc:{start:{line:1,column:0},end:{line:2,column:3}},
>    -      loc:{start:{line:1,column:0},end:{line:2,column:2}}
>    +      loc:{start:{line:1,column:0},end:{line:2,column:4}}

Babel Configuration (.babelrc, package.json, cli command)


Babel 7.5.5

Possible Solution

Treat 2028 and 2029 the same as CR or LF when it comes to location tracking.


This comment has been minimized.

Copy link

commented Sep 13, 2019

Hey @pvdz! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.


This comment has been minimized.

Copy link

commented Sep 13, 2019

cc @loganfsmyth I remember that you already thought about this problem, am I right?

@pvdz pvdz changed the title x2028 and x2029 should increment location lines [parser] x2028 and x2029 should increment location lines Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.