为BEM配置Sass Lint

时间:2018-03-19 17:02:22

标签: sass bem sass-lint

所以我准备将我的sass写入BEM大会。我已经使用sass-lint configuration generator创建了我的配置,并且仅将class-name-format的{​​{1}}编辑为- convention:但是我仍然遇到了一些问题。

也许我误解了BEM?

错误:

  

[sass-lint]类'strictbem'应该写在BEM中(Block   元素修饰符)格式(类名称格式)   .bus__tyre--front

萨斯:

<element class="bus__tyre--front">

SASS-lint.yml:

.bus {
  position: relative;

  &__tyre {
    position: absolute;

    &--front {
      bottom: -22px;
      right: 3%;
      width: 17%;
    }
  }
}

2 个答案:

答案 0 :(得分:1)

根据scss-lint repo中的#335#319判断,看起来您需要更改:

class-name-format:
    - 1
    - convention: hyphenated_BEM

为:

npm version

我希望有所帮助!

答案 1 :(得分:1)

应改为hyphenated_BEM,而不是hyphenatedbem

Example from the sass-lint docs