/** @type {import("stylelint").Config} */ export default { defaultSeverity: 'warning', extends: ['stylelint-config-standard', 'stylelint-config-standard-vue'], plugins: ['stylelint-order', 'stylelint-less', 'stylelint-prettier'], rules: { // 禁止空代码 'at-rule-no-unknown': null, 'no-descending-specificity': null, 'no-empty-source': null, // 禁止在覆盖高特异性选择器之后出现低特异性选择器 'no-descending-specificity': null, // 不允许未知单位 'unit-no-unknown': [true, { ignoreUnits: ['rpx'] }], // 禁止小于 1 的小数有一个前导零 // "number-leading-zero": "never", 'media-query-no-invalid': null, // 禁止空注释 'comment-no-empty': true, // 未知的 @ 规则 'at-rule-no-unknown': [ true, { ignoreAtRules: [ 'plugin', 'apply', 'screen', 'function', 'if', 'each', 'include', 'mixin', 'extend', 'content', 'use' ] } ], // 空行规则 'rule-empty-line-before': [ 'always', { ignore: ['after-comment', 'first-nested'] } ], 'order/order': [ [ 'dollar-variables', 'custom-properties', 'at-rules', 'declarations', { type: 'at-rule', name: 'supports' }, { type: 'at-rule', name: 'media' }, 'rules' ], { severity: 'warning' } ] }, overrides: [ { files: ['**/*.(css|html|vue)'], customSyntax: 'postcss-html', rules: { // 禁止未知的伪类选择器 'selector-pseudo-class-no-unknown': [ true, { ignorePseudoClasses: ['deep', 'global'] } ], // 禁止未知的伪元素选择器 'selector-pseudo-element-no-unknown': [ true, { ignorePseudoElements: ['v-deep', 'v-global', 'v-slotted'] } ] } }, { files: ['*.less', '**/*.less'], customSyntax: 'postcss-less', extends: ['stylelint-config-standard-less'], rules: { 'less/color-no-invalid-hex': true, 'less/no-duplicate-variables': true } } ], ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'] };