我尝试在 VSCode 上配置 ESLint,但在使用 async/await 函数时收到此错误:
Async functions are not supported until Node.js 7.6.0. The configured version range is '>=6.0.0'. (node/no-unsupported-features/es-syntax)"
但这是我的 .eslintrc.json:
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:node/recommended"
],
"parserOptions": {
"ecmaVersion": 2018
},
"env": {
"node": true,
"mocha": true
}
}
我错过了什么吗?
最佳答案
添加
"engines": {
"node": ">=7.6.0"
}
到模块的 package.json 文件应该可以解决这些错误。
来自https://github.com/mysticatea/eslint-plugin-node#readme ,
Note: It recommends a use of the "engines" field of package.json. The "engines" field is used by node/no-unsupported-features/* rules.
关于javascript - VSCode ESLint 异步函数不支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52047611/