close

[Solved] ESLint Parsing error: Unexpected token

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error ESLint Parsing error: Unexpected token in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ESLint Parsing error: Unexpected token Error Occurs?

Today I get the following error ESLint Parsing error: Unexpected token in javascript.

How To Solve ESLint Parsing error: Unexpected token Error ?

  1. How To Solve ESLint Parsing error: Unexpected token Error ?

    To Solve ESLint Parsing error: Unexpected token Error
    I solved this issue by First, installing babel-eslint using npm
    npm install babel-eslint --save-dev
    Secondly, add this configuration in .eslintrc file
    { "parser":"babel-eslint" }

  2. ESLint Parsing error: Unexpected token

    To Solve ESLint Parsing error: Unexpected token Error
    I solved this issue by First, installing babel-eslint using npm
    npm install babel-eslint --save-dev
    Secondly, add this configuration in .eslintrc file
    { "parser":"babel-eslint" }

Solution 1


"parser": "babel-eslint"
 helped me to fix the issue

{
    "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"
        }
    }
}

Solution 2


I solved this issue by First, installing babel-eslint using npm

npm install babel-eslint --save-dev

Secondly, add this configuration in .eslintrc file

{
   "parser":"babel-eslint"
}

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment