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:
65
node_modules/stylelint/lib/rules/at-rule-no-unknown/README.md
generated
vendored
Normal file
65
node_modules/stylelint/lib/rules/at-rule-no-unknown/README.md
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# at-rule-no-unknown
|
||||
|
||||
Disallow unknown at-rules.
|
||||
|
||||
```css
|
||||
@unknown (max-width: 960px) {}
|
||||
/** ↑
|
||||
* At-rules like this */
|
||||
```
|
||||
|
||||
This rule considers at-rules defined in the CSS Specifications, up to and including Editor's Drafts, to be known.
|
||||
|
||||
## Options
|
||||
|
||||
### `true`
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
@unknown {}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
@charset "UTF-8";
|
||||
```
|
||||
|
||||
```css
|
||||
@CHARSET "UTF-8";
|
||||
```
|
||||
|
||||
```css
|
||||
@media (max-width: 960px) {}
|
||||
```
|
||||
|
||||
```css
|
||||
@font-feature-values Font One {
|
||||
@styleset {}
|
||||
}
|
||||
```
|
||||
|
||||
## Optional secondary options
|
||||
|
||||
### `ignoreAtRules: ["/regex/", "string"]`
|
||||
|
||||
Given:
|
||||
|
||||
```js
|
||||
["/^my-/", "custom"]
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
@my-at-rule "x.css";
|
||||
```
|
||||
|
||||
```css
|
||||
@my-other-at-rule {}
|
||||
```
|
||||
|
||||
```css
|
||||
@custom {}
|
||||
```
|
58
node_modules/stylelint/lib/rules/at-rule-no-unknown/index.js
generated
vendored
Normal file
58
node_modules/stylelint/lib/rules/at-rule-no-unknown/index.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict"
|
||||
|
||||
const _ = require("lodash")
|
||||
const keywordSets = require("../../reference/keywordSets")
|
||||
const optionsMatches = require("../../utils/optionsMatches")
|
||||
const postcss = require("postcss")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
|
||||
const ruleName = "at-rule-no-unknown"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
rejected: atRule => `Unexpected unknown at-rule "${atRule}"`,
|
||||
})
|
||||
|
||||
const rule = function (actual, options) {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, { actual }, {
|
||||
actual: options,
|
||||
possible: {
|
||||
ignoreAtRules: [_.isString],
|
||||
},
|
||||
optional: true,
|
||||
})
|
||||
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkAtRules(atRule => {
|
||||
const name = atRule.name
|
||||
|
||||
// Return early if at-rule is to be ignored
|
||||
if (optionsMatches(options, "ignoreAtRules", atRule.name)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (
|
||||
postcss.vendor.prefix(name)
|
||||
|| keywordSets.atRules.has(name.toLowerCase())
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.rejected(`@${name}`),
|
||||
node: atRule,
|
||||
ruleName,
|
||||
result,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user