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

Never start a line with ` because of tagged template strings #289

Closed
gyson opened this issue Oct 11, 2015 · 6 comments

Comments

@gyson
Copy link

commented Oct 11, 2015

because

let x = () => {}

`hello`

console.log(x)

will output

undefined

(tested with nodejs v4.1.0)

@feross

This comment has been minimized.

Copy link
Member

commented Oct 16, 2015

Issue opened on eslint: eslint/eslint#4169

@feross

This comment has been minimized.

Copy link
Member

commented Oct 19, 2015

Turns out this is a bug in V8. See the bug I filed here: https://code.google.com/p/v8/issues/detail?id=4497

A semicolon should automatically be inserted by the JS engine. The fact that it isn't in node v4 is a bug. Fortunately, the V8 developers say it's fixed in master so it'll make it's way to node soon enough.

Mystery solved. We don't need to detect this case in standard.

@feross feross closed this Oct 19, 2015

@gyson

This comment has been minimized.

Copy link
Author

commented Oct 20, 2015

Thanks for your clarification.

Just one more question:

Would this case

let x = () => {}
let y = x
`hello`

be parsed to

let x = () => {};
let y = x`hello`;

or

let x = () => {};
let y = x;
`hello`;

?

@feross

This comment has been minimized.

Copy link
Member

commented Oct 20, 2015

@gyson I think it will actually be parsed to the first one. :( Fortunately, the eslint developers are aware and plan to improve the rule: eslint/eslint#4169 (comment)

@gyson

This comment has been minimized.

Copy link
Author

commented Oct 21, 2015

@feross I see. Thanks.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.