stylelint.config.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. ]
  36. }
  37. ],
  38. 'rule-empty-line-before': [
  39. 'always',
  40. {
  41. ignore: ['after-comment', 'first-nested']
  42. }
  43. ],
  44. 'color-function-notation': 'legacy',
  45. // 函数 url 链接不允许 shceme relative
  46. 'function-url-no-scheme-relative': true,
  47. // 可组合成一个属性的写法,不允许拆开书写
  48. 'declaration-block-no-redundant-longhand-properties': true,
  49. // 选择器最大深度
  50. 'selector-max-compound-selectors': 12,
  51. // 最多2个类型选择器
  52. 'selector-max-type': 2,
  53. // 不允许未知的动画
  54. 'no-unknown-animations': true,
  55. // 在字体名称必须使用引号的地方使用引号,其他地方不能使用
  56. 'font-family-name-quotes': 'always-unless-keyword',
  57. // url 函数内部必须有引号
  58. 'function-url-quotes': 'always',
  59. 'value-keyword-case': ['lower', { ignoreKeywords: ['optimizeLegibility', 'currentColor'] }],
  60. 'max-nesting-depth': [12, { ignore: ['blockless-at-rules', 'pseudo-classes'] }],
  61. 'selector-no-qualifying-type': [true, { ignore: ['attribute', 'class', 'id'] }]
  62. },
  63. ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
  64. overrides: [
  65. {
  66. files: ['*.vue', '**/*.vue'],
  67. extends: [
  68. 'stylelint-config-recess-order',
  69. 'stylelint-config-standard-scss',
  70. 'stylelint-config-recommended-vue/scss'
  71. ],
  72. rules: {
  73. 'keyframes-name-pattern': null,
  74. 'declaration-property-value-no-unknown': [true, { ignoreProperties: { '/.+/': '/(v-bind(.*))|($.*)/' } }],
  75. 'selector-pseudo-element-no-unknown': true
  76. }
  77. }
  78. ]
  79. };