Skip to content
Advertisement

how to fix unexpected token parsing error?

The arrow works for me all time but i get an error now Parsing error: Unexpected token => I tried checking the syntax and bracket and yeah, I dint miss any brackets.

Code :

JavaScript

Error :

Parsing error: Unexpected token =>

And If try to change it to normal function(){} call, like this

JavaScript

It gives me Parsing error:unexpected token function

Advertisement

Answer

Eslin.json file: { "parser": "babel-eslint", "plugins": [ "babel" ], "extends": [ "plugin:prettier/recommended", "plugin:react/recommended" ], "env": { "browser": true, "es6": true, "jest": true }, "parserOptions": { "ecmaVersion": 2018, "sourceType": "module", "ecmaFeatures": { "jsx": true } }, "rules": { "curly": "error", "eqeqeq": "error", "guard-for-in": "error", "no-extend-native": "error", "complexity": [ "error", 200 ], "max-depth": [ "error", 5 ], "max-params": [ "error", 12 ], "max-statements": [ "error", 200 ], "no-caller": "error", "no-irregular-whitespace": "error", "no-new": "error", "no-undef": "error", "no-unused-vars": "error", "no-global-assign": "error", "react/prop-types": "off", "babel/semi": 1 } }

Advertisement