Parsing error: Unexpected token => when using eslint --init on post-ES2015 files
See original GitHub issueTell 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:
- Created 6 years ago
- Reactions:3
- Comments:12 (10 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
In today’s TSC meeting, the TSC accepted this issue.