stylelint.config.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. module.exports = {
  2. root: true,
  3. defaultSeverity: 'warning',
  4. extends: ['stylelint-config-recommended-scss', 'stylelint-config-recess-order', 'stylelint-config-standard-scss'],
  5. plugins: ['stylelint-declaration-block-no-ignored-properties'],
  6. rules: {
  7. 'scss/dollar-variable-pattern': null,
  8. 'selector-class-pattern': null,
  9. 'order/properties-alphabetical-order': null,
  10. // 嵌套过多,建议关闭此规则
  11. 'no-descending-specificity': null,
  12. 'selector-max-id': 1,
  13. 'selector-pseudo-class-no-unknown': [
  14. true,
  15. {
  16. ignorePseudoClasses: ['deep', 'global'],
  17. },
  18. ],
  19. 'at-rule-no-unknown': [
  20. true,
  21. {
  22. ignoreAtRules: [
  23. 'tailwind',
  24. 'apply',
  25. 'variants',
  26. 'responsive',
  27. 'screen',
  28. 'function',
  29. 'if',
  30. 'each',
  31. 'extend',
  32. 'include',
  33. 'mixin',
  34. 'at-root',
  35. 'use',
  36. ],
  37. },
  38. ],
  39. 'rule-empty-line-before': [
  40. 'always',
  41. {
  42. ignore: ['after-comment', 'first-nested'],
  43. },
  44. ],
  45. 'color-function-notation': 'legacy',
  46. // 函数 url 链接不允许 shceme relative
  47. 'function-url-no-scheme-relative': true,
  48. // 可组合成一个属性的写法,不允许拆开书写
  49. 'declaration-block-no-redundant-longhand-properties': true,
  50. // 选择器最大深度
  51. 'selector-max-compound-selectors': 10,
  52. // 最多2个类型选择器
  53. 'selector-max-type': 2,
  54. // 不允许未知的动画
  55. 'no-unknown-animations': true,
  56. // 在字体名称必须使用引号的地方使用引号,其他地方不能使用
  57. 'font-family-name-quotes': 'always-unless-keyword',
  58. // url 函数内部必须有引号
  59. 'function-url-quotes': 'always',
  60. 'value-keyword-case': ['lower', { ignoreKeywords: ['optimizeLegibility', 'currentColor'] }],
  61. 'max-nesting-depth': [10, { ignore: ['blockless-at-rules', 'pseudo-classes'] }],
  62. 'selector-no-qualifying-type': [true, { ignore: ['attribute', 'class', 'id'] }],
  63. 'font-family-no-missing-generic-family-keyword': [
  64. true,
  65. {
  66. ignoreFontFamilies: ['League'],
  67. },
  68. ],
  69. },
  70. ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
  71. overrides: [
  72. {
  73. files: ['*.vue', '**/*.vue'],
  74. extends: [
  75. 'stylelint-config-recess-order',
  76. 'stylelint-config-standard-scss',
  77. 'stylelint-config-recommended-vue/scss',
  78. ],
  79. rules: {
  80. 'keyframes-name-pattern': null,
  81. 'declaration-property-value-no-unknown': [true, { ignoreProperties: { '/.+/': '/(v-bind(.*))|($.*)/' } }],
  82. 'selector-pseudo-element-no-unknown': true,
  83. },
  84. },
  85. ],
  86. };