配置vscode 自动保存并格式化之后,会存在和 eslint 规则不符合的报错,因此我们要进行如下配置
    1、在项目根目录创建文件 .prettierrc

    1. {
    2. "printWidth": 800,
    3. "singleQuote": true, // 使用单引号
    4. "semi": false, // 不使用分号
    5. "trailingComma": "none" // 对象最后一项默认格式化会加逗号, 这里取消
    6. }

    2、eslinttrc.js

    1. rules: {
    2. 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    3. 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    4. 'space-before-function-paren':0
    5. }

    之后,保存并重新启动项目