一、格式化文档时:解决自动添加分号和双引号问题
在项目根目录中创建配置文件 .prettierrc
{
"semi": false,
"singleQuote": true,
"printWidth": 200
}
// "semi": false 格式化后移除分号
// "singleQuote": true 格式化后双引号变单引号
// "printWidth": 200 字符长度改200
二、配置 eslint 不检查函数方法名和括号之间的空格,因为这个空格确实不是个错误,关闭该项检查
在项目根目录下找到 .eslintrc.js
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'@vue/standard'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// 在这里设置为0即可
'space-before-function-paren': 0
},
parserOptions: {
parser: 'babel-eslint'
}
}