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:
75
node_modules/stylelint/lib/rules/media-feature-name-case/README.md
generated
vendored
Normal file
75
node_modules/stylelint/lib/rules/media-feature-name-case/README.md
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
# media-feature-name-case
|
||||
|
||||
Specify lowercase or uppercase for media feature names.
|
||||
|
||||
```css
|
||||
@media (min-width: 700px) {}
|
||||
/** ↑
|
||||
* These media feature names */
|
||||
```
|
||||
|
||||
**Caveat:** Media feature names within a range context are currently ignored.
|
||||
|
||||
## Options
|
||||
|
||||
`string`: `"lower"|"upper"`
|
||||
|
||||
### `"lower"`
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
@media (MIN-WIDTH: 700px) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media not all and (MONOCHROME) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media (min-width: 700px) and (ORIENTATION: landscape) {}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
@media (min-width: 700px) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media not all and (monochrome) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media (min-width: 700px) and (orientation: landscape) {}
|
||||
```
|
||||
|
||||
### `"upper"`
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
@media (min-width: 700px) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media not all and (monochrome) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media (MIN-WIDTH: 700px) and (orientation: landscape) {}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
@media (MIN-WIDTH: 700px) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media not all and (MONOCHROME) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@media (MIN-WIDTH: 700px) and (ORIENTATION: landscape) {}
|
||||
```
|
61
node_modules/stylelint/lib/rules/media-feature-name-case/index.js
generated
vendored
Normal file
61
node_modules/stylelint/lib/rules/media-feature-name-case/index.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict"
|
||||
|
||||
const atRuleParamIndex = require("../../utils/atRuleParamIndex")
|
||||
const isCustomMediaQuery = require("../../utils/isCustomMediaQuery")
|
||||
const isRangeContextMediaFeature = require("../../utils/isRangeContextMediaFeature")
|
||||
const isStandardSyntaxMediaFeatureName = require("../../utils/isStandardSyntaxMediaFeatureName")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
const mediaParser = require("postcss-media-query-parser").default
|
||||
|
||||
const ruleName = "media-feature-name-case"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
expected: (actual, expected) => `Expected "${actual}" to be "${expected}"`,
|
||||
})
|
||||
|
||||
const rule = function (expectation) {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: [
|
||||
"lower",
|
||||
"upper",
|
||||
],
|
||||
})
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkAtRules(/^media$/i, atRule => {
|
||||
mediaParser(atRule.params).walk(/^media-feature$/i, mediaFeatureNode => {
|
||||
const parent = mediaFeatureNode.parent,
|
||||
sourceIndex = mediaFeatureNode.sourceIndex,
|
||||
value = mediaFeatureNode.value
|
||||
|
||||
if (isRangeContextMediaFeature(parent.value) || !isStandardSyntaxMediaFeatureName(value) || isCustomMediaQuery(value)) {
|
||||
return
|
||||
}
|
||||
|
||||
const expectedFeatureName = expectation === "lower" ? value.toLowerCase() : value.toUpperCase()
|
||||
|
||||
if (value === expectedFeatureName) {
|
||||
return
|
||||
}
|
||||
|
||||
report({
|
||||
index: atRuleParamIndex(atRule) + sourceIndex,
|
||||
message: messages.expected(value, expectedFeatureName),
|
||||
node: atRule,
|
||||
ruleName,
|
||||
result,
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user