.stylelintrc.cjs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. overrides: [
  12. // 扫描 .vue/html 文件中的<style>标签内的样式
  13. {
  14. files: ['**/*.{vue,html}'],
  15. customSyntax: 'postcss-html',
  16. },
  17. {
  18. files: ['**/*.{css,scss}'],
  19. customSyntax: 'postcss-scss',
  20. },
  21. ],
  22. // 自定义规则
  23. rules: {
  24. // 允许 global 、export 、v-deep等伪类
  25. 'selector-pseudo-class-no-unknown': [
  26. true,
  27. {
  28. ignorePseudoClasses: ['global', 'export', 'v-deep', 'deep'],
  29. },
  30. ],
  31. 'unit-no-unknown': [
  32. true,
  33. {
  34. ignoreUnits: ['rpx'],
  35. },
  36. ],
  37. // 处理小程序page标签不认识的问题
  38. 'selector-type-no-unknown': [
  39. true,
  40. {
  41. ignoreTypes: ['page'],
  42. },
  43. ],
  44. 'comment-empty-line-before': 'never',
  45. 'custom-property-empty-line-before': 'never',
  46. 'no-empty-source': null,
  47. },
  48. }