close

[Fixed] ESLint Parsing error: Unexpected token

Today We are Going To Solve ESLint Parsing error: Unexpected token in javascript. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

How to Fix ESLint Parsing error: Unexpected token Error?

  1. How to Fix ESLint Parsing error: Unexpected token Error?

    To Fix ESLint Parsing error: Unexpected token Error just Install babel-eslint. You can solve this error by following these two steps. So first of all just install babel-eslint by using this command : npm install babel-eslint --save-dev And after installing it just add this configuration in .eslintrc file { "parser":"babel-eslint" }

  2. ESLint Parsing error: Unexpected token

    To Fix ESLint Parsing error: Unexpected token Error just Add 'parser': 'babel-eslint'. This method is only for those users who are using using eslint-plugin-vue. If you are using eslint-plugin-vue than just add 'parser': 'babel-eslint' is inside parserOptions param just like the below example. This will completely solve your error. 'parserOptions': { 'parser': 'babel-eslint', 'ecmaVersion': 2018, 'sourceType': 'module' }

Solution 1 : Install babel-eslint

You can solve this error by following these two steps. So first of all just install babel-eslint by using this command :

npm install babel-eslint --save-dev

And after installing it just add this configuration in .eslintrc file

{
   "parser":"babel-eslint"
}

Solution 2 : Add 'parser': 'babel-eslint'

This method is only for those users who are using using eslint-plugin-vue. If you are using eslint-plugin-vue than just add 'parser': 'babel-eslint' is inside parserOptions param just like the below example. This will completely solve your error.

  'parserOptions': {
    'parser': 'babel-eslint',
    'ecmaVersion': 2018,
    'sourceType': 'module'
  }

Solution 3 : Downgraded the eslint

Just downgraded the eslint version and by doing this you will solve your error.

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read This Solutions

Leave a Comment