.stylelintrc.cjs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. module.exports = {
  2. extends: [
  3. "stylelint-config-standard", // 配置stylelint拓展插件
  4. "stylelint-config-html/vue", // 配置 vue 中 template 样式格式化
  5. "stylelint-config-standard-scss", // 配置stylelint scss插件
  6. "stylelint-config-recommended-vue/scss", // 配置 vue 中 scss 样式格式化
  7. "stylelint-config-recess-order", // 配置stylelint css属性书写顺序插件,
  8. "stylelint-config-prettier" // 配置stylelint和prettier兼容
  9. ],
  10. overrides: [
  11. {
  12. files: ["**/*.(scss|css|vue|html)"],
  13. customSyntax: "postcss-scss"
  14. },
  15. {
  16. files: ["**/*.(html|vue)"],
  17. customSyntax: "postcss-html"
  18. }
  19. ],
  20. ignoreFiles: ["**/*.js", "**/*.jsx", "**/*.tsx", "**/*.ts", "**/*.json", "**/*.md", "**/*.yaml"],
  21. /**
  22. * null => 关闭该规则
  23. * always => 必须
  24. */
  25. rules: {
  26. "value-keyword-case": null, // 在 css 中使用 v-bind,不报错
  27. "no-descending-specificity": null, // 禁止在具有较高优先级的选择器后出现被其覆盖的较低优先级的选择器
  28. "function-url-quotes": "always", // 要求或禁止 URL 的引号 "always(必须加上引号)"|"never(没有引号)"
  29. "no-empty-source": null, // 关闭禁止空源码
  30. "selector-class-pattern": null, // 关闭强制选择器类名的格式
  31. "property-no-unknown": null, // 禁止未知的属性(true 为不允许)
  32. "block-opening-brace-space-before": "always", //大括号之前必须有一个空格或不能有空白符
  33. "value-no-vendor-prefix": null, // 关闭 属性值前缀 --webkit-box
  34. "property-no-vendor-prefix": null, // 关闭 属性前缀 -webkit-mask
  35. "selector-pseudo-class-no-unknown": [
  36. // 不允许未知的选择器
  37. true,
  38. {
  39. ignorePseudoClasses: ["global", "v-deep", "deep"] // 忽略属性,修改element默认样式的时候能使用到
  40. }
  41. ]
  42. }
  43. }