.stylelintrc.cjs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // .stylelintrc.cjs
  2. module.exports = {
  3. root: true,
  4. extends: [
  5. 'stylelint-config-standard',
  6. 'stylelint-config-standard-scss', // tips: 本插件也可以替换成 stylelint-config-recommended-scss
  7. 'stylelint-config-recommended-vue/scss',
  8. 'stylelint-config-html/vue',
  9. 'stylelint-config-recess-order',
  10. ],
  11. plugins: ['stylelint-prettier'],
  12. overrides: [
  13. // 扫描 .vue/html 文件中的<style>标签内的样式
  14. {
  15. files: ['**/*.{vue,html}'],
  16. customSyntax: 'postcss-html',
  17. },
  18. {
  19. files: ['**/*.{css,scss}'],
  20. customSyntax: 'postcss-scss',
  21. },
  22. ],
  23. // 自定义规则
  24. rules: {
  25. 'prettier/prettier': true,
  26. // 允许 global 、export 、v-deep等伪类
  27. 'selector-pseudo-class-no-unknown': [
  28. true,
  29. {
  30. ignorePseudoClasses: ['global', 'export', 'v-deep', 'deep'],
  31. },
  32. ],
  33. 'unit-no-unknown': [
  34. true,
  35. {
  36. ignoreUnits: ['rpx'],
  37. },
  38. ],
  39. // 处理小程序page标签不认识的问题
  40. 'selector-type-no-unknown': [
  41. true,
  42. {
  43. ignoreTypes: ['page'],
  44. },
  45. ],
  46. 'comment-empty-line-before': 'never', // never|always|always-multi-line|never-multi-line
  47. 'custom-property-empty-line-before': 'never',
  48. 'no-empty-source': null,
  49. 'comment-no-empty': null,
  50. 'no-duplicate-selectors': null,
  51. },
  52. }