与 ESLint 一起使用的配置让它接受两个代码,如:
return new Promise(..)
Run Code Online (Sandbox Code Playgroud)
和
async function() {...}
Run Code Online (Sandbox Code Playgroud)
这在 Node.js 中使用
无论 ES6 2017 的配置如何.... 我一直有类似的错误:
'Promise' 未定义 no-undef
或者
解析错误:意外的令牌函数
谢谢 !
Bri*_*rns 10
FWIW,eslint 需要在解析器和环境部分中指定 ES6,例如
{
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"modules": true
}
},
"env": {
"browser": true,
"es6": true
},
"extends": "eslint:recommended",
...
Run Code Online (Sandbox Code Playgroud)
有关讨论,请参阅https://github.com/eslint/eslint/issues/9812。
| 归档时间: |
|
| 查看次数: |
4040 次 |
| 最近记录: |