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:
43
node_modules/stylelint/lib/rules/value-no-vendor-prefix/README.md
generated
vendored
Normal file
43
node_modules/stylelint/lib/rules/value-no-vendor-prefix/README.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# value-no-vendor-prefix
|
||||
|
||||
Disallow vendor prefixes for values.
|
||||
|
||||
```css
|
||||
a { display: -webkit-flex; }
|
||||
/** ↑
|
||||
* These prefixes */
|
||||
```
|
||||
|
||||
This rule will only warn for prefixed *standard* values, and not for prefixed *proprietary* or *unknown* ones.
|
||||
|
||||
## Options
|
||||
|
||||
### `true`
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a { display: -webkit-flex; }
|
||||
```
|
||||
|
||||
```css
|
||||
a { max-width: -moz-max-content; }
|
||||
```
|
||||
|
||||
```css
|
||||
a { background: -webkit-linear-gradient(bottom, #000, #fff); }
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a { display: flex; }
|
||||
```
|
||||
|
||||
```css
|
||||
a { max-width: max-content; }
|
||||
```
|
||||
|
||||
```css
|
||||
a { background: linear-gradient(bottom, #000, #fff); }
|
||||
```
|
61
node_modules/stylelint/lib/rules/value-no-vendor-prefix/index.js
generated
vendored
Normal file
61
node_modules/stylelint/lib/rules/value-no-vendor-prefix/index.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict"
|
||||
|
||||
const isAutoprefixable = require("../../utils/isAutoprefixable")
|
||||
const isStandardSyntaxDeclaration = require("../../utils/isStandardSyntaxDeclaration")
|
||||
const isStandardSyntaxProperty = require("../../utils/isStandardSyntaxProperty")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
const styleSearch = require("style-search")
|
||||
|
||||
const ruleName = "value-no-vendor-prefix"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
rejected: value => `Unexpected vendor-prefix "${value}"`,
|
||||
})
|
||||
|
||||
const valuePrefixes = [
|
||||
"-webkit-",
|
||||
"-moz-",
|
||||
"-ms-",
|
||||
"-o-",
|
||||
]
|
||||
|
||||
const rule = function (actual) {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, { actual })
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkDecls(decl => {
|
||||
if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop) || decl.value[0] !== "-") {
|
||||
return
|
||||
}
|
||||
|
||||
const prop = decl.prop,
|
||||
value = decl.value
|
||||
|
||||
// Search the full declaration in order to get an accurate index
|
||||
|
||||
styleSearch({ source: value.toLowerCase(), target: valuePrefixes }, match => {
|
||||
const fullIdentifier = /^(-[a-z-]+)\b/i.exec(value.slice(match.startIndex))[1]
|
||||
if (!isAutoprefixable.propertyValue(prop, fullIdentifier)) {
|
||||
return
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.rejected(fullIdentifier),
|
||||
node: decl,
|
||||
index: prop.length + (decl.raws.between || "").length + match.startIndex,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user