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:
31
node_modules/stylelint/lib/rules/custom-property-no-outside-root/README.md
generated
vendored
Normal file
31
node_modules/stylelint/lib/rules/custom-property-no-outside-root/README.md
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# custom-property-no-outside-root
|
||||
|
||||
***Deprecated: See [CHANGELOG](../../../CHANGELOG.md).***
|
||||
|
||||
Disallow custom properties outside of `:root` rules.
|
||||
|
||||
```css
|
||||
a { --foo: 1px; }
|
||||
/** ↑ ↑
|
||||
* These selectors and these types of custom properties */
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### `true`
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a { --foo: 1px; }
|
||||
```
|
||||
|
||||
```css
|
||||
:root, a { --foo: 1px; }
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
:root { --foo: 1px; }
|
||||
```
|
51
node_modules/stylelint/lib/rules/custom-property-no-outside-root/index.js
generated
vendored
Normal file
51
node_modules/stylelint/lib/rules/custom-property-no-outside-root/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict"
|
||||
|
||||
const isCustomProperty = require("../../utils/isCustomProperty")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
|
||||
const ruleName = "custom-property-no-outside-root"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
rejected: "Unexpected custom property",
|
||||
})
|
||||
|
||||
const rule = function (actual) {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, { actual })
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
result.warn((
|
||||
`'${ruleName}' has been deprecated and in 8.0 will be removed.`
|
||||
), {
|
||||
stylelintType: "deprecation",
|
||||
stylelintReference: `https://stylelint.io/user-guide/rules/${ruleName}/`,
|
||||
})
|
||||
|
||||
root.walkRules(rule => {
|
||||
// Ignore rules whose selector is just `:root`
|
||||
if (rule.selector.toLowerCase().trim() === ":root") {
|
||||
return
|
||||
}
|
||||
|
||||
rule.walkDecls(decl => {
|
||||
if (!isCustomProperty(decl.prop)) {
|
||||
return
|
||||
}
|
||||
report({
|
||||
message: messages.rejected,
|
||||
node: decl,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user