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:
108
node_modules/stylelint/lib/rules/value-list-max-empty-lines/README.md
generated
vendored
Normal file
108
node_modules/stylelint/lib/rules/value-list-max-empty-lines/README.md
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
# value-list-max-empty-lines
|
||||
|
||||
Limit the number of adjacent empty lines within value lists.
|
||||
|
||||
```css
|
||||
a {
|
||||
box-shadow:
|
||||
inset 0 2px 0 #dcffa6,
|
||||
/* ← */
|
||||
0 2px 5px #000; /* ↑ */
|
||||
} /* ↑ */
|
||||
/** ↑
|
||||
* This empty line */
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
`int`: Maximum number of empty lines.
|
||||
|
||||
For example, with `0`:
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a {
|
||||
padding: 10px
|
||||
|
||||
10px
|
||||
10px
|
||||
10px
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
padding:
|
||||
10px
|
||||
10px
|
||||
10px
|
||||
|
||||
10px
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
box-shadow: inset 0 2px 0 #dcffa6,
|
||||
|
||||
0 2px 5px #000;
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
box-shadow:
|
||||
inset 0 2px 0 #dcffa6,
|
||||
|
||||
0 2px 5px #000;
|
||||
}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a {
|
||||
padding: 10px 10px 10px 10px
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
padding: 10px
|
||||
10px
|
||||
10px
|
||||
10px
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
padding:
|
||||
10px
|
||||
10px
|
||||
10px
|
||||
10px
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
box-shadow: inset 0 2px 0 #dcffa6, 0 2px 5px #000;
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
box-shadow: inset 0 2px 0 #dcffa6,
|
||||
0 2px 5px #000;
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
box-shadow:
|
||||
inset 0 2px 0 #dcffa6,
|
||||
0 2px 5px #000;
|
||||
}
|
||||
```
|
55
node_modules/stylelint/lib/rules/value-list-max-empty-lines/index.js
generated
vendored
Normal file
55
node_modules/stylelint/lib/rules/value-list-max-empty-lines/index.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict"
|
||||
|
||||
const _ = require("lodash")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
const styleSearch = require("style-search")
|
||||
|
||||
const ruleName = "value-list-max-empty-lines"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
expected: max => `Expected no more than ${max} empty line(s)`,
|
||||
})
|
||||
|
||||
const rule = function (max) {
|
||||
const maxAdjacentNewlines = max + 1
|
||||
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, {
|
||||
actual: max,
|
||||
possible: _.isNumber,
|
||||
})
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkDecls(decl => {
|
||||
const value = decl.value
|
||||
const repeatLFNewLines = _.repeat("\n", maxAdjacentNewlines)
|
||||
const repeatCRLFNewLines = _.repeat("\r\n", maxAdjacentNewlines)
|
||||
|
||||
styleSearch({ source: value, target: "\n" }, match => {
|
||||
if (value.substr(match.startIndex + 1, maxAdjacentNewlines) === repeatLFNewLines || value.substr(match.startIndex + 1, maxAdjacentNewlines * 2) === repeatCRLFNewLines) {
|
||||
// Put index at `\r` if it's CRLF, otherwise leave it at `\n`
|
||||
let index = match.startIndex
|
||||
if (value[index - 1] === "\r") {
|
||||
index -= 1
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.expected(max),
|
||||
node: decl,
|
||||
index,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user