Arrow functions: "Parsing error: unexpected token ="
See original GitHub issueTell us about your environment
- ESLint Version: 4.19.1
- Node Version: 7.9.0
- npm Version: 5.5.1
What parser (default, Babel-ESLint, etc.) are you using?
"babel-eslint": "^8.2.2",
Please show your full configuration:
Configuration
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jest": "^21.15.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
anyFunc = (e) => {
// does not matter what is inside
}
./node_modules/.bin/eslint myfile.jsx
What did you expect to happen? Errors should be output and shown in VS Code.
What actually happened? Please include the actual, raw output from ESLint.
34:16 error Parsing error: Unexpected token =
✖ 1 problem (1 error, 0 warnings)
VS Code integration breaks: the first = is underlined with this message:[eslint] Parsing error: unexpected token =
. Linting is broken for entire file, no other errors are shown even though they exist, and autofix on save does not work.
Everything works as expected for files without arrow functions both via CL and in VSCode.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:16 (2 by maintainers)
Top Results From Across the Web
Eslint - `Parsing error: unexpected token =` error for assigned ...
I'm using an arrow function and it's ...
Read more >ESLint: "Parsing error: Unexpected token" in Visual Studio Code
Unexpected token errors are caused by incompatibilities in your parser options and the code you're writing. In this case, I'm using a number...
Read more >parsing error: unexpected token javascript
Unexpected token errors in ESLint parsing occur due to incompatibility between your development environment and ESLint's current parsing capabilities with the ...
Read more >Parsing error: unexpected token ':' - The freeCodeCamp Forum
An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the ...
Read more >Arrow function expressions - JavaScript - MDN Web Docs
An arrow function expression is a compact alternative to a ... const func = (a, b, c) => 1; // SyntaxError: Unexpected token...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
You should add
babel-eslint
as parser.babel-eslint
is not needed for this from at least version5.9.0
(probably earlier) I was able to use arrow functions by setting theecmaVersion
to 2018