stylelint.config.js 2.0 KB

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