Error with async: "Parsing error: Unexpected token =>"
See original GitHub issue-
ESLint Version: 3.16.0
-
Node Version: 6.9.1
-
npm Version: 3.10.8
-
parser: default
-
configuration
...
"extends": ["eslint:recommended"],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 7,
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
}
},
...
source code
!(async () => {
try {
const result = await Promise.resolve('Hello');
console.log('>>>>>', result);
} catch (error) {
console.error('Error in demo', error);
}
})();
eslint check result
error Parsing error: Unexpected token =>
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
eslint Parsing error: Unexpected token function with async
Just in case this is happening to people using async/await for the first time. This error also appears if you use await inside...
Read more >error with await "Parsing error: Unexpected token" #319 - GitHub
I am using a async/await library (https://github.com/yortus/asyncawait) to call Promises as if they are running synchronously. here is ...
Read more >Unexpected token error after adding await keyword to Node.js ...
Neil Lovelace : I placed the await in front of checkToken but thats what is giving me the 401 error. Once I remove...
Read more >SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >Parsing Error: Unexpected Token ; - ServiceNow Community
I am trying to create a business rule that requires a field in a child table/record to be mandatory when certain fields in...
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
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
Thanks for the report. Async functions are an ES2017 (or “ES8”) feature, but you have
ecmaVersion: 7
in your config. To fix this, you should useecmaVersion: 8
orecmaVersion: 2017
in your config.ecmaVersion
should not be inecmaFeatures
.