vue升级vue/cli5遇到的一些 "问题"


1. module.exports 下面红线提示`parsing error: No Babel config file detected for xxx`

解决办法:

// 在eslintrc.js 或者 package.json 中 找到  parserOptions 项, 在里面加上
// 这句话  requireConfigFile: false

2. template 标签报红, 项目正常, eslint 提示 `vue/multi-word-component-names` (说要你的组件名称是 驼峰大小写, 例如 index => IndexView),    解决方式 2 和 3的问题 在一起

3. 函数前面 eslint 提示 `space-before-function-paren` (函数前面必须要有空格)

// 解决办法  在 .eslintrc.js 配置文件的 rule 中加上这两句

'vue/multi-word-component-names': 0
'space-before-function-paren': 0

4. 格式化vue文件后, 单引号变成双引号, 函数结尾 加了逗号

// 解决办法, 在项目 创建配置文件 .prettierrc.js 和 配置文件平级
// 内容如下
{
  "semi": false,
  "singleQuote": true,
  "trailingComma": "none"
}

5. 重启项目...