Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

ESLint: 2.10.0 - Parsing error: Unexpected token = #312

Closed
moroshko opened this issue May 14, 2016 · 13 comments
Closed

ESLint: 2.10.0 - Parsing error: Unexpected token = #312

moroshko opened this issue May 14, 2016 · 13 comments

Comments

@moroshko
Copy link

I'm using:

eslint: 2.10.0
babel-eslint: 6.0.4

and getting the following error:

Parsing error: Unexpected token =

which points to class properties:

export default class Autowhatever extends Component {
  static propTypes = {    // <--- error points to this line
...

I expected babel-eslint to support class properties out of the box.

What am I missing?

Here is my eslint config:

{
  "env": {
    "es6": true,
    "node": true,
    "browser": true
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "sourceType": "module"
  }
}
@moroshko
Copy link
Author

Probably related: eslint/eslint#6158

@stoikerty
Copy link

stoikerty commented May 14, 2016

I get the same error. It throws the error on windows but not osx.
It looks to be a windows issue, sadly.

@broberson
Copy link

I get this error on osx. I don't see how this is related to eslint/eslint#6158 at all.

@hzoo
Copy link
Member

hzoo commented May 14, 2016

It could be the same error as eslint/eslint#6158 in that 2.10 currently makes it so ESLint always uses the default parser and not babel-eslint. Try 2.9 and if it works then you should pin to 2.9 until a patch is released. Pretty sure that is the case.

@hzoo hzoo changed the title Parsing error: Unexpected token = ESLint: 2.10.0 - Parsing error: Unexpected token = May 14, 2016
@stoikerty
Copy link

I get this error on eslint 2.7, 2.9 and 2.10 on windows, using either babel-eslint 5.0.4 or 6.0.4.
On OSX it seems to work for 2.7 with babel-eslint 5.0.4 for me.

@hzoo
Copy link
Member

hzoo commented May 14, 2016

Can someone check ESLint 2.10.1 which fixes the parser issue?

@kevhuang
Copy link

I updated ESLint to 2.10.1 and this issue went away for me.

@oliviertassinari
Copy link

oliviertassinari commented May 14, 2016

Same here, it's fixed 👍 .

@hzoo
Copy link
Member

hzoo commented May 14, 2016

Cool. Yep, it basically turned off babel-eslint for everyone. If you don't don't get unexpected token there would of been an issue (or you don't need babel-eslint haha)

@hzoo hzoo closed this as completed May 14, 2016
@perrin4869
Copy link

perrin4869 commented May 15, 2016

For some reason the error hasn't gone away for me yet: https://travis-ci.org/perrin4869/react-onenterkeydown/jobs/130315342

Anyone got a clue why? https://github.com/perrin4869/react-onenterkeydown/

Edit: ok, this seems to be a gulp-eslint issue

@stoikerty
Copy link

I'm still seeing the error. I'm using eslint-loader which could have to do with it, it looks like more people are seeing the issue as well.

@stoikerty
Copy link

stoikerty commented May 15, 2016

I've gone back and forth, uninstalled everything concerning eslint locally and globally, then went back and tried installing 2.9.0 locally which @hzoo reported should work. I'm glad that version 2.9.0 works for me on windows after all. I must've tried too many things at once when I was testing different versions.
I'll just use 2.9.0 until a better patch is released. Thanks @hzoo

@xyzdata
Copy link

xyzdata commented Jul 25, 2017

"parser": "babel-eslint" is OK!

{
    "parser": "babel-eslint",
    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "module",
        "ecmaFeatures": {
            "jsx": true,
            "modules": true,
            "experimentalObjectRestSpread": true
        }
    },
    "plugins": [
        "react"
    ],
    "extends": ["eslint:recommended", "plugin:react/recommended"],
    "rules": {
        "comma-dangle": 0,
        "react/jsx-uses-vars": 1,
        "react/display-name": 1,
        "no-unused-vars": "warn",
        "no-console": 1,
        "no-unexpected-multiline": "warn"
    },
    "settings": {
        "react": {
            "pragma": "React",
            "version": "15.6.1"
        }
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants