配置Stylelint(SCSS):移除首个嵌套选择器前的空行
Stylelint配置需求:选择器间保留空行,首个嵌套选择器除外
我正尝试配置.stylelintrc.json,要求选择器之间始终保留空行,但首个嵌套选择器除外。
当前执行--fix后的效果
.class { .is-active { color: red; } .is-disabled { color: grey; } } .block__container { &--grid { /* autoprefixer grid: no-autoplace */ grid-template-rows: 1fr auto auto; } &--full { div { .... } } &--wide { div { ... } } }
期望的最终效果
//This is what I want .class { .is-active { color: red; } .is-disabled { color: grey; } } .block__container { &--grid { /* autoprefixer grid: no-autoplace */ grid-template-rows: 1fr auto auto; } &--full { div { .... } } &--wide { div { ... } } }
当前.stylelintrc.json配置
{ "extends": [ "@wordpress/stylelint-config/scss" ], "rules": { "string-quotes": "single", "scss/at-extend-no-missing-placeholder": true, "selector-class-pattern": null, "selector-id-pattern": null, "declaration-empty-line-before": "never", "rule-empty-line-before": [ "always", { "except": [ "after-single-line-comment", "first-nested" ], "ignore": [ "after-comment", "first-nested" ] } ], "at-rule-empty-line-before": [ "always", { "except": [ "blockless-after-same-name-blockless", "blockless-after-blockless", "first-nested" ], "ignore": [ "after-comment", "first-nested", "blockless-after-blockless" ], "ignoreAtRules": [ "import" ] } ] } }
请问需要使用/扩展哪些规则、选项或插件才能达到预期效果?非常感谢!
内容的提问来源于stack exchange,提问作者user3486605
相关产品推荐
相关产品推荐

