.stylelintrc.cjs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. module.exports = {
  2. extends: [
  3. "stylelint-config-recommended",
  4. "stylelint-config-recommended-scss",
  5. "stylelint-config-recommended-vue/scss",
  6. "stylelint-config-html/vue",
  7. "stylelint-config-recess-order",
  8. ],
  9. plugins: [
  10. "stylelint-prettier", // 统一代码风格,格式冲突时以 Prettier 规则为准
  11. ],
  12. overrides: [
  13. {
  14. files: ["**/*.{vue,html}"],
  15. customSyntax: "postcss-html",
  16. },
  17. {
  18. files: ["**/*.{css,scss}"],
  19. customSyntax: "postcss-scss",
  20. },
  21. ],
  22. rules: {
  23. "prettier/prettier": true, // 强制执行 Prettier 格式化规则(需配合 .prettierrc 配置文件)
  24. "no-empty-source": null, // 允许空的样式文件
  25. "declaration-property-value-no-unknown": null, // 允许非常规数值格式 ,如 height: calc(100% - 50)
  26. // 允许使用未知伪类
  27. "selector-pseudo-class-no-unknown": [
  28. true,
  29. {
  30. ignorePseudoClasses: ["global", "export", "deep"],
  31. },
  32. ],
  33. // 允许使用未知伪元素
  34. "at-rule-no-unknown": null, // 禁用默认的未知 at-rule 检查
  35. "scss/at-rule-no-unknown": true, // 启用 SCSS 特定的 at-rule 检查
  36. },
  37. };