mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-13 05:13:33 -06:00
Initial commit
This commit is contained in:
5
node_modules/stylelint-scss/docs/examples/README.md
generated
vendored
Normal file
5
node_modules/stylelint-scss/docs/examples/README.md
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# Example configs
|
||||
|
||||
This dir contains examples of `.stylelintrc` configuration file for several use cases.
|
||||
|
||||
* [Rules for `@if`/`@else` statements](./if-else.md)
|
149
node_modules/stylelint-scss/docs/examples/if-else.md
generated
vendored
Normal file
149
node_modules/stylelint-scss/docs/examples/if-else.md
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
# `@if`/`@else`
|
||||
|
||||
A stylesheet author might want to treat `@if` and `@else` in a special manner, for example `@else` should be on the same line as its `@if`'s closing brace while all the other blocks and at-rules has to have newline after their closing brace. stylelint-scss has some rules for this, but from the core stylelint's point of view, `@if` and `@else` SCSS statements are pretty much regular at-rules, so they comply to corresponding `at-rule-...` and `block-...` rules. Below are some configurations that might help you achieve the needed patterns.
|
||||
|
||||
---
|
||||
|
||||
**Config 1**: `@else` is on the same line as the preceding `@if`/`@else`'s `}`, space between them. Empty line before all at-rules (except `@else`), space before `{`, newline after all `}` except `@if`'s and `@else`'s.
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
"stylelint-scss"
|
||||
],
|
||||
"rules": {
|
||||
"at-rule-empty-line-before": [
|
||||
"always", {
|
||||
"ignoreAtRules": [ "else" ]
|
||||
}
|
||||
],
|
||||
"block-opening-brace-space-before": "always",
|
||||
"block-closing-brace-newline-after": [
|
||||
"always", {
|
||||
"ignoreAtRules": [ "if", "else" ]
|
||||
}
|
||||
],
|
||||
"at-rule-name-space-after": "always",
|
||||
"rule-non-nested-empty-line-before": "always",
|
||||
|
||||
"scss/at-else-closing-brace-newline-after": "always-last-in-chain",
|
||||
"scss/at-else-closing-brace-space-after": "always-intermediate",
|
||||
"scss/at-else-closing-brace-space-after": "always-intermediate",
|
||||
"scss/at-if-closing-brace-newline-after": "always-last-in-chain",
|
||||
"scss/at-if-closing-brace-space-after": "always-intermediate"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This code is considered **valid**
|
||||
```scss
|
||||
@if {
|
||||
// ...
|
||||
}
|
||||
|
||||
a {}
|
||||
|
||||
@if {
|
||||
// ...
|
||||
} @else {
|
||||
// ...
|
||||
}
|
||||
|
||||
a {}
|
||||
|
||||
@if {
|
||||
// ...
|
||||
} @else if {
|
||||
// ...
|
||||
} @else {
|
||||
// ...
|
||||
}
|
||||
|
||||
@if {
|
||||
// ...
|
||||
} @else
|
||||
if {
|
||||
// ...
|
||||
} @else {
|
||||
// ...
|
||||
}
|
||||
|
||||
a {}
|
||||
```
|
||||
|
||||
These patterns are considered **non-valid**:
|
||||
|
||||
```scss
|
||||
@if {
|
||||
// ...
|
||||
} a {}
|
||||
```
|
||||
```scss
|
||||
@if {
|
||||
// ...
|
||||
}@else {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
```scss
|
||||
@if {
|
||||
// ...
|
||||
} @else if{
|
||||
// ...
|
||||
} @else {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
```scss
|
||||
@if {
|
||||
// ...
|
||||
} @else if{
|
||||
// ...
|
||||
} @else {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Config 2**: `@else` is on a newline, no empty line before it.
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
"stylelint-scss"
|
||||
],
|
||||
"rules": {
|
||||
"at-rule-empty-line-before": [
|
||||
"always", {
|
||||
"ignoreAtRules": [ "else" ]
|
||||
}
|
||||
],
|
||||
"at-rule-name-space-after": "always",
|
||||
"block-opening-brace-space-before": "always",
|
||||
"block-closing-brace-newline-after": "always",
|
||||
"at-else-empty-line-before": "never"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This code is considered **valid**:
|
||||
```scss
|
||||
@if {
|
||||
// ...
|
||||
}
|
||||
@else {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
This code is considered **non-valid**:
|
||||
```scss
|
||||
@if {
|
||||
// ...
|
||||
}
|
||||
|
||||
@else {
|
||||
// ...
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user