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:
78
node_modules/stylelint/lib/rules/block-no-single-line/README.md
generated
vendored
Normal file
78
node_modules/stylelint/lib/rules/block-no-single-line/README.md
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
# block-no-single-line
|
||||
|
||||
***Deprecated: instead use the [block-opening-brace-newline-after](../block-opening-brace-newline-after/README.md#always) and [block-closing-brace-newline-before](../block-closing-brace-newline-before/README.md#always) rules with the option `"always"`. See [the FAQs for an example](../../../docs/user-guide/faq.md#how-do-i-disallow-single-line-blocks).***
|
||||
|
||||
Disallow single-line blocks.
|
||||
|
||||
```css
|
||||
a { color: pink; top: 0; }
|
||||
/** ↑ ↑
|
||||
* Declaration blocks like this */
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### `true`
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a,
|
||||
b { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a { color: pink; top: 1px; }
|
||||
```
|
||||
|
||||
```css
|
||||
@media print { a { color: pink; } }
|
||||
```
|
||||
|
||||
```css
|
||||
@media print {
|
||||
a { color: pink; }
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
color: red;
|
||||
@media print { color: pink; }
|
||||
}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a {
|
||||
color: pink;
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a, b {
|
||||
color: pink;
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
@media print {
|
||||
a {
|
||||
color: pink;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
color: red;
|
||||
@media print {
|
||||
color: pink;
|
||||
}
|
||||
}
|
||||
```
|
61
node_modules/stylelint/lib/rules/block-no-single-line/index.js
generated
vendored
Normal file
61
node_modules/stylelint/lib/rules/block-no-single-line/index.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict"
|
||||
|
||||
const beforeBlockString = require("../../utils/beforeBlockString")
|
||||
const blockString = require("../../utils/blockString")
|
||||
const hasBlock = require("../../utils/hasBlock")
|
||||
const hasEmptyBlock = require("../../utils/hasEmptyBlock")
|
||||
const isSingleLineString = require("../../utils/isSingleLineString")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
|
||||
const ruleName = "block-no-single-line"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
rejected: "Unexpected single-line block",
|
||||
})
|
||||
|
||||
const rule = function (actual) {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, { actual })
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
result.warn((
|
||||
"'block-no-single-line' has been deprecated and in 8.0 will be removed. " +
|
||||
"Instead use 'block-opening-brace-newline-after' and 'block-closing-brace-newline-before' with the \"always\" option."
|
||||
), {
|
||||
stylelintType: "deprecation",
|
||||
stylelintReference: "https://stylelint.io/user-guide/rules/block-no-single-line/",
|
||||
})
|
||||
|
||||
// Check both kinds of statements: rules and at-rules
|
||||
root.walkRules(check)
|
||||
root.walkAtRules(check)
|
||||
|
||||
function check(statement) {
|
||||
if (
|
||||
!hasBlock(statement)
|
||||
|| hasEmptyBlock(statement)
|
||||
) {
|
||||
return
|
||||
}
|
||||
if (!isSingleLineString(blockString(statement))) {
|
||||
return
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.rejected,
|
||||
node: statement,
|
||||
index: beforeBlockString(statement, { noRawBefore: true }).length,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user