From 56b636f658e7398b0f646f66d744b95ca023667a Mon Sep 17 00:00:00 2001 From: ray <1490493387@qq.com> Date: Wed, 12 Feb 2025 11:11:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20stylelint=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=9B=B4=E5=8A=A0=E8=BD=BB=E9=87=8F=E7=81=B5=E6=B4=BB?= =?UTF-8?q?=E7=9A=84recommended=E6=9B=BF=E4=BB=A3standard=E8=A7=84?= =?UTF-8?q?=E5=88=99=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .stylelintrc.cjs | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/.stylelintrc.cjs b/.stylelintrc.cjs index 69587661..427857df 100644 --- a/.stylelintrc.cjs +++ b/.stylelintrc.cjs @@ -1,13 +1,15 @@ module.exports = { - // 继承推荐规范配置 extends: [ - "stylelint-config-standard", + "stylelint-config-recommended", "stylelint-config-recommended-scss", "stylelint-config-recommended-vue/scss", "stylelint-config-html/vue", "stylelint-config-recess-order", ], - // 指定不同文件对应的解析器 + + plugins: [ + "stylelint-prettier", // 统一代码风格,格式冲突时以 Prettier 规则为准 + ], overrides: [ { files: ["**/*.{vue,html}"], @@ -18,30 +20,19 @@ module.exports = { customSyntax: "postcss-scss", }, ], - // 自定义规则 rules: { - "import-notation": "string", // 指定导入CSS文件的方式("string"|"url") - "selector-class-pattern": null, // 选择器类名命名规则 - "custom-property-pattern": null, // 自定义属性命名规则 - "keyframes-name-pattern": null, // 动画帧节点样式命名规则 - "no-descending-specificity": null, // 允许无降序特异性 - "no-empty-source": null, // 允许空样式 - "declaration-property-value-no-unknown": null, // 允许未知属性值 - // 允许 global 、export 、deep伪类 + "prettier/prettier": true, // 强制执行 Prettier 格式化规则(需配合 .prettierrc 配置文件) + + "no-empty-source": null, // 允许空的样式文件 + "declaration-property-value-no-unknown": null, // 允许非常规数值格式 ,如 height: calc(100% - 50) + // 允许使用未知伪类 "selector-pseudo-class-no-unknown": [ true, { ignorePseudoClasses: ["global", "export", "deep"], }, ], - // 允许未知属性 - "property-no-unknown": [ - true, - { - ignoreProperties: [], - }, - ], - // 允许未知规则 + // 允许使用未知伪元素 "at-rule-no-unknown": [ true, {