javascript: 1.0.0 - Unexpected token = with static properties

With 0.1.0 and 0.1.1, this was fine

export default class Root extends React.Component {
  static propTypes = {

After switching to 1.0.0, eslint complains about Parsing error: Unexpected token =, referring to the=afterpropTypes`.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 54
  • Comments: 16

Commits related to this issue

Most upvoted comments

But we are using es7 static properties now, and eslint still complains about it!

Yes, the transform would go in whatever runs babel. You need to add a root "parser": "babel-eslint" as well.

This isn’t the proper venue for this kind of help tho - please feel free to join babel’s slack, or our gitter channel, or freenode on IRC.

That’s because we don’t use es7’s static class methods yet. This is the intended behavior.

I managed to get it working by installing babel-eslint: npm install babel-eslint

Then adding this line to my .eslintrc.js:

module.exports = {
  // the line I added:
  parser: "babel-eslint",
  // the rest of my config here...

@ljharb plz mention that we need to add this into .eslintrc

Assigning them outside the class body, yes.