question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parsing error: Unexpected token => when using eslint --init on post-ES2015 files

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.12.1
  • Node Version: 9.5.0
  • npm Version: 5.6.0

What parser (default, Babel-ESLint, etc.) are you using? Default

Please show your full configuration: N/A

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

(async () => {
});
eslint --init

Followed by answering prompts as follows:

  • File? fileName.js
  • Format? YAML
  • ES6 features? Yes
  • ES6 modules? Yes
  • Environment? Node
  • JSX? No

What did you expect to happen?

.eslint.yaml generated

What actually happened? Please include the actual, raw output from ESLint.

(~/tmp/example.js:1:11) Parsing error: Unexpected token =>
Error: (~tmp/example.js:1:11) Parsing error: Unexpected token =>
    at getSourceCodeOfFile (/usr/local/lib/node_modules/eslint/lib/util/source-code-util.js:38:15)
    at filenames.forEach.filename (/usr/local/lib/node_modules/eslint/lib/util/source-code-util.js:94:28)
    at Array.forEach (<anonymous>)
    at getSourceCodeOfFiles (/usr/local/lib/node_modules/eslint/lib/util/source-code-util.js:93:15)
    at configureRules (/usr/local/lib/node_modules/eslint/lib/config/config-initializer.js:165:23)
    at processAnswers (/usr/local/lib/node_modules/eslint/lib/config/config-initializer.js:288:18)
    at inquirer.prompt.then.secondAnswers (/usr/local/lib/node_modules/eslint/lib/config/config-initializer.js:536:32)
    at <anonymous>
Determining Config: 0% [------------------------------] 0.0s elapsed, eta 0.0s

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
not-an-aardvarkcommented, Feb 23, 2018

This is happening because we only ask whether the user is using ES6, and we don’t supply an option for later ES versions. When the question was added, ES2015 was the latest version.

Maybe we should add a list of ES versions to choose from, rather than just asking about ES6.

0reactions
not-an-aardvarkcommented, Apr 12, 2018

In today’s TSC meeting, the TSC accepted this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint Parsing error: Unexpected token - Stack Overflow
Unexpected token errors in ESLint parsing occur due to incompatibility between your development environment and ESLint's current parsing ...
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 >
[ESLint] Parsing error: unexpected token - DEV Community ‍ ‍
A very simple project with JS(EcmaScript2016) with webpack, babel, jest and ESLint. When did this error appear? While I was running ESLint on...
Read more >
Parsing error: Unexpected token for Eslint --init - Google Groups
Hi Marina, It looks like it's failing to install eslint-plugin-react. Can you try answering “no” for that question and see if you can...
Read more >
ESLINT_ERROR || Parsing error: Unexpected token ...
ESLINT_ERROR || Parsing error: Unexpected token createCarRecord : ... Unable to save the controller file in Lightning when i try to add ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found