mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-13 13:23:32 -06:00
Initial commit
This commit is contained in:
107
node_modules/stylelint/lib/rules/declaration-block-semicolon-newline-before/README.md
generated
vendored
Normal file
107
node_modules/stylelint/lib/rules/declaration-block-semicolon-newline-before/README.md
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
# declaration-block-semicolon-newline-before
|
||||
|
||||
Require a newline or disallow whitespace before the semicolons of declaration blocks.
|
||||
|
||||
```css
|
||||
a {
|
||||
color: pink
|
||||
; top: 0;
|
||||
} ↑
|
||||
/** ↑
|
||||
* The newline before this semicolon */
|
||||
```
|
||||
|
||||
This rule ignores semicolons that are preceded by Less mixins.
|
||||
|
||||
## Options
|
||||
|
||||
`string`: `"always"|"always-multi-line"|"never-multi-line"`
|
||||
|
||||
### `"always"`
|
||||
|
||||
There *must always* be a newline before the semicolons.
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
color: pink; top: 0;
|
||||
}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a { color: pink
|
||||
; }
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
color: pink
|
||||
; top: 0;
|
||||
}
|
||||
```
|
||||
|
||||
### `"always-multi-line"`
|
||||
|
||||
There *must always* be a newline before the semicolons in multi-line rules.
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a {
|
||||
color: pink; top: 0;
|
||||
}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a { color: pink; top: 0; }
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
color: pink
|
||||
; top: 0;
|
||||
}
|
||||
```
|
||||
|
||||
### `"never-multi-line"`
|
||||
|
||||
There *must never* be whitespace before the semicolons in multi-line rules.
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a {
|
||||
color: pink
|
||||
; top: 0;
|
||||
}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a { color: pink; top: 0; }
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
color: pink;
|
||||
top: 0;
|
||||
}
|
||||
```
|
64
node_modules/stylelint/lib/rules/declaration-block-semicolon-newline-before/index.js
generated
vendored
Normal file
64
node_modules/stylelint/lib/rules/declaration-block-semicolon-newline-before/index.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict"
|
||||
|
||||
const blockString = require("../../utils/blockString")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
const whitespaceChecker = require("../../utils/whitespaceChecker")
|
||||
|
||||
const ruleName = "declaration-block-semicolon-newline-before"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
expectedBefore: () => "Expected newline before \";\"",
|
||||
expectedBeforeMultiLine: () => "Expected newline before \";\" in a multi-line declaration block",
|
||||
rejectedBeforeMultiLine: () => "Unexpected whitespace before \";\" in a multi-line declaration block",
|
||||
})
|
||||
|
||||
const rule = function (expectation) {
|
||||
const checker = whitespaceChecker("newline", expectation, messages)
|
||||
|
||||
return function (root, result) {
|
||||
const validOptions = validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: [
|
||||
"always",
|
||||
"always-multi-line",
|
||||
"never-multi-line",
|
||||
],
|
||||
})
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkDecls(function (decl) {
|
||||
const parentRule = decl.parent
|
||||
if (
|
||||
!parentRule.raws.semicolon
|
||||
&& parentRule.last === decl
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const declString = decl.toString()
|
||||
|
||||
checker.beforeAllowingIndentation({
|
||||
source: declString,
|
||||
index: declString.length,
|
||||
lineCheckStr: blockString(parentRule),
|
||||
err: m => {
|
||||
report({
|
||||
message: m,
|
||||
node: decl,
|
||||
index: decl.toString().length - 1,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user