Eslint: ES7 Decorators make parsing error

Created on 9 Oct 2015  路  3Comments  路  Source: eslint/eslint

How can i fix it?

7:2 error Parsing error: Unexpected token ILLEGAL

Error target:

@SubscribedTo('account')
export default class CabinetPage extends Component {

My version is newer: v1.6.0

"eslintConfig": {
    "env": {
      "browser": true,
      "node": true,
      "es6": true
    },
    "modules": true,
    "ecmaFeatures": {
      "modules": true,
      "jsx": true,
      "forOf": true,
      "blockBindings": true,
      "arrowFunctions": true,
      "classes": true,
      "defaultParams": true,
      "destructuring": true,
      "generators": true,
      "restParams": true,
      "spread": true,
      "superInFunctions": true,
      "templateStrings": true,
      "experimentalObjectRestSpread": true
    },
    "globals": {
      "describe": true,
      "it": true,
      "sinon": true
    },
    "plugins": [
      "react",
      "babel",
      "no-console-log"
    ],
    "rules": {
      "indent": [
        2,
        2
      ],
      "quotes": [
        2,
        "single"
      ],
      "jsx-quotes": 1,
      "react/display-name": 0,
      "react/jsx-no-undef": 1,
      "react/jsx-sort-props": 0,
      "react/jsx-uses-react": 1,
      "react/jsx-uses-vars": 1,
      "react/no-did-mount-set-state": 1,
      "react/no-did-update-set-state": 1,
      "react/no-multi-comp": 1,
      "react/no-unknown-property": 1,
      "react/prop-types": 1,
      "react/react-in-jsx-scope": 1,
      "react/self-closing-comp": 1,
      "react/wrap-multilines": 1,
      "babel/new-cap": 1,
      "babel/generator-star-spacing": 1,
      "babel/object-curly-spacing": 1,
      "babel/object-shorthand": 1,
      "babel/arrow-parens": 0,
      "no-console-log/no-console-log": 1
    }
  }
archived due to age question

Most helpful comment

yep ^ add "parser": "babel-eslint" to your config and npm i babel-eslint --save-dev (https://github.com/babel/babel-eslint)

All 3 comments

Thanks for the issue! If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

ESLint doesn't natively support experimental ECMAScript language features.

https://github.com/eslint/eslint#what-about-ecmascript-72016-and-experimental-features

yep ^ add "parser": "babel-eslint" to your config and npm i babel-eslint --save-dev (https://github.com/babel/babel-eslint)

Was this page helpful?
0 / 5 - 0 ratings