Sass-lint应该用连字符类名格式小写

时间:2018-07-18 19:26:21

标签: sass-lint grunt-sass-lint

我使用BEM方法对sass皮棉有以下问题

尽管看到了BEM的必要参数,但仍会产生警告

SASS:

.error {
  line-height: 1;

  &__text {
    font-size: $fz30;

    @media (min-width: $break-medium) {
      font-size: $fz45;
    }
  }

  &__number {
    font-size: $fz100;
    font-weight: $thin;

    @media (min-width: $break-medium) {
      font-size: $fz180;
    }
  }
}

CMD

./source/scss/_error.scss
   8:4  warning  Class '.error__text' should be written in lowercase with hyphens
 class-name-format
  16:4  warning  Class '.error__number' should be written in lowercase with hyphens  class-name-format

✖ 2 problems (0 errors, 2 warnings)

SASS-Lint

options:
  formatter: stylish
files:
  include: '**/*.s+(a|c)ss'
rules:
  # Extends
  extends-before-mixins: 1
  extends-before-declarations: 1
  placeholder-in-extend: 1

  # Mixins
  mixins-before-declarations: 1

  # Line Spacing
  one-declaration-per-line: 1
  empty-line-between-blocks: 1
  single-line-per-selector: 1

  # Disallows
  no-attribute-selectors: 0
  no-color-hex: 0
  no-color-keywords: 1
  no-color-literals: 1
  no-combinators: 0
  no-css-comments: 1
  no-debug: 1
  no-disallowed-properties: 0
  no-duplicate-properties: 1
  no-empty-rulesets: 1
  no-extends: 0
  no-ids: 1
  no-important: 1
  no-invalid-hex: 1
  no-mergeable-selectors: 1
  no-misspelled-properties: 1
  no-qualifying-elements: 1
  no-trailing-whitespace: 1
  no-trailing-zero: 1
  no-transition-all: 1
  no-universal-selectors: 0
  no-url-domains: 1
  no-url-protocols: 1
  no-vendor-prefixes: 1
  no-warn: 1
  property-units: 0

  # Nesting
  declarations-before-nesting: 1
  force-attribute-nesting: 1
  force-element-nesting: 1
  force-pseudo-nesting: 1

  # Name Formats
  class-name-format:
    - 1
    - allow-leading-underscore: false
      convention: strictbem
  function-name-format: 1
  id-name-format: 0
  mixin-name-format: 1
  placeholder-name-format: 1
  variable-name-format: 1

  # Style Guide
  attribute-quotes: 1
  bem-depth: 0
  border-zero: 1
  brace-style: 1
  clean-import-paths: 1
  empty-args: 1
  hex-length: 1
  hex-notation: 1
  indentation: 1
  leading-zero: 1
  max-line-length: 0
  max-file-line-count: 0
  nesting-depth: 1
  property-sort-order: 1
  pseudo-element: 1
  quotes: 1
  shorthand-values: 1
  url-quotes: 1
  variable-for-property: 1
  zero-unit: 1

  # Inner Spacing
  space-after-comma: 1
  space-before-colon: 1
  space-after-colon: 1
  space-before-brace: 1
  space-before-bang: 1
  space-after-bang: 1
  space-between-parens: 1
  space-around-operator: 1

  # Final Items
  trailing-semicolon: 1
  final-newline: 1

我尝试了以下方法:

  class-name-format:
    - 1
    - allow-leading-underscore: false
      convention: strictbem

有人可以指出哪种类型的解决方案吗?

我正在使用https://github.com/sasstools/sass-lint/blob/master/docs/rules/class-name-format.md

的文档

0 个答案:

没有答案