stylelint-scss
Version:
A collection of SCSS specific rules for stylelint
68 lines (54 loc) • 1.21 kB
Markdown
# at-each-key-value-single-line
This is a rule that checks for situations where users have:
- Done a loop using map-keys
- Grabbed the value for that key inside of the loop.
```scss
$font-weights: (
"regular": 400,
"medium": 500,
"bold": 700
);
$key in map-keys($font-weights) {
$value: map-get($font-weights, $key);
/** ↑
* This call should be consolidated into the @each call.
**/
}
```
## Options
### `true`
The following patterns are considered violations:
```scss
$font-weights: (
"regular": 400,
"medium": 500,
"bold": 700
);
$key in map-keys($font-weights) {
$value: map-get($font-weights, $key);
}
```
The following patterns are _not_ considered violations:
```scss
$font-weights: ("regular": 400, "medium": 500, "bold": 700);
$key, $value in $font-weights {...}
```
```scss
$font-weights: (
"regular": 400,
"medium": 500,
"bold": 700
);
$other-weights: (
"regular": 400,
"medium": 500,
"bold": 700
);
$key, $value in map-keys($font-weights) {
$value: map-get($other-weights, $key);
}
```
```scss
$font-weights: ("regular": 400, "medium": 500, "bold": 700);
$key, $value in map-keys($font-weights) {...}
```