.stylelintrc.js 2.8 KB

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