Which configuration to use with ESLint to have it accept both code like:
return new Promise(..)
and
async function() {...}
This is used in Node.js
Whatever configuration of ES6 2017.... I keep on having errors like :
'Promise' is not defined no-undef
or
Parsing error: Unexpected token function
Thanks !
FWIW, eslint needs ES6 specified in the parser AND the environment sections, e.g.
{
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"modules": true
}
},
"env": {
"browser": true,
"es6": true
},
"extends": "eslint:recommended",
...
See https://github.com/eslint/eslint/issues/9812 for a discussion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With