stylelint.config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. module.exports = {
  2. defaultSeverity: 'warning',
  3. extends: 'stylelint-config-standard',
  4. plugins: ['stylelint-declaration-block-no-ignored-properties', 'stylelint-order'],
  5. rules: {
  6. 'plugin/declaration-block-no-ignored-properties': true,
  7. // 各分类属性顺序
  8. 'order/order': ['at-rules', 'custom-properties', 'dollar-variables', 'declarations', 'rules'],
  9. // 指定2个空格
  10. indentation: 2,
  11. // 多个选择器样式之间允许有空行
  12. // 'rule-empty-line-before': null,
  13. 'declaration-colon-newline-after': null,
  14. // 样式块中不允许重复的属性
  15. 'declaration-block-no-duplicate-properties': true,
  16. // 指定颜色函数使用传统符号隔开
  17. 'color-function-notation': 'legacy',
  18. // 函数 url 链接不允许 shceme relative
  19. 'function-url-no-scheme-relative': true,
  20. // 可组合成一个属性的写法,不允许拆开书写
  21. 'declaration-block-no-redundant-longhand-properties': true,
  22. // 选择器最大深度为4
  23. 'selector-max-compound-selectors': 6,
  24. // 限制 id 选择器的数目在一个选择器中
  25. 'selector-max-id': 1,
  26. // 最多2个类型选择器
  27. 'selector-max-type': 2,
  28. // 不允许未知的动画
  29. 'no-unknown-animations': true,
  30. // 在字体名称必须使用引号的地方使用引号,其他地方不能使用
  31. 'font-family-name-quotes': 'always-where-required',
  32. // url 函数内部必须有引号
  33. 'function-url-quotes': 'always',
  34. // 指定字符串引号为单引号
  35. 'string-quotes': 'single',
  36. // 在规则的分号之前不允许有空格
  37. 'at-rule-semicolon-space-before': 'never',
  38. // 首行不允许空行
  39. 'no-empty-first-line': true,
  40. // 不允许使用 unicode 作为顺序标记
  41. 'unicode-bom': 'never',
  42. 'at-rule-no-unknown': null
  43. }
  44. };