问题描述
在尝试使用eslint时候,js文件能够检测, .vue文件出现这个问题
3:26 error Parsing error: Unexpected token
1 | <template>
2 | <div>
> 3 | <el-dialog :title="editFormData.title" :visible.sync="editFormData.isShow" width="550px">
是什么配置的问题吗?
有看到说使用parser: "babel-eslint",但是尝试后好像并没有效果。
问题出现的平台版本及自己尝试过哪些方法
安装的eslint版本:
"babel-eslint": "^10.0.1",
"eslint": "^5.12.1",
"eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^2.1.1",
"eslint-plugin-html": "^5.0.0",
"eslint-plugin-import": "^2.15.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
.eslintrc.js配置:
// http://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parser: "babel-eslint",
parserOptions: {
sourceType: "module"
},
env: {
browser: true,
node: true,
es6: true,
commonjs: true,
},
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
extends: "standard",
// required to lint *.vue files
plugins: [
"html"
],
// add your custom rules here
"rules": {
"indent": [2, 4],
// allow paren-less arrow functions
"arrow-parens": 0,
// allow async-await
"generator-star-spacing": 0,
// allow space-before-function-paren
"space-before-function-paren": 0,
// allow debugger during development
"no-debugger": process.env.NODE_ENV === "production" ? 2 : 0
},
};
你期待的结果是什么?实际看到的错误信息又是什么?
第一次尝试使用eslint,希望有大神指点下,谢谢!
试试
https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser