cloudfour / cloudfour/stylelint-config-cloudfour

Update SCSS rules around mixin location given impending Sass changes

Open
#528 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2
Forks
1
Avg merge
5h 11m
Merged PRs (30d)
10

Description

Currently, our lint definition enforces `@include` functions being at the beginning of a style block. This was a fine rule to settle on, because Sass would always output nested blocks _after_ non-nested properties.

So given this code:

```scss
@mixin vertical-rhythm($space: 1lh) {
> * + * {
margin-block-start: $space;
}
}

.example {
@include vertical-rhythm;
color: red;
}
```

The output would be:

```css
.example {
color: red;
}

.example > * + * {
margin-block-start: 1lh;
}
```

But Sass has announced they'll be changing this behavior in a future update. At some point, nested blocks will respect the output order: https://sass-lang.com/documentation/breaking-changes/mixed-decls/

With that change, the order of the output will be reversed:

```css
.example > * + * {
margin-block-start: 1lh;
}

.example {
color: red;
}
```

Because of that, I think we should consider either:

1. Enforcing `@include` statements and nesting to come _after_ top-level declarations. This would enforce current behavior.
2. Remove any `@include` order enforcement at all, allowing authors to leverage order as they see fit.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.