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:
35
node_modules/stylelint/lib/rules/no-invalid-double-slash-comments/README.md
generated
vendored
Normal file
35
node_modules/stylelint/lib/rules/no-invalid-double-slash-comments/README.md
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# no-invalid-double-slash-comments
|
||||
|
||||
Disallow double-slash comments (`//...`) which are not supported by CSS and [could lead to unexpected results](https://stackoverflow.com/a/20192639/130652).
|
||||
|
||||
```css
|
||||
a { // color: pink; }
|
||||
/** ↑
|
||||
* This comment */
|
||||
```
|
||||
|
||||
If you are using a preprocessor that allows `//` single-line comments (e.g. Sass, Less, Stylus), this rule will not complain about those. They are compiled into standard CSS comments by your preprocessor, so stylelint will consider them valid. This rule only complains about the lesser-known method of using `//` to "comment out" a single line of code in regular CSS. (If you didn't know this was possible, have a look at ["Single Line Comments (//) in CSS"](http://www.xanthir.com/b4U10)).
|
||||
|
||||
## Options
|
||||
|
||||
### `true`
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```css
|
||||
a { // color: pink; }
|
||||
```
|
||||
|
||||
```css
|
||||
// a { color: pink; }
|
||||
```
|
||||
|
||||
The following patterns are *not* considered warnings:
|
||||
|
||||
```css
|
||||
a { /* color: pink; */ }
|
||||
```
|
||||
|
||||
```css
|
||||
/* a { color: pink; } */
|
||||
```
|
47
node_modules/stylelint/lib/rules/no-invalid-double-slash-comments/index.js
generated
vendored
Normal file
47
node_modules/stylelint/lib/rules/no-invalid-double-slash-comments/index.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict"
|
||||
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
|
||||
const ruleName = "no-invalid-double-slash-comments"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
rejected: "Unexpected double-slash CSS comment",
|
||||
})
|
||||
|
||||
const rule = function (actual) {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, { actual })
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkDecls(decl => {
|
||||
if (decl.prop.indexOf("//") === 0) {
|
||||
report({
|
||||
message: messages.rejected,
|
||||
node: decl,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
}
|
||||
})
|
||||
root.walkRules(rule => {
|
||||
rule.selectors.forEach(selector => {
|
||||
if (selector.indexOf("//") === 0) {
|
||||
report({
|
||||
message: messages.rejected,
|
||||
node: rule,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user