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:
54
node_modules/stylelint/lib/rules/at-rule-semicolon-newline-after/README.md
generated
vendored
Normal file
54
node_modules/stylelint/lib/rules/at-rule-semicolon-newline-after/README.md
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# at-rule-semicolon-newline-after
|
||||
|
||||
Require a newline after the semicolon of at-rules.
|
||||
|
||||
```css
|
||||
@import url("x.css");
|
||||
@import url("y.css");
|
||||
/** ↑
|
||||
* The newline after these semicolons */
|
||||
```
|
||||
|
||||
This rule allows an end-of-line comment followed by a newline. For example:
|
||||
|
||||
```css
|
||||
@import url("x.css"); /* end-of-line comment */
|
||||
|
||||
a {}
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
`string`: `"always"`
|
||||
|
||||
### `"always"`
|
||||
|
||||
There *must always* be a newline after the semicolon.
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
@import url("x.css"); @import url("y.css");
|
||||
```
|
||||
|
||||
```css
|
||||
@import url("x.css"); a {}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
@import url("x.css");
|
||||
@import url("y.css");
|
||||
```
|
||||
|
||||
```css
|
||||
@import url("x.css"); /* end-of-line comment */
|
||||
a {}
|
||||
```
|
||||
|
||||
```css
|
||||
@import url("x.css");
|
||||
|
||||
a {}
|
||||
```
|
63
node_modules/stylelint/lib/rules/at-rule-semicolon-newline-after/index.js
generated
vendored
Normal file
63
node_modules/stylelint/lib/rules/at-rule-semicolon-newline-after/index.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict"
|
||||
|
||||
const hasBlock = require("../../utils/hasBlock")
|
||||
const nextNonCommentNode = require("../../utils/nextNonCommentNode")
|
||||
const rawNodeString = require("../../utils/rawNodeString")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
const whitespaceChecker = require("../../utils/whitespaceChecker")
|
||||
|
||||
const ruleName = "at-rule-semicolon-newline-after"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
expectedAfter: () => "Expected newline after \";\"",
|
||||
})
|
||||
|
||||
const rule = function (actual) {
|
||||
const checker = whitespaceChecker("newline", actual, messages)
|
||||
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, {
|
||||
actual,
|
||||
possible: ["always"],
|
||||
})
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkAtRules(atRule => {
|
||||
const nextNode = atRule.next()
|
||||
if (!nextNode) {
|
||||
return
|
||||
}
|
||||
if (hasBlock(atRule)) {
|
||||
return
|
||||
}
|
||||
|
||||
// Allow an end-of-line comment
|
||||
const nodeToCheck = nextNonCommentNode(nextNode)
|
||||
if (!nodeToCheck) {
|
||||
return
|
||||
}
|
||||
|
||||
checker.afterOneOnly({
|
||||
source: rawNodeString(nodeToCheck),
|
||||
index: -1,
|
||||
err: msg => {
|
||||
report({
|
||||
message: msg,
|
||||
node: atRule,
|
||||
index: atRule.toString().length + 1,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user