.stylelintrc.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * @Author: wjc
  3. * @Date: 2024-05-29 17:32:17
  4. * @LastEditors: wjc
  5. * @LastEditTime: 2024-06-05 17:39:01
  6. * @Description:
  7. */
  8. module.exports = {
  9. root: true,
  10. extends: [
  11. 'stylelint-config-recommended',
  12. 'stylelint-config-recommended-scss',
  13. 'stylelint-config-recommended-vue/scss',
  14. 'stylelint-config-recess-order',
  15. ],
  16. plugins: ['stylelint-order', 'stylelint-prettier'],
  17. // 不同格式的文件指定自定义语法
  18. overrides: [
  19. {
  20. files: ['**/*.(scss|css|vue|html)'],
  21. customSyntax: 'postcss-scss',
  22. },
  23. {
  24. files: ['**/*.(html|vue)'],
  25. customSyntax: 'postcss-html',
  26. },
  27. ],
  28. ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts', '**/*.json', '**/*.md', '**/*.yaml'],
  29. rules: {
  30. 'prettier/prettier': true,
  31. 'unit-no-unknown': [
  32. true,
  33. {
  34. ignoreUnits: ['rpx'],
  35. },
  36. ],
  37. 'selector-type-no-unknown': [
  38. true,
  39. {
  40. ignoreTypes: ['page'],
  41. },
  42. ],
  43. 'color-function-notation': ['legacy', { ignore: ['with-var-inside'] }],
  44. // 这里使用正则表达式允许选择器中出现短横线和下划线。
  45. 'selector-class-pattern': '^[a-z][a-zA-Z0-9_-]+$',
  46. 'no-descending-specificity': null, // 禁止在具有较高优先级的选择器后出现被其覆盖的较低优先级的选择器
  47. 'selector-pseudo-element-no-unknown': [
  48. true,
  49. {
  50. ignorePseudoElements: ['v-deep', 'deep', 'global'],
  51. },
  52. ],
  53. 'scss/at-extend-no-missing-placeholder': null,
  54. 'at-rule-no-unknown': [
  55. true,
  56. {
  57. ignoreAtRules: ['mixin', 'include', 'extend'],
  58. },
  59. ],
  60. 'selector-pseudo-class-no-unknown': [
  61. true,
  62. {
  63. ignorePseudoClasses: ['deep', 'slotted'],
  64. },
  65. ],
  66. },
  67. }