Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Add a lint for using @each with maps properly #33

Open
nex3 opened this issue Dec 3, 2018 · 0 comments
Open

Add a lint for using @each with maps properly #33

nex3 opened this issue Dec 3, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@nex3
Copy link

nex3 commented Dec 3, 2018

A pattern I see occasionally is:

@each $key in map-keys($map) {
  $value: map-get($map, $key);
  // ...
}

This is an unnecessarily verbose way of writing:

@each $key, $value in $map {
  // ...
}

There are also some legitimate cases where only the key is used, so maybe it's a good idea to look for the pattern map-get($map, $key) in the loop body before raising the lint?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant