-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[[FIX]] Handle multi-line template literal return statements #2142
Conversation
@jugglinmike could you review this one? it was the quickest hack i could come up with to support multi-line tokens in return statements |
Hey Cait! It looks like this is indicative of a larger problem that exists for all multi-line structures: Lines 1377 to 1386 in 33612f8
For instance, this also fails: /* jshint multistr: true */
function foo() {
return 'start\
end';
}; I know your patch is intended as a quick hack, but what would you say to trying to resolve the problem a bit more generally? Here's what I'm thinking that would look like: Multiline structures would need to track their last line and first line. I think it would make the most sense to change the current semantics around and have Do you think it would be that easy? Or maybe not and better to try in a follow up patch? |
@jugglinmike in general, I don't think it is a problem. It is a problem for templates, because a single template token can span multiple lines. But as far as I'm aware, no other token fits that category |
@caitp It's also a problem for multi-line string literals. |
few extra bits added to work for string literals too... i think this can be generalized more cleanly, but i'll do that in a different patch |
This is a slight alteration of jshint#2142 to cleanly rebase atop the previous diffs adding context, allowing it to work with nested templates. Fixes: jshint#1814
This is a slight alteration of jshint#2142 to cleanly rebase atop the previous diffs adding context, allowing it to work with nested templates. Closes jshint#1814 Closes jshint#2142
Closes #1814