.stylelintrc.cjs 1.4 KB

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