在gruntfile中

stylelint: {
    all: ['app/styles/**/*.scss']
},


.stylelintrc

{
    "plugins": [
        "stylelint-selector-bem-pattern"
    ],
    "rules": {
      "plugin/selector-bem-pattern": {
      "componentName": "[A-Z]+",
      "componentSelectors": {
        "initial": "^\\.{componentName}(?:-[a-z]+)?$",
        "combined": "^\\.combined-{componentName}-[a-z]+$"
      },
      "utilitySelectors": "^\\.util-[a-z]+$"
    }
    }
}


/Users/jitendravyas/app-test/styles/components/_campaign-settings-integrations.scss

/* @define campaign-settings */

.campaign-settings__integrations {
  @include flex;
}

.campaign-settings__integration {
  border: 1px solid $color-green;
  border-radius: 3px;
  color: $color-green;
  margin-right: $base-spacing-unit;
  @include flex;

  .check {
    background: $color-green;
    color: white;
    @include vertical-center;
  }

  > div {
    padding: $half-spacing-unit;
  }
}


运行stylelint时未收到任何错误。 Stylelint正在使用其他规则。

最佳答案

我相信您没有正确定义组件名称。因此,短绒棉绒正确地跳过了文件。

must use简洁或冗长的语法:

/** @define campaign-settings */


要么

/* postcss-bem-linter: define campaign-settings */


目前,您似乎使用了无效的简洁语法形式,即您的注释以/*而不是/**开头。

09-25 21:33