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

Tagged Template Strings are not linting correctly #2000

Closed
KevinGrandon opened this issue Nov 25, 2014 · 14 comments · Fixed by #2196
Closed

Tagged Template Strings are not linting correctly #2000

KevinGrandon opened this issue Nov 25, 2014 · 14 comments · Fixed by #2196
Labels

Comments

@KevinGrandon
Copy link
Contributor

I'm getting a Missing semicolon. error when using a tagged template string. If I have time I'll try to submit a test case for this soon.

My code looks roughly like:

function tag() {}

var testStr = 'bar';
function foo() {
  return tag `some
    ${testStr} here`;
}
foo();

@caitp
Copy link
Member

caitp commented Nov 26, 2014

I guess I'll take a look even though I look and feel like i've been hit by a truck right now :>

@caitp
Copy link
Member

caitp commented Nov 26, 2014

yeah, if I had to bet i'd say this is a regression --- but I can't be certain. specifically something related to our block parsing code. @jugglinmike you might be in a better position to look at this right now, otherwise I'll get to it when I can

@XeCycle
Copy link

XeCycle commented Feb 5, 2015

I checked out the earliest commit related to template strings --- b4be350 to be exact, and it still complains on tagged templates. Does not look like regression to me.

@msegado
Copy link

msegado commented Feb 25, 2015

The same issue occurs without the tag:

var testStr = 'bar';
function foo() {
  return `some
    ${testStr} here`;
}
/* "Missing semicolon" and "Expected an assignment or function call
and instead saw an expression" */

Also, a different error occurs when using a generator function as follows:

function* foo() {
  yield `some
    string here`;
}
/* "Bad line breaking before 'some    string here'" */

@caitp
Copy link
Member

caitp commented Feb 25, 2015

this bug was fixed iirc... are you still able to reproduce on newer versions? let me dig up the commit.

@caitp
Copy link
Member

caitp commented Feb 25, 2015

5c9c7fd --- I guess we never released this one (@rwaldron is anything blocking another patch release? there are a lot of commits since the last one)

@ruimarinho
Copy link

I tried it on 2.6.0 and noticed that tagged template strings throw out the missing semicolon error.

@caitp
Copy link
Member

caitp commented Feb 25, 2015

yeah, it's fixed just not released yet, i guess it's been a while since the last patch update =)

@ruimarinho
Copy link

Ah, nice, I had to temporarily disable jshint on pre commit 😥 was considering giving it a try, but happy to test with master :)

@msegado
Copy link

msegado commented Feb 25, 2015

@caitp Yup, I'm using 2.6.0. Thanks for the update!

@ruimarinho
Copy link

@caitp master is still not working with tagged template strings.

@caitp
Copy link
Member

caitp commented Feb 26, 2015

okay, could you file another bug about that? I'll take a look tonight

@ruimarinho
Copy link

Hm, I believe this issue already tracks the error with tagged template strings. The example posted by @KevinGrandon still throws an error when using master. Do you still want me to open a new issue?

function tag() {}

tag`foo`;

Output:

test.js: line 3, col 4, Missing semicolon.
test.js: line 3, col 4, Expected an assignment or function call and instead saw an expression.

@XeCycle
Copy link

XeCycle commented Feb 26, 2015

function TAG() {}
var str = (TAG`foo${bar}baz`);

This is not passing, in current master (as of 278ad75).

caitp added a commit to caitp/jshint that referenced this issue Feb 26, 2015
caitp added a commit to caitp/jshint that referenced this issue Feb 26, 2015
caitp added a commit to caitp/jshint that referenced this issue Feb 26, 2015
caitp added a commit to caitp/jshint that referenced this issue Feb 26, 2015
jugglinmike pushed a commit to jugglinmike/jshint that referenced this issue Feb 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants