项目环境:Vue2
vue.config.js文件中设置如下:
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
lintOnSave:false,
devServer: {
client: {
overlay: {
warnings: false, //不显示警告
errors: false //不显示错误
}
}
}
})
在eslintrc.js文件中的rules加入最后两项
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
//在rules中添加自定义规则
//关闭组件命名规则
'vue/multi-word-component-names':'off',
'vue/comment-directive':'off'
}