stylelint.config.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * @Author: sjl
  3. * @Date: 2023-05-04 17:32:41
  4. * @Descripttion:
  5. */
  6. module.exports = {
  7. root: true,
  8. plugins: ['stylelint-order', 'stylelint-scss'],
  9. extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
  10. rules: {
  11. // 禁止使用未知的变量
  12. 'scss/no-unknown-variables': true,
  13. // 强制使用下划线命名法
  14. 'scss/dollar-variable-pattern': '^[_]?[a-z]+([_]?[a-z0-9]+)*$',
  15. // 禁止空行
  16. 'scss/at-rule-no-unknown': true,
  17. 'selector-pseudo-class-no-unknown': [
  18. true,
  19. {
  20. ignorePseudoClasses: ['global', 'deep'],
  21. },
  22. ],
  23. 'selector-pseudo-element-no-unknown': [
  24. true,
  25. {
  26. ignorePseudoElements: ['v-deep'],
  27. },
  28. ],
  29. 'at-rule-no-unknown': [
  30. true,
  31. {
  32. ignoreAtRules: [
  33. 'tailwind',
  34. 'apply',
  35. 'variants',
  36. 'responsive',
  37. 'screen',
  38. 'function',
  39. 'if',
  40. 'each',
  41. 'include',
  42. 'mixin',
  43. ],
  44. },
  45. ],
  46. 'no-empty-source': null,
  47. 'named-grid-areas-no-invalid': null,
  48. 'unicode-bom': 'never',
  49. 'no-descending-specificity': null,
  50. 'font-family-no-missing-generic-family-keyword': null,
  51. 'declaration-colon-space-after': 'always-single-line',
  52. 'declaration-colon-space-before': 'never',
  53. // 'declaration-block-trailing-semicolon': 'always',
  54. 'rule-empty-line-before': [
  55. 'always',
  56. {
  57. ignore: ['after-comment', 'first-nested'],
  58. },
  59. ],
  60. 'unit-no-unknown': [true, { ignoreUnits: ['rpx'] }],
  61. 'order/order': [
  62. [
  63. 'dollar-variables',
  64. 'custom-properties',
  65. 'at-rules',
  66. 'declarations',
  67. {
  68. type: 'at-rule',
  69. name: 'supports',
  70. },
  71. {
  72. type: 'at-rule',
  73. name: 'media',
  74. },
  75. 'rules',
  76. ],
  77. { severity: 'warning' },
  78. ],
  79. },
  80. ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
  81. };