.prettierrc.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # 一行最多 120 字符
  2. printWidth: 120
  3. # 使用 2 个空格缩进
  4. tabWidth: 2
  5. # 不使用缩进符,而使用空格
  6. useTabs: false
  7. # 行尾不需要分号
  8. semi: true
  9. # 使用单引号
  10. singleQuote: true
  11. # 对象的 key 仅在必要时用引号
  12. quoteProps: as-needed
  13. # jsx 不使用单引号,而使用双引号
  14. jsxSingleQuote: false
  15. # 末尾不需要逗号
  16. trailingComma: none
  17. # 大括号内的首尾需要空格
  18. bracketSpacing: true
  19. # jsx 标签的反尖括号需要换行
  20. jsxBracketSameLine: false
  21. # 箭头函数,只有一个参数的时候,不需要括号
  22. arrowParens: avoid
  23. # 每个文件格式化的范围是文件的全部内容
  24. rangeStart: 0
  25. # 不需要写文件开头的 @prettier
  26. requirePragma: false
  27. # 不需要自动在文件开头插入 @prettier
  28. insertPragma: false
  29. # 使用默认的折行标准
  30. proseWrap: preserve
  31. # 根据显示样式决定 html 要不要折行
  32. htmlWhitespaceSensitivity: css
  33. # 换行符使用 lf
  34. endOfLine: lf
  35. # 后缀文件名特有规则
  36. overrides:
  37. - files: '*.{wxss,less}'
  38. options:
  39. parser: less
  40. - files: '*.json,.*rc'
  41. options:
  42. parser: json
  43. - files: '*.{wxml,html}'
  44. options:
  45. parser: html
  46. htmlWhitespaceSensitivity: strict
  47. # 避免text标签换行
  48. printWidth: 999
  49. - files: '*.wxs'
  50. options:
  51. parser: babel