-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Template string variables in JSX raises "Unexpected token ILLEGAL" #95
Comments
Must have to do with the template string changes. Just so we're clear, you're saying this is a regression from v1.11.0 that you found in v1.12.0? |
Oh, yes it is (I mixed up version numbers) |
Sometimes I also see messages like:
In cases where I am using ES6 template strings in props as well. Not sure if that is the same problem or not. Let me know if you'd like me to open another issue. |
@nzakas let me know what you find. My guess is missing curlyStack pop push inside JSX expressions. |
Related: jquery/esprima#1145 |
Can you provide an actual code snippet that exhibits this bug? |
Hey I'm having this problem as well, and it's breaking my CI build :) This will reproduce the <a>{`${1}`}{``}</a>
|
Yup. Since we have |
@mikesherov here's a simplified repro case for the Unexpected quasi: const React = require('react/addons');
const MyComponent = React.createClass({
render: function() {
return (
<div>
<div myProp={`${this.props.something}`}/>
<div differentProp={`${this.props.anotherThing}`}/>
</div>
);
}
});
module.exports = MyComponent; |
jquery/esprima#1145 has landed with some additional perf improvements. |
Working on this. |
@mikesherov Yup, these fixes fixed all the issues mentioned in this issue. |
Fix: Template string parsing (fixes #95)
I just ran ecmaFeatures": {
"templateStrings": true,
"jsx": true
} But when linting a 8:34 error Unexpected token ,
✖ 1 problem (1 error, 0 warnings) Am I missing something needed to get your fixes working @nzakas? |
I'm not super sharp, but isn't that invalid code?
I got a similar error when putting this through the babel (jsx-compatible) repl: And from the command-line jsx compiler:
|
Hah, you are correct, that actually was an unexpected token... there shouldn't a Also means this linter is working correctly and I was being obstinate! Thanks, and nice work. |
Is this fixed? I am getting a Parsing Error: unexpected token ILLEGAL on the $
|
The issue is still open, so it's not fixed yet. |
@nzakas This issue is actually closed. It looks like the fix didn't catch all of the cases, or @rastalamm is using an older version without the fix. |
@rastalamm, what version are you using? And what is the complete JS you're trying to parse? |
@ilyavolodin - I thought the issue was closed! I ran npm install -g eslint & npm install -g eslint@latest and using version 2.14.7 |
|
So you guys can actually ignore this!! I am posting on the wrong thread! (Its been a long week) I was having the issue with the npm package eslint and just noticed this is for espree.. Sorry about that! |
You'll wind up back here though. Eslint uses espree |
I'll see if this is a bug in latest Esprima. @nzakas I suggest you check this in acorn if you're switching soon anyway. |
This is a regression from espree 0.12.0.
The same code without
${baz}
is OKThe text was updated successfully, but these errors were encountered: