去掉Vue项目中eslint检查控制台的警告信息
在Vue脚手架2创建的项目中, 有时候安装的 eslint会经常莫名其妙报一些警告, 控制台有时候也会出现一些多余的警告信息影响我们观察控制台信息, 我们可以通过在 项目的
.eslintrc.js文件中配置如下 rules的配置来去掉控制台及项目中的一些警告信息
// https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
],
// required to lint *.vue files
plugins: [
'vue'
],
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-trailing-spaces':'off',
'indent':'off',
'spaced-comment':'off',
'no-trailing-spaces':'off',
'no-new':'off',
'key-spacing':'off',
'comma-dangle':'off',
'eol-last':'off',
'quotes':'off',
'semi':'off',
'keyword-spacing':'off',
'space-before-blocks':'off',
'comma-spacing':'off',
'space-before-function-paren':'off',
'space-infix-ops':'off',
'no-multiple-empty-lines':'off',
'block-spacing':'off',
'padded-blocks':'off',
'arrow-spacing':'off',
'no-sequences':'off',
'no-unused-expressions':'off',
'no-multi-spaces':'off',
'no-unused-vars':'off',
'camelcase ':'off'
}
}
本文介绍如何在Vue2项目中配置eslint,以消除控制台中的警告信息,确保控制台显示清晰。
904

被折叠的 条评论
为什么被折叠?



