错误图片:
分析错误:意外的令牌addExpertAttach
解决方法:
下载
npm install @babel/eslint-parser --save-dev
–save-dev 简写: -D 适用于各类loder , plugin, babel, webpack等
-save 简写 :-S 适用于 UI框架,vue等
.eslintrc.js
module.exports = {
"parser": "babel-eslint"
}
成功解决问题:
错误报错信息2:
Parsing error:The keyword ‘import’ is reserved eslint
解决方法:
parserOptions: {
sourceType:"module",
ecmaVersion:2015,
type:"module"
},
成功解决问题:
总结:记录一下,少走弯路。
npm官网:@babel/eslint-parser
地址:https://www.npmjs.com/package/@babel/eslint-parser
Eslint:https://eslint.bootcss.com/docs/user-guide/configuring