Comments (25)
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?
from espree.
Oh, yes it is (I mixed up version numbers)
from espree.
Sometimes I also see messages like:
182 -1 error Unexpected quasi
myProp={
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.
from espree.
@nzakas let me know what you find. My guess is missing curlyStack pop push inside JSX expressions.
from espree.
Related: jquery/esprima#1145
from espree.
182 -1 error Unexpected quasi
myProp={
Can you provide an actual code snippet that exhibits this bug?
from espree.
Hey I'm having this problem as well, and it's breaking my CI build :)
This will reproduce the Unexpected quasi
error:
<a>{`${1}`}{``}</a>
1:11 error Unexpected quasi {
from espree.
@nzakas you should be able to take my patch and see if it fixes @kentor 's issue.
from espree.
Yup. Since we have lookahead2()
, I'm anticipating that will do it. Just don't have the time to dig in yet.
from espree.
@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;
from espree.
jquery/esprima#1145 has landed with some additional perf improvements.
from espree.
Working on this.
from espree.
@mikesherov Yup, these fixes fixed all the issues mentioned in this issue.
from espree.
I just ran npm install eslint@latest
and have a .eslintrc that has this in it.
ecmaFeatures": {
"templateStrings": true,
"jsx": true
}
But when linting a .jsx
file that has the follow line in it <form action='/round', method='POST',role='form'>
I get this output...
8:34 error Unexpected token ,
✖ 1 problem (1 error, 0 warnings)
Am I missing something needed to get your fixes working @nzakas?
from espree.
I'm not super sharp, but isn't that invalid code?
<form action='/round', method='POST',role='form'>
I got a similar error when putting this through the babel (jsx-compatible) repl:
https://babeljs.io/repl/#?experimental=true&evaluate=true&loose=false&spec=false&playground=false&code=%3Cform%20action%3D'%2Fround'%2C%20method%3D'POST'%2Crole%3D'form'%3E
And from the command-line jsx compiler:
~/dev/eslint (empty-strings) $ jsx test.jsx
Error while reading module test.jsx:
Error: Parse Error: Line 1: Unexpected token ,
at throwError (/usr/local/lib/node_modules/react-tools/node_modules/jstransform/node_modules/esprima-fb/esprima.js:2644:21)
at throwUnexpected (/usr/local/lib/node_modules/react-tools/node_modules/jstransform/node_modules/esprima-fb/esprima.js:2706:9)
at parseXJSIdentifier (/usr/local/lib/node_modules/react-tools/node_modules/jstransform/node_modules/esprima-fb/esprima.js:6807:13)
at parseXJSAttributeName (/usr/local/lib/node_modules/react-tools/node_modules/jstransform/node_modules/esprima-fb/esprima.js:6852:16)
at parseXJSAttribute (/usr/local/lib/node_modules/react-tools/node_modules/jstransform/node_modules/esprima-fb/esprima.js:6939:16)
at parseXJSOpeningElement (/usr/local/lib/node_modules/react-tools/node_modules/jstransform/node_modules/esprima-fb/esprima.js:6996:29)
at parseXJSElement (/usr/local/lib/node_modules/react-tools/node_modules/jstransform/node_modules/esprima-fb/esprima.js:7021:26)
at parsePrimaryExpression (/usr/local/lib/node_modules/react-tools/node_modules/jstransform/node_modules/esprima-fb/esprima.js:3352:20)
at parseLeftHandSideExpressionAllowCall (/usr/local/lib/node_modules/react-tools/node_modules/jstransform/node_modules/esprima-fb/esprima.js:3436:61)
at parsePostfixExpression (/usr/local/lib/node_modules/react-tools/node_modules/jstransform/node_modules/esprima-fb/esprima.js:3476:20)
from espree.
Hah, you are correct, that actually was an unexpected token... there shouldn't a ,
there. Silly mistake on my part.
Also means this linter is working correctly and I was being obstinate! Thanks, and nice work.
from espree.
Is this fixed?
I am getting a Parsing Error: unexpected token ILLEGAL on the $
`${apiHost}/users/${user.id}/cart`
from espree.
The issue is still open, so it's not fixed yet.
from espree.
@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.
from espree.
@rastalamm, what version are you using? And what is the complete JS you're trying to parse?
from espree.
@ilyavolodin - I thought the issue was closed!
I ran npm install -g eslint & npm install -g eslint@latest and using version 2.14.7
from espree.
function getUserCart(req, ignore, next) {
var user = req.user;
request.get(`${apiHost}/carts?user_id=${user.id}`, {json: true}, function (err, httpResponse, cart) {
if (httpResponse.statusCode === 200) {
req.cart = cart.CartItems;
}
next();
});
}
from espree.
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!
from espree.
You'll wind up back here though. Eslint uses espree
from 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.
from espree.
Related Issues (20)
- incorrect escape in string? HOT 7
- Please export `TokenTranslator` for reusing outside for ESLint plugins HOT 4
- Error parsing file starting with '#!/usr/bin/env node' HOT 2
- support import assertions HOT 1
- as token type: Identifier -> Punctuator HOT 3
- How to use from a script tag? HOT 1
- Not able to access parent node from current node. HOT 2
- Set up release-please HOT 1
- Set up scripts/lint-staged to match those in eslint repo HOT 3
- remove sourcemap url HOT 7
- typing for parse() HOT 1
- Support for `using` keyword HOT 1
- # ⚠️ npm 6.x no extra double-dash: npm init @eslint/config --config semistandard HOT 2
- add npm install step to release-please workflow (#573) (d8900c1) run tests on Node.js v20 (#571) (adf478e) set up release-please (#569) (abda10f) upgrade [email protected] (#574) (8e73f11) HOT 1
- Invalid regular expression flag HOT 2
- 9 Failing tests on project install HOT 1
- espree improvements as an acorn plugin extension [RFC] HOT 1
- Is it possible to configure tokenize method to return hyphenated word as one token? HOT 1
- Not ES2020 HOT 1
- Convert into monorepo HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from espree.