Vue项目之使用Eslint和Prettier

97 阅读1分钟

参考 Vue项目之使用Eslint和Prettier

vscode snippets 常用代码块

vscode 1.69.2 setting.json

{
    "eslint.run": "onSave",
    "editor.codeActionsOnSave": {
        "source.fixAll": true
    }
}

.prettierrc

module.exports = {
  useTabs: false, // 关闭tab缩进,使用Space缩进
  tabWidth: 2, // 每次缩进2个字符
  semi: true, // 结尾加分号
  singleQuote: true, // 使用单引号
  jsxSingleQuote: true, // jsx中使用单引号
  trailingComma: 'es5', // 结尾逗号使用es5规则
  bracketSpacing: true, // 括号和参数之间有空格
  jsxBracketSameLine: false, // 标签属性较多时,标签箭头>另起一行
  arrowParens: 'always', // 箭头函数参数永远加括号
  quoteProps: 'as-needed', // 属性加引号需要加时再加
  printWidth: 80, // 每行字符个数
};