stylelint.config.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. 'declaration-block-no-duplicate-properties': true,
  13. // 指定颜色函数使用传统符号隔开
  14. 'color-function-notation': 'legacy',
  15. // 函数 url 链接不允许 shceme relative
  16. 'function-url-no-scheme-relative': true,
  17. // 可组合成一个属性的写法,不允许拆开书写
  18. 'declaration-block-no-redundant-longhand-properties': true,
  19. // 选择器最大深度
  20. 'selector-max-compound-selectors': 8,
  21. // 限制 id选择器的数目在一个选择器中
  22. 'selector-max-id': 1,
  23. // 最多2个类型选择器
  24. 'selector-max-type': 2,
  25. // 不允许未知的动画
  26. 'no-unknown-animations': true,
  27. // 在字体名称必须使用引号的地方使用引号,其他地方不能使用
  28. 'font-family-name-quotes': 'always-where-required',
  29. // url 函数内部必须有引号
  30. 'function-url-quotes': 'always',
  31. // 指定字符串引号为单引号
  32. 'string-quotes': 'single',
  33. // 在规则的分号之前不允许有空格
  34. 'at-rule-semicolon-space-before': 'never',
  35. // 首行不允许空行
  36. 'no-empty-first-line': true,
  37. // 不允许使用 unicode 作为顺序标记
  38. 'unicode-bom': 'never',
  39. 'at-rule-no-unknown': null
  40. }
  41. };