sasstools / sass-lint

Pure Node.js Sass linting
MIT License
1.77k stars 532 forks source link

Creating Dynamic Placeholder accuses error #1196

Open wmerussi opened 6 years ago

wmerussi commented 6 years ago

I saw some issues with dynamically created placeholder and it seems the issue is not resolved. It compiles ok and runs ok as well.

Files:

_config.scss:

$font-families: (
  base: (
    source: google,
    type: sans-serif,
    name: Roboto,
    weights: (400, 700),
  ),
  han: (
    source: google,
    type: sans-serif,
    name: "Black Han Sans",
    weights: (400),
  )
) !default;

$weights: (
  100: light,
  400: normal,
  700: bold,
) !default;

This is the file that is creating font imports and dynamic placholders. _font-config.scss:

@each $family, $font in $font-families {
  @if map-get($font, source) == google {
    $font-name: map-get($font, name);
    $font-type: map-get($font, type);
    $font-weights: map-get($font, weights);

    @each $weight in $font-weights {
      @import url("https://fonts.googleapis.com/css?family=#{$font-name}:#{$weight}");

      %--#{$family}_#{map-get($weights, $weight)} {
        font-family: $font-name, map-get($fallback, $font-type);
        font-weight: $weight;
      }
    }
  }
}

.sass-lint.yml:

# sass-lint config generated by make-sass-lint-config v0.1.2
#
# The following scss-lint Linters are not yet supported by sass-lint:
# PrivateNamingConvention

files:
  include: '**/*.s+(a|c)ss'
  ignore: 'node_modules/**/*'
options:
  formatter: stylish
  merge-default-rules: false
rules:
  bem-depth: 1
  border-zero:
    - 1
    - convention: zero
  brace-style:
    - 1
    - allow-single-line: false
  class-name-format:
    - 1
    - convention: ^(?!js-).*
      convention-explanation: should not be written in the form js-*
  extends-before-declarations: 0
  extends-before-mixins: 0
  function-name-format: 1
  id-name-format:
    - 1
    - convention: hyphenatedbem
  leading-zero: 0
  mixin-name-format: 1
  mixins-before-declarations: 0
  no-extends: 1
  no-qualifying-elements: 0
  placeholder-name-format:
    - 1
    - convention: hyphenatedbem
  property-sort-order: 0
  quotes:
    - 1
    - style: double
  variable-name-format: 1

What version of Sass Lint are you using?

"sass-lint": "^1.12.1",

Please include any relevant parts of your configuration

Included above

What did you do? Please include the actual source code causing the issue.

Installed sass-lint and imported the airbnb configuration

What did you expect to happen?

No errors accused

What actually happened? Please include any error messages given to you by Sass Lint.

src/styles/tools/utils/_font-config.scss
  10:1  error  Please check validity of the block starting from line #10  Fatal

✖ 1 problem (1 error, 0 warnings)

If you're using a IDE plugin have you tried the CLI too?

Not using IDE, only mac terminal

wmerussi commented 6 years ago

So, further tests shows that placeholders cannot start with double dash %--..., even without any rules at all. Is this intended?