.stylelintrc.cjs 1.3 KB

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