stylelint.config.js 2.1 KB

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