[英]VSCode ESLint async functions not supported
我正在尝试在 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)"
但这里是 my.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 ,
注意:它建议使用 package.json 的“engines”字段。 “引擎”字段由 node/no-unsupported-features/* 规则使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.