mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-13 21:33:32 -06:00
Initial commit
This commit is contained in:
104
node_modules/stylelint/lib/rules/selector-list-comma-newline-after/README.md
generated
vendored
Normal file
104
node_modules/stylelint/lib/rules/selector-list-comma-newline-after/README.md
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
# selector-list-comma-newline-after
|
||||
|
||||
Require a newline or disallow whitespace after the commas of selector lists.
|
||||
|
||||
```css
|
||||
a,
|
||||
b↑{ color: pink; }
|
||||
/** ↑
|
||||
* The newline after this comma */
|
||||
```
|
||||
|
||||
End-of-line comments are allowed one space after the comma.
|
||||
|
||||
```css
|
||||
a, /* comment */
|
||||
b { color: pink; }
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
`string`: `"always"|"always-multi-line"|"never-multi-line"`
|
||||
|
||||
### `"always"`
|
||||
|
||||
There *must always* be a newline after the commas.
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a, b { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a
|
||||
, b { color: pink; }
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a,
|
||||
b { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a
|
||||
,
|
||||
b { color: pink; }
|
||||
```
|
||||
|
||||
### `"always-multi-line"`
|
||||
|
||||
There *must always* be a newline after the commas in multi-line selector lists.
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a
|
||||
, b { color: pink; }
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a, b { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a,
|
||||
b { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a
|
||||
,
|
||||
b { color: pink; }
|
||||
```
|
||||
|
||||
### `"never-multi-line"`
|
||||
|
||||
There *must never* be whitespace after the commas in multi-line selector lists.
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a
|
||||
, b { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a,
|
||||
b { color: pink; }
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a,b { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a
|
||||
,b { color: pink; }
|
||||
```
|
75
node_modules/stylelint/lib/rules/selector-list-comma-newline-after/index.js
generated
vendored
Normal file
75
node_modules/stylelint/lib/rules/selector-list-comma-newline-after/index.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict"
|
||||
|
||||
const isStandardSyntaxRule = require("../../utils/isStandardSyntaxRule")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
const whitespaceChecker = require("../../utils/whitespaceChecker")
|
||||
const styleSearch = require("style-search")
|
||||
|
||||
const ruleName = "selector-list-comma-newline-after"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
expectedAfter: () => "Expected newline after \",\"",
|
||||
expectedAfterMultiLine: () => "Expected newline after \",\" in a multi-line list",
|
||||
rejectedAfterMultiLine: () => "Unexpected whitespace after \",\" in a multi-line list",
|
||||
})
|
||||
|
||||
const rule = function (expectation) {
|
||||
const checker = whitespaceChecker("newline", expectation, messages)
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: [
|
||||
"always",
|
||||
"always-multi-line",
|
||||
"never-multi-line",
|
||||
],
|
||||
})
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkRules(rule => {
|
||||
if (!isStandardSyntaxRule(rule)) {
|
||||
return
|
||||
}
|
||||
// Get raw selector so we can allow end-of-line comments, e.g.
|
||||
// a, /* comment */
|
||||
// b {}
|
||||
const selector = rule.raws.selector ? rule.raws.selector.raw : rule.selector
|
||||
styleSearch({
|
||||
source: selector,
|
||||
target: ",",
|
||||
functionArguments: "skip",
|
||||
}, match => {
|
||||
const nextThreeChars = selector.substr(match.endIndex, 3)
|
||||
|
||||
// If there's a // comment, that means there has to be a newline
|
||||
// ending the comment so we're fine
|
||||
if (nextThreeChars === " //") {
|
||||
return
|
||||
}
|
||||
|
||||
// If there is a space and then a comment begins, look for the newline
|
||||
// after that comment
|
||||
const indextoCheckAfter = nextThreeChars === " /*" ? selector.indexOf("*/", match.endIndex) + 1 : match.startIndex
|
||||
checker.afterOneOnly({
|
||||
source: selector,
|
||||
index: indextoCheckAfter,
|
||||
err: m => report({
|
||||
message: m,
|
||||
node: rule,
|
||||
index: match.startIndex,
|
||||
result,
|
||||
ruleName,
|
||||
}),
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user