question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parsing error: Unexpected token = with class properties

See original GitHub issue

mac os

  • ESLint Version: 3.18.0
  • Node Version: 6.9.4
  • npm Version: 3.10.10

What parser (default, Babel-ESLint, etc.) are you using? default

{
  "extends": "airbnb",
  "env": {
    "browser": true
  }
}

What did you do? Please include the actual source code causing the issue.

static propTypes = { <-- error here

What did you expect to happen? I’ve see a lot of related issues, but they was fixed, and I don’t understand how to fix it

What actually happened? Please include the actual, raw output from ESLint. error Parsing error: Unexpected token =

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
platinumazurecommented, Mar 28, 2017

Hi @Drapegnik, thanks for the issue. Class properties are experimental syntax and are not supported by espree at this time. Please use the babel-eslint parser.

1reaction
OKNoahcommented, Apr 25, 2017

This issues began suddenly for me as well,

"settings": {
    "import/parser": "babel-eslint",
    "import/resolve": {
      "moduleDirectory": ["node_modules", "src"]
    }
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Eslint - `Parsing error: unexpected token =` error for assigned ...
You're using class field (a.k.a. property initializer) syntax, which is not part of ECMAScript 2015 (ES6), nor ES2016 or 2017, ...
Read more >
ESLint: "Parsing error: Unexpected token" in Visual Studio Code
Unexpected token errors are caused by incompatibilities in your parser options and the code you're writing. In this case, I'm using a number...
Read more >
SyntaxError: Unexpected '#' used outside of class body
The JavaScript exception "Unexpected '#' used outside of class body" occurs when a hash ("#") is encountered in an unexpected context, most notably...
Read more >
How To Fix - "Parsing error: Unexpected Token" in React.js or ...
Such “Unexpected token” signify a common behavioural problem – somewhere in your code a specific construct was supplied, but the system expected something ......
Read more >
Unexpected token. A constructor, method Error in TS
The "Unexpected token. A constructor, method, accessor, or property was expected" error occurs when we use the var or let keywords to declare...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found