mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-14 05:43:33 -06:00
Initial commit
This commit is contained in:
56
node_modules/stylelint/lib/rules/property-blacklist/README.md
generated
vendored
Normal file
56
node_modules/stylelint/lib/rules/property-blacklist/README.md
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# property-blacklist
|
||||
|
||||
Specify a blacklist of disallowed properties.
|
||||
|
||||
```css
|
||||
a { text-rendering: optimizeLegibility; }
|
||||
/** ↑
|
||||
* These properties */
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
`array|string`: `["array", "of", "unprefixed", "properties" or "regex"]|"property"|"/regex/"`
|
||||
|
||||
If a string is surrounded with `"/"` (e.g. `"/^background/"`), it is interpreted as a regular expression. This allows, for example, easy targeting of shorthands: `/^background/` will match `background`, `background-size`, `background-color`, etc.
|
||||
|
||||
Given:
|
||||
|
||||
```js
|
||||
[ "text-rendering", "animation", "/^background/" ]
|
||||
```
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a { text-rendering: optimizeLegibility; }
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
animation: my-animation 2s;
|
||||
color: pink;
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a { -webkit-animation: my-animation 2s; }
|
||||
```
|
||||
|
||||
```css
|
||||
a { background: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a { background-size: cover; }
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a { color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
a { no-background: sure; }
|
||||
```
|
55
node_modules/stylelint/lib/rules/property-blacklist/index.js
generated
vendored
Normal file
55
node_modules/stylelint/lib/rules/property-blacklist/index.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict"
|
||||
|
||||
const isCustomProperty = require("../../utils/isCustomProperty")
|
||||
const isStandardSyntaxProperty = require("../../utils/isStandardSyntaxProperty")
|
||||
const matchesStringOrRegExp = require("../../utils/matchesStringOrRegExp")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
const _ = require("lodash")
|
||||
const postcss = require("postcss")
|
||||
|
||||
const ruleName = "property-blacklist"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
rejected: property => `Unexpected property "${property}"`,
|
||||
})
|
||||
|
||||
const rule = function (blacklist) {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, {
|
||||
actual: blacklist,
|
||||
possible: [_.isString],
|
||||
})
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkDecls(decl => {
|
||||
const prop = decl.prop
|
||||
|
||||
if (!isStandardSyntaxProperty(prop)) {
|
||||
return
|
||||
}
|
||||
if (isCustomProperty(prop)) {
|
||||
return
|
||||
}
|
||||
if (!matchesStringOrRegExp(postcss.vendor.unprefixed(prop), blacklist)) {
|
||||
return
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.rejected(prop),
|
||||
node: decl,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.primaryOptionArray = true
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user