notes/node_modules/stylelint-scss/src/rules/at-if-closing-brace-space-a.../README.md

99 lines
1.8 KiB
Markdown

# at-if-closing-brace-space-after
Require a single space or disallow whitespace after the closing brace of `@if` statements.
```scss
@if ($a == 0) { }
/**
* The space after this brace */
```
This rule might have conflicts with stylelint's core [`block-closing-brace-space-after`](http://stylelint.io/user-guide/rules/block-closing-brace-space-after/) rule if the latter is set up in your `.stylelintrc` config file.
## Options
`string`: `"always-intermediate"|"never-intermediate"`
### `"always-intermediate"`
There *must always* be a single space after the closing brace of `@if` that is not the last statement in a conditional statement chain (i.e. does have `@else` right after it).
The following patterns are considered warnings:
```scss
@if ($x == 1) {
// ...
}@else {}
@if ($x == 1) {
// ...
}
@else { }
// `@if` has a space and a newline after the closing brace
@if ($x == 1) {
// ...
}
@else { }
@if ($x == 1) {
// ...
} @else { } // Two spaces
```
The following patterns are *not* considered warnings:
```scss
@if ($x == 1) {
// ...
} @else {}
a {
@if ($x == 1) {}
width: 10px;
}
@if ($x == 1) { }@include x;
@if ($x == 1) {
// ...
} @include x;
```
### `"never-intermediate"`
There *must never* be a whitespace after the closing brace of `@if` that is not the last statement in a conditional statement chain (i.e. does have `@else` right after it).
The following patterns are considered warnings:
```scss
@if ($x == 1) {
// ...
} @else {}
@if ($x == 1) {
// ...
}
@else { }
```
The following patterns are *not* considered warnings:
```scss
@if ($x == 1) {
// ...
}@else {}
a {
@if ($x == 1) {}
width: 10px;
}
@if ($x == 1) { }@include x;
@if ($x == 1) {
// ...
} @include x;
```