Giter Site home page Giter Site logo

Comments (25)

nzakas avatar nzakas commented on June 23, 2024

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.

BenoitZugmeyer avatar BenoitZugmeyer commented on June 23, 2024

Oh, yes it is (I mixed up version numbers)

from espree.

lencioni avatar lencioni commented on June 23, 2024

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.

mikesherov avatar mikesherov commented on June 23, 2024

@nzakas let me know what you find. My guess is missing curlyStack pop push inside JSX expressions.

from espree.

nzakas avatar nzakas commented on June 23, 2024

Related: jquery/esprima#1145

from espree.

mikesherov avatar mikesherov commented on June 23, 2024

@lencioni

182  -1  error  Unexpected quasi
     myProp={

Can you provide an actual code snippet that exhibits this bug?

from espree.

kentor avatar kentor commented on June 23, 2024

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.

mikesherov avatar mikesherov commented on June 23, 2024

@nzakas you should be able to take my patch and see if it fixes @kentor 's issue.

from espree.

nzakas avatar nzakas commented on June 23, 2024

Yup. Since we have lookahead2(), I'm anticipating that will do it. Just don't have the time to dig in yet.

from espree.

lencioni avatar lencioni commented on June 23, 2024

@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.

mikesherov avatar mikesherov commented on June 23, 2024

jquery/esprima#1145 has landed with some additional perf improvements.

from espree.

nzakas avatar nzakas commented on June 23, 2024

Working on this.

from espree.

nzakas avatar nzakas commented on June 23, 2024

@mikesherov Yup, these fixes fixed all the issues mentioned in this issue.

from espree.

eprouty avatar eprouty commented on June 23, 2024

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.

xjamundx avatar xjamundx commented on June 23, 2024

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.

eprouty avatar eprouty commented on June 23, 2024

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.

rastalamm avatar rastalamm commented on June 23, 2024

Is this fixed?

I am getting a Parsing Error: unexpected token ILLEGAL on the $

`${apiHost}/users/${user.id}/cart`

from espree.

nzakas avatar nzakas commented on June 23, 2024

The issue is still open, so it's not fixed yet.

from espree.

ilyavolodin avatar ilyavolodin commented on June 23, 2024

@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.

mikesherov avatar mikesherov commented on June 23, 2024

@rastalamm, what version are you using? And what is the complete JS you're trying to parse?

from espree.

rastalamm avatar rastalamm commented on June 23, 2024

@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.

rastalamm avatar rastalamm commented on June 23, 2024

@mikesherov

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.

rastalamm avatar rastalamm commented on June 23, 2024

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.

mikesherov avatar mikesherov commented on June 23, 2024

You'll wind up back here though. Eslint uses espree

from espree.

mikesherov avatar mikesherov commented on June 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.