我想在代码中添加分隔符,当我像app.use(session({...config.session}));
这样使用它时,ESLINT出现错误,实际上我的代码运行时没有任何错误或系统错误...
这是我的eslintrc.js:
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"forOf": true,
},
"rules": {
'no-console': 'off',
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": ["error", "single", {
avoidEscape: true,
allowTemplateLiterals: true
}],
"semi": [
"error",
"always"
]
}
};
然后我添加此选项,如您所见:
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"forOf": true,
},
但仍然存在错误问题:[eslint] Parsing error: Unexpected token ...
我该如何解决这个问题?其他陪同通知确实有效...谢谢!
答案 0 :(得分:0)
将解析器/ ecmaVersion设置为2018
。对象传播是ECMAScript 2018中的新增功能。