.stylelintrc.cjs 1.6 KB

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