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:
37
node_modules/stylelint/lib/rules/block-no-empty/README.md
generated
vendored
Normal file
37
node_modules/stylelint/lib/rules/block-no-empty/README.md
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# block-no-empty
|
||||
|
||||
Disallow empty blocks.
|
||||
|
||||
```css
|
||||
a { }
|
||||
/** ↑
|
||||
* Blocks like this */
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### `true`
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a {}
|
||||
```
|
||||
|
||||
```css
|
||||
a { }
|
||||
```
|
||||
|
||||
```css
|
||||
@media print { a {} }
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
@media print { a { color: pink; } }
|
||||
```
|
51
node_modules/stylelint/lib/rules/block-no-empty/index.js
generated
vendored
Normal file
51
node_modules/stylelint/lib/rules/block-no-empty/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict"
|
||||
|
||||
const beforeBlockString = require("../../utils/beforeBlockString")
|
||||
const hasEmptyBlock = require("../../utils/hasEmptyBlock")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
|
||||
const ruleName = "block-no-empty"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
rejected: "Unexpected empty block",
|
||||
})
|
||||
|
||||
const rule = function (actual) {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, { actual })
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check both kinds of statements: rules and at-rules
|
||||
root.walkRules(check)
|
||||
root.walkAtRules(check)
|
||||
|
||||
function check(statement) {
|
||||
if (!hasEmptyBlock(statement)) {
|
||||
return
|
||||
}
|
||||
|
||||
let index = beforeBlockString(statement, { noRawBefore: true }).length
|
||||
|
||||
// For empty blocks when using SugarSS parser
|
||||
if (statement.raws.between === undefined) {
|
||||
index--
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.rejected,
|
||||
node: statement,
|
||||
index,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user