mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-13 21:33:32 -06:00
Initial commit
This commit is contained in:
57
node_modules/stylelint/lib/rules/at-rule-whitelist/README.md
generated
vendored
Normal file
57
node_modules/stylelint/lib/rules/at-rule-whitelist/README.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# at-rule-whitelist
|
||||
|
||||
Specify a whitelist of allowed at-rules.
|
||||
|
||||
```css
|
||||
@keyframes name {}
|
||||
/** ↑
|
||||
* At-rules like this */
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
`array|string`: `["array", "of", "unprefixed", "at-rules"]|"at-rule"`
|
||||
|
||||
Given:
|
||||
|
||||
```js
|
||||
["extend", "keyframes"]
|
||||
```
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
@import "path/to/file.css";
|
||||
```
|
||||
|
||||
```css
|
||||
@media screen and (max-width: 1024px) {
|
||||
a { display: none; }
|
||||
}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a { @extend placeholder; }
|
||||
```
|
||||
|
||||
```css
|
||||
@keyframes name {
|
||||
from { top: 10px; }
|
||||
to { top: 20px; }
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
@KEYFRAMES name {
|
||||
from { top: 10px; }
|
||||
to { top: 20px; }
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
@-moz-keyframes name {
|
||||
from { top: 10px; }
|
||||
to { top: 20px; }
|
||||
}
|
48
node_modules/stylelint/lib/rules/at-rule-whitelist/index.js
generated
vendored
Normal file
48
node_modules/stylelint/lib/rules/at-rule-whitelist/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict"
|
||||
|
||||
const _ = require("lodash")
|
||||
const postcss = require("postcss")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
|
||||
const ruleName = "at-rule-whitelist"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
rejected: name => `Unexpected at-rule "${name}"`,
|
||||
})
|
||||
|
||||
const rule = function (whitelistInput) {
|
||||
// To allow for just a string as a parameter (not only arrays of strings)
|
||||
const whitelist = [].concat(whitelistInput)
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, {
|
||||
actual: whitelist,
|
||||
possible: [_.isString],
|
||||
})
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkAtRules(atRule => {
|
||||
const name = atRule.name
|
||||
|
||||
if (whitelist.indexOf(postcss.vendor.unprefixed(name).toLowerCase()) !== -1) {
|
||||
return
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.rejected(name),
|
||||
node: atRule,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.primaryOptionArray = true
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user