.stylelintrc.cjs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. module.exports = {
  2. // 继承推荐规范配置
  3. extends: ['stylelint-config-standard', 'stylelint-config-recommended-scss', 'stylelint-config-recommended-vue/scss', 'stylelint-config-html/vue', 'stylelint-config-recess-order'],
  4. // 指定不同文件对应的解析器
  5. overrides: [
  6. {
  7. files: ['**/*.{vue,html}'],
  8. customSyntax: 'postcss-html'
  9. },
  10. {
  11. files: ['**/*.{css,scss}'],
  12. customSyntax: 'postcss-scss'
  13. }
  14. ],
  15. // 自定义规则
  16. rules: {
  17. 'import-notation': 'string', // 指定导入CSS文件的方式("string"|"url")
  18. 'selector-class-pattern': null, // 选择器类名命名规则
  19. 'custom-property-pattern': null, // 自定义属性命名规则
  20. 'keyframes-name-pattern': null, // 动画帧节点样式命名规则
  21. 'no-descending-specificity': null, // 允许无降序特异性
  22. 'no-empty-source': null, // 允许空样式
  23. 'property-no-vendor-prefix': null, // 允许属性前缀
  24. // 允许 global 、export 、deep伪类
  25. 'selector-pseudo-class-no-unknown': [
  26. true,
  27. {
  28. ignorePseudoClasses: ['global', 'export', 'deep']
  29. }
  30. ],
  31. // 允许未知属性
  32. 'property-no-unknown': [
  33. true,
  34. {
  35. ignoreProperties: []
  36. }
  37. ],
  38. // 允许未知规则
  39. 'at-rule-no-unknown': [
  40. true,
  41. {
  42. ignoreAtRules: ['apply', 'use', 'mixin', 'include', 'extend', 'each', 'if', 'else', 'for', 'while']
  43. }
  44. ]
  45. }
  46. }