stylelint.config.js 2.0 KB

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