.stylelintrc.cjs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. module.exports = {
  2. extends: [
  3. 'stylelint-config-standard',
  4. 'stylelint-config-recommended-less',
  5. 'stylelint-config-standard-vue'
  6. ],
  7. plugins: ['stylelint-order'],
  8. // 不同格式的文件指定自定义语法
  9. overrides: [
  10. {
  11. files: ['**/*.(less|css|vue|html)'],
  12. customSyntax: 'postcss-less'
  13. },
  14. {
  15. files: ['**/*.(html|vue)'],
  16. customSyntax: 'postcss-html'
  17. }
  18. ],
  19. ignoreFiles: [
  20. '**/*.js',
  21. '**/*.jsx',
  22. '**/*.tsx',
  23. '**/*.ts',
  24. '**/*.json',
  25. '**/*.md',
  26. '**/*.yaml'
  27. ],
  28. rules: {
  29. 'no-descending-specificity': null, // 禁止在具有较高优先级的选择器后出现被其覆盖的较低优先级的选择器
  30. 'selector-pseudo-element-no-unknown': [
  31. true,
  32. {
  33. ignorePseudoElements: ['v-deep']
  34. }
  35. ],
  36. 'selector-pseudo-class-no-unknown': [
  37. true,
  38. {
  39. ignorePseudoClasses: ['deep']
  40. }
  41. ],
  42. // 指定样式的排序
  43. 'order/properties-order': [
  44. 'position',
  45. 'top',
  46. 'right',
  47. 'bottom',
  48. 'left',
  49. 'z-index',
  50. 'display',
  51. 'justify-content',
  52. 'align-items',
  53. 'float',
  54. 'clear',
  55. 'overflow',
  56. 'overflow-x',
  57. 'overflow-y',
  58. 'padding',
  59. 'padding-top',
  60. 'padding-right',
  61. 'padding-bottom',
  62. 'padding-left',
  63. 'margin',
  64. 'margin-top',
  65. 'margin-right',
  66. 'margin-bottom',
  67. 'margin-left',
  68. 'width',
  69. 'min-width',
  70. 'max-width',
  71. 'height',
  72. 'min-height',
  73. 'max-height',
  74. 'font-size',
  75. 'font-family',
  76. 'text-align',
  77. 'text-justify',
  78. 'text-indent',
  79. 'text-overflow',
  80. 'text-decoration',
  81. 'white-space',
  82. 'color',
  83. 'background',
  84. 'background-position',
  85. 'background-repeat',
  86. 'background-size',
  87. 'background-color',
  88. 'background-clip',
  89. 'border',
  90. 'border-style',
  91. 'border-width',
  92. 'border-color',
  93. 'border-top-style',
  94. 'border-top-width',
  95. 'border-top-color',
  96. 'border-right-style',
  97. 'border-right-width',
  98. 'border-right-color',
  99. 'border-bottom-style',
  100. 'border-bottom-width',
  101. 'border-bottom-color',
  102. 'border-left-style',
  103. 'border-left-width',
  104. 'border-left-color',
  105. 'border-radius',
  106. 'opacity',
  107. 'filter',
  108. 'list-style',
  109. 'outline',
  110. 'visibility',
  111. 'box-shadow',
  112. 'text-shadow',
  113. 'resize',
  114. 'transition'
  115. ]
  116. }
  117. }