module.exports = { root: true, env: { node: true }, extends: ['plugin:vue/essential', 'eslint:recommended', '@vue/prettier'], parserOptions: { parser: 'babel-eslint' }, rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-unused-vars': 'off', //意思就是不让eslint校验我定义有没有用了。 "prettier/prettier": [ "error", // 如果插件配置中修改了相关选项, // 则必须在此添加相对应的自定义规则否则就会出现编辑器格式化后ESlint检查无法通过的情况。 { "semi": false, "singleQuote": true, "printWidth": 200, "trailingComma": "none", "arrowParens": "avoid", "htmlWhitespaceSensitivity": "ignore", "endOfLine": "auto" } ] } }
.prettierrc文件配置如下
{ "semi": false, "singleQuote": true, "printWidth": 200, "trailingComma": "none", "arrowParens": "avoid", "htmlWhitespaceSensitivity": "ignore", "endOfLine": "auto" }