.stylelintrc.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * @Author: wjc
  3. * @Date: 2024-05-29 17:32:17
  4. * @LastEditors: wjc
  5. * @LastEditTime: 2024-05-29 17:58:47
  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. 'color-function-notation': ['legacy', { ignore: ['with-var-inside'] }],
  38. // 这里使用正则表达式允许选择器中出现短横线和下划线。
  39. 'selector-class-pattern': '^[a-z][a-zA-Z0-9_-]+$',
  40. 'no-descending-specificity': null, // 禁止在具有较高优先级的选择器后出现被其覆盖的较低优先级的选择器
  41. 'selector-pseudo-element-no-unknown': [
  42. true,
  43. {
  44. ignorePseudoElements: ['v-deep', 'deep', 'global'],
  45. },
  46. ],
  47. 'scss/at-extend-no-missing-placeholder': null,
  48. 'at-rule-no-unknown': [
  49. true,
  50. {
  51. ignoreAtRules: ['mixin', 'include', 'extend'],
  52. },
  53. ],
  54. 'selector-pseudo-class-no-unknown': [
  55. true,
  56. {
  57. ignorePseudoClasses: ['deep', 'slotted'],
  58. },
  59. ],
  60. },
  61. }