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:
61
node_modules/stylelint/lib/rules/media-feature-range-operator-space-before/README.md
generated
vendored
Normal file
61
node_modules/stylelint/lib/rules/media-feature-range-operator-space-before/README.md
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# media-feature-range-operator-space-before
|
||||
|
||||
Require a single space or disallow whitespace before the range operator in media features.
|
||||
|
||||
```css
|
||||
@media (max-width >= 600px) {}
|
||||
/** ↑
|
||||
* The space before this */
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
`string`: `"always"|"never"`
|
||||
|
||||
### `"always"`
|
||||
|
||||
There *must always* be a single space before the range operator.
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
@media (max-width>=600px) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media (max-width>= 600px) {}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
@media (max-width >=600px) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media (max-width >= 600px) {}
|
||||
```
|
||||
|
||||
### `"never"`
|
||||
|
||||
There *must never* be whitespace before the range operator.
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
@media (max-width >=600px) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media (max-width >= 600px) {}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
@media (max-width>=600px) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media (max-width>= 600px) {}
|
||||
```
|
57
node_modules/stylelint/lib/rules/media-feature-range-operator-space-before/index.js
generated
vendored
Normal file
57
node_modules/stylelint/lib/rules/media-feature-range-operator-space-before/index.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict"
|
||||
|
||||
const atRuleParamIndex = require("../../utils/atRuleParamIndex")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
const whitespaceChecker = require("../../utils/whitespaceChecker")
|
||||
const findMediaOperator = require("../findMediaOperator")
|
||||
|
||||
const ruleName = "media-feature-range-operator-space-before"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
expectedBefore: () => "Expected single space before range operator",
|
||||
rejectedBefore: () => "Unexpected whitespace before range operator",
|
||||
})
|
||||
|
||||
const rule = function (expectation) {
|
||||
const checker = whitespaceChecker("space", expectation, messages)
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: [
|
||||
"always",
|
||||
"never",
|
||||
],
|
||||
})
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkAtRules(/^media$/i, atRule => {
|
||||
findMediaOperator(atRule, checkBeforeOperator)
|
||||
})
|
||||
|
||||
function checkBeforeOperator(match, params, node) {
|
||||
// The extra `+ 1` is because the match itself contains
|
||||
// the character before the operator
|
||||
checker.before({
|
||||
source: params,
|
||||
index: match.index + 1,
|
||||
err: m => {
|
||||
report({
|
||||
message: m,
|
||||
node,
|
||||
index: match.index + atRuleParamIndex(node),
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user