.stylelintrc.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. module.exports = {
  2. // 继承推荐规范配置
  3. extends: [
  4. "stylelint-config-standard",
  5. "stylelint-config-prettier",
  6. "stylelint-config-recommended-less",
  7. "stylelint-config-standard-vue",
  8. ],
  9. // 添加规则插件
  10. plugins: ["stylelint-order"],
  11. // 不同格式的文件指定自定义语法
  12. overrides: [
  13. {
  14. files: ["**/*.(less|css|vue|html)"],
  15. customSyntax: "postcss-less",
  16. },
  17. {
  18. files: ["**/*.(html|vue)"],
  19. customSyntax: "postcss-html",
  20. },
  21. ],
  22. // 忽略检测文件
  23. ignoreFiles: [
  24. "**/*.js",
  25. "**/*.jsx",
  26. "**/*.tsx",
  27. "**/*.ts",
  28. "**/*.json",
  29. "**/*.md",
  30. "**/*.yaml",
  31. ],
  32. // 自定义配置规则
  33. rules: {
  34. // 便于配置变量 关闭未知属性检测
  35. "property-no-unknown": null,
  36. // 指定类选择器的模式
  37. "selector-class-pattern": null,
  38. // 允许 Vue 的 global
  39. "selector-pseudo-class-no-unknown": [
  40. true,
  41. {
  42. ignorePseudoClasses: ["global"],
  43. },
  44. ],
  45. // 允许 Vue 的 v-deep
  46. "selector-pseudo-element-no-unknown": [
  47. true,
  48. {
  49. ignorePseudoElements: ["v-deep"],
  50. },
  51. ],
  52. // 允许对应内核前缀
  53. "property-no-vendor-prefix": null,
  54. // 指定样式的排序 修复后会帮我们自动整理CSS样式的顺序
  55. "order/properties-order": [
  56. "position",
  57. "top",
  58. "right",
  59. "bottom",
  60. "left",
  61. "z-index",
  62. "display",
  63. "justify-content",
  64. "align-items",
  65. "float",
  66. "clear",
  67. "overflow",
  68. "overflow-x",
  69. "overflow-y",
  70. "padding",
  71. "padding-top",
  72. "padding-right",
  73. "padding-bottom",
  74. "padding-left",
  75. "margin",
  76. "margin-top",
  77. "margin-right",
  78. "margin-bottom",
  79. "margin-left",
  80. "width",
  81. "min-width",
  82. "max-width",
  83. "height",
  84. "min-height",
  85. "max-height",
  86. "font-size",
  87. "font-family",
  88. "text-align",
  89. "text-justify",
  90. "text-indent",
  91. "text-overflow",
  92. "text-decoration",
  93. "white-space",
  94. "color",
  95. "background",
  96. "background-position",
  97. "background-repeat",
  98. "background-size",
  99. "background-color",
  100. "background-clip",
  101. "border",
  102. "border-style",
  103. "border-width",
  104. "border-color",
  105. "border-top-style",
  106. "border-top-width",
  107. "border-top-color",
  108. "border-right-style",
  109. "border-right-width",
  110. "border-right-color",
  111. "border-bottom-style",
  112. "border-bottom-width",
  113. "border-bottom-color",
  114. "border-left-style",
  115. "border-left-width",
  116. "border-left-color",
  117. "border-radius",
  118. "opacity",
  119. "filter",
  120. "list-style",
  121. "outline",
  122. "visibility",
  123. "box-shadow",
  124. "text-shadow",
  125. "resize",
  126. "transition",
  127. ],
  128. "font-family-no-duplicate-names": null,
  129. "no-duplicate-selectors": null,
  130. },
  131. };