.stylelintrc.js 2.6 KB

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