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:
45
node_modules/stylelint/lib/rules/function-url-no-scheme-relative/README.md
generated
vendored
Normal file
45
node_modules/stylelint/lib/rules/function-url-no-scheme-relative/README.md
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# function-url-no-scheme-relative
|
||||
|
||||
Disallow scheme-relative urls.
|
||||
|
||||
```css
|
||||
a { background-image: url('//www.google.com/file.jpg'); }
|
||||
/** ↑
|
||||
* This scheme-relative url */
|
||||
```
|
||||
|
||||
A [scheme-relative url](https://url.spec.whatwg.org/#syntax-url-scheme-relative) is a url that begins with `//` followed by a host.
|
||||
|
||||
This rule ignores url arguments that are variables (`$sass`, `@less`, `--custom-property`).
|
||||
|
||||
## Options
|
||||
|
||||
### `true`
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a {
|
||||
background: url("//www.google.com/file.jpg");
|
||||
}
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a {
|
||||
background: url("../file.jpg");
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
background: url("http://www.google.com/file.jpg");
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
a {
|
||||
background: url("/path/to/file.jpg");
|
||||
}
|
||||
```
|
45
node_modules/stylelint/lib/rules/function-url-no-scheme-relative/index.js
generated
vendored
Normal file
45
node_modules/stylelint/lib/rules/function-url-no-scheme-relative/index.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict"
|
||||
|
||||
const functionArgumentsSearch = require("../../utils/functionArgumentsSearch")
|
||||
const isStandardSyntaxUrl = require("../../utils/isStandardSyntaxUrl")
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
const _ = require("lodash")
|
||||
|
||||
const ruleName = "function-url-no-scheme-relative"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
rejected: "Unexpected scheme-relative url",
|
||||
})
|
||||
|
||||
const rule = function (actual) {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, { actual })
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkDecls(function (decl) {
|
||||
functionArgumentsSearch(decl.toString().toLowerCase(), "url", (args, index) => {
|
||||
const url = _.trim(args, " '\"")
|
||||
|
||||
if (!isStandardSyntaxUrl(url) || url.indexOf("//") !== 0) {
|
||||
return
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.rejected,
|
||||
node: decl,
|
||||
index,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user