【问题标题】:How to customize stylelint for scss如何为 scss 自定义 stylelint
【发布时间】:2021-08-30 06:58:16
【问题描述】:

我无法为我的项目自定义 stylelint。我想获取示例中的样式代码:

.s{

  .f{
      width:2px;
   }

  .d{
     width:2px;
    }

}

但是当使用这条规则时:"block-closing-brace-empty-line-before": "always-multi-line"

我的代码有这种风格:

.s{

  .f{
      width:2px;

   }

  .d{
     width:2px;

    }

}

【问题讨论】:

  • 也许以你的 html 为例?
  • 为什么?我得到了例子,它应该是我的样式代码

标签: css sass eslint stylelint


【解决方案1】:

您可以使用the rule's "except": ["after-closing-brace"] 辅助选项和"never" 主要选项来实现此代码样式,例如:

{
  "rules": {
    "block-closing-brace-empty-line-before": [
      "never", {
        "except": ["after-closing-brace"]
      }
    ]
  }
}

【讨论】:

  • 这条规则适用于@media之类的函数,但我需要嵌套的类,如上例所示
猜你喜欢
  • 1970-01-01
  • 2021-02-12
  • 2018-11-06
  • 1970-01-01
  • 2013-09-03
  • 1970-01-01
  • 2022-06-11
  • 1970-01-01
  • 2020-07-05
相关资源
最近更新 更多