stylelint.config.mjs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. * Copyright (c) 2013-Now https://jeesite.com All rights reserved.
  3. * No deletion without permission, or be held responsible to law.
  4. * @author ThinkGem
  5. */
  6. export default {
  7. root: true,
  8. plugins: ['stylelint-prettier', 'stylelint-less', '@stylistic/stylelint-plugin'],
  9. extends: ['stylelint-config-standard', 'stylelint-config-standard-less'],
  10. ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
  11. overrides: [
  12. {
  13. files: ['*.(html|vue)', '**/*.(html|vue)'],
  14. customSyntax: 'postcss-html',
  15. extends: ['stylelint-config-recommended-vue'],
  16. rules: {
  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', 'v-global', 'v-slotted'],
  27. },
  28. ],
  29. },
  30. },
  31. {
  32. files: ['*.less', '**/*.less'],
  33. customSyntax: 'postcss-less',
  34. extends: ['stylelint-config-recommended-less'],
  35. },
  36. {
  37. files: ['*.scss', '**/*.scss'],
  38. customSyntax: 'postcss-scss',
  39. extends: ['stylelint-config-recommended-scss', 'stylelint-config-recommended-vue/scss'],
  40. },
  41. ],
  42. rules: {
  43. 'prettier/prettier': [
  44. true,
  45. {
  46. preferPositionShorthand: 'never',
  47. preferOverflowShorthand: 'separate',
  48. },
  49. ],
  50. 'media-feature-range-notation': null,
  51. 'selector-not-notation': null,
  52. 'import-notation': null,
  53. 'function-no-unknown': null,
  54. 'selector-class-pattern': null,
  55. 'at-rule-prelude-no-invalid': null,
  56. 'declaration-property-value-no-unknown': null,
  57. 'declaration-property-value-keyword-no-deprecated': null,
  58. 'declaration-property-value-disallowed-list': {
  59. inset: [/.*/], // 禁止所有 inset 属性值
  60. },
  61. // 允许使用传统属性
  62. 'declaration-property-value-allowed-list': {
  63. top: [/.*/],
  64. right: [/.*/],
  65. bottom: [/.*/],
  66. left: [/.*/],
  67. },
  68. 'selector-pseudo-class-no-unknown': [
  69. true,
  70. {
  71. ignorePseudoClasses: ['global', 'deep'],
  72. },
  73. ],
  74. 'selector-pseudo-element-no-unknown': [
  75. true,
  76. {
  77. ignorePseudoElements: ['v-deep'],
  78. },
  79. ],
  80. 'at-rule-no-unknown': [
  81. true,
  82. {
  83. ignoreAtRules: [
  84. 'extends',
  85. 'ignores',
  86. 'include',
  87. 'mixin',
  88. 'if',
  89. 'else',
  90. 'media',
  91. 'for',
  92. 'at-root',
  93. 'unocss',
  94. 'apply',
  95. 'variants',
  96. 'responsive',
  97. 'screen',
  98. 'function',
  99. 'each',
  100. 'use',
  101. 'forward',
  102. 'return',
  103. ],
  104. },
  105. ],
  106. 'no-empty-source': null,
  107. 'named-grid-areas-no-invalid': null,
  108. 'no-descending-specificity': null,
  109. 'font-family-no-missing-generic-family-keyword': null,
  110. 'media-query-no-invalid': null,
  111. 'rule-empty-line-before': [
  112. 'always',
  113. {
  114. ignore: ['after-comment', 'first-nested'],
  115. },
  116. ],
  117. 'unit-no-unknown': [true, { ignoreUnits: ['rpx'] }],
  118. 'no-duplicate-selectors': null,
  119. 'no-invalid-position-declaration': null,
  120. },
  121. };