vue.js

关注公众号 jb51net

关闭
首页 > 网络编程 > JavaScript > javascript类库 > vue.js > Vue项目关闭语法检查

Vue项目如何关闭语法检查

作者:Ylovd_

这篇文章主要介绍了Vue项目如何关闭语法检查问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教

Vue项目关闭语法检查

报错

ERROR

C:\Users\HP\hyyvue\src\components\Counter\Counter.vue
  1:1  error  Component name "Counter" should always be multi-word  vue/multi-word-component-names

C:\Users\HP\hyyvue\src\components\Footer\Footer.vue
  1:1  error  Component name "Footer" should always be multi-word  vue/multi-word-component-names

C:\Users\HP\hyyvue\src\components\Goods\Goods.vue
  1:1  error  Component name "Goods" should always be multi-word  vue/multi-word-component-names

C:\Users\HP\hyyvue\src\components\Header\Header.vue
  1:1  error  Component name "Header" should always be multi-word  vue/multi-word-component-names

✖ 4 problems (4 errors, 0 warnings)

意思是组件的命名不规范

vue/multi-word-component-names是用于检测当前的组件名称是否使用驼峰或多单词命名,eslint默认是要求检测,可以手动关闭检测

在vue.config.js文件中加入

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false//关闭语法检查
})

Vue配置语法检查及关闭语法检查的说明

1. 第一种方式:`//eslint-disable-next-line`

2. 第二种方式:`/*eslint-disable*/`

3. 第三种方式:`vue.config.js`中配置 

具体配置如下:

  const { defineConfig } = require('@vue/cli-service')
   module.exports = defineConfig({
       transpileDependencies: true,
       lintOnSave:false //追加这句话,用于关闭语法检查。
   })

备注:```vue.config.js```可以对脚手架进行个性化定制,详情见:Vue CLI

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文