.prettierrc.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * @Description: prettierrc配置文件
  3. * @Date: 2022-04-06 16:19:54
  4. * @Author: chenjiaming
  5. * @LastEditors: chenjiaming
  6. * @LastEditTime: 2022-04-06 18:37:31
  7. */
  8. module.exports = {
  9. // (x)=>{},单个参数箭头函数是否显示小括号。(always:始终显示;avoid:省略括号。默认:always)
  10. arrowParens: 'always',
  11. // 开始标签的右尖括号是否跟随在最后一行属性末尾,默认false
  12. bracketSameLine: false,
  13. // 对象字面量的括号之间打印空格 (true - Example: { foo: bar } ; false - Example: {foo:bar})
  14. bracketSpacing: true,
  15. // 是否格式化一些文件中被嵌入的代码片段的风格(auto|off;默认auto)
  16. embeddedLanguageFormatting: 'auto',
  17. // 指定 HTML 文件的空格敏感度 (css|strict|ignore;默认css)
  18. htmlWhitespaceSensitivity: 'css',
  19. // 当文件已经被 Prettier 格式化之后,是否会在文件顶部插入一个特殊的 @format 标记,默认false
  20. insertPragma: false,
  21. // 在 JSX 中使用单引号替代双引号,默认false
  22. jsxSingleQuote: true,
  23. // 每行最多字符数量,超出换行(默认80)
  24. printWidth: 120,
  25. // 超出打印宽度 (always | never | preserve )
  26. proseWrap: 'preserve',
  27. // 对象属性是否使用引号(as-needed | consistent | preserve;默认as-needed:对象的属性需要加引号才添加;)
  28. quoteProps: 'as-needed',
  29. // 是否只格式化在文件顶部包含特定注释(@prettier| @format)的文件,默认false
  30. requirePragma: false,
  31. // 结尾添加分号
  32. semi: false,
  33. // 使用单引号 (true:单引号;false:双引号)
  34. singleQuote: true,
  35. // 缩进空格数,默认2个空格
  36. tabWidth: 2,
  37. // 元素末尾是否加逗号,默认es5: ES5中的 objects, arrays 等会添加逗号,TypeScript 中的 type 后不加逗号
  38. trailingComma: 'none',
  39. // 指定缩进方式,空格或tab,默认false,即使用空格
  40. useTabs: false,
  41. // vue 文件中是否缩进 <style> 和 <script> 标签,默认 false
  42. vueIndentScriptAndStyle: false,
  43. endOfLine: 'auto',
  44. overrides: [
  45. {
  46. files: '*.html',
  47. options: {
  48. parser: 'html'
  49. }
  50. }
  51. ]
  52. }