我从ESLint得到这个错误:
error Parsing error: The keyword 'const' is reserved
根据该代码:
const express = require('express');
const app = express();
const _ = require('underscore');
我try 过删除node_modules
并重新安装所有npm软件包(如建议的here),但没有效果.
我从ESLint得到这个错误:
error Parsing error: The keyword 'const' is reserved
根据该代码:
const express = require('express');
const app = express();
const _ = require('underscore');
我try 过删除node_modules
并重新安装所有npm软件包(如建议的here),但没有效果.
ESLint默认为ES5语法判断.您需要覆盖到最新的、支持良好的JavaScript版本.
try 将.eslintrc
文件添加到项目中.在它里面:
{
"parserOptions": {
"ecmaVersion": 2017
},
"env": {
"es6": true
}
}
希望这能有所帮助.
编辑:我还找到了this example .eslintrc
个,这可能会有所帮助.