配置vscode 自动保存并格式化之后,会存在和 eslint 规则不符合的报错,因此我们要进行如下配置
1、在项目根目录创建文件 .prettierrc
{"printWidth": 800,"singleQuote": true, // 使用单引号"semi": false, // 不使用分号"trailingComma": "none" // 对象最后一项默认格式化会加逗号, 这里取消}
2、eslinttrc.js
rules: {'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off','no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off','space-before-function-paren':0}
之后,保存并重新启动项目
