Initial commit

This commit is contained in:
Patrick Marsceill
2017-03-09 13:16:08 -05:00
commit b7b0d0d7bf
4147 changed files with 401224 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
# at-rule-name-space-after
Require a single space after at-rule names.
```css
@media (max-width: 600px) {}
/** ↑
* The space after at-rule names */
```
## Options
`string`: `"always"|"always-single-line"`
### `"always"`
There *must always* be a single space after at-rule names.
The following patterns are considered warnings:
```css
@charset"UTF-8";
```
```css
@media(min-width: 700px) {}
```
```css
@media (min-width: 700px) {}
```
```css
@media
(min-width: 700px) {}
```
The following patterns are *not* considered warnings:
```css
@charset "UTF-8";
```
```css
@import url("x.css");
```
```css
@media (min-width: 700px) {}
```
### `"always-single-line"`
There *must always* be a single space after at-rule names in single-line declaration blocks.
The following patterns are considered warnings:
```css
@charset"UTF-8";
```
```css
@media(min-width: 700px) {}
```
```css
@media (min-width: 700px) {}
```
The following patterns are *not* considered warnings:
```css
@charset "UTF-8";
```
```css
@import url("x.css");
```
```css
@media (min-width: 700px) {}
```
```css
@media
(min-width: 700px) {}
```
```css
@media(min-width: 700px) and
(orientation: portrait) {}
```
```css
@media
(min-width: 700px) and
(orientation: portrait) {}
```

View File

@@ -0,0 +1,39 @@
"use strict"
const atRuleNameSpaceChecker = require("../atRuleNameSpaceChecker")
const ruleMessages = require("../../utils/ruleMessages")
const validateOptions = require("../../utils/validateOptions")
const whitespaceChecker = require("../../utils/whitespaceChecker")
const ruleName = "at-rule-name-space-after"
const messages = ruleMessages(ruleName, {
expectedAfter: name => `Expected single space after at-rule name \"${name}\"`,
})
const rule = function (expectation) {
const checker = whitespaceChecker("space", expectation, messages)
return (root, result) => {
const validOptions = validateOptions(result, ruleName, {
actual: expectation,
possible: [
"always",
"always-single-line",
],
})
if (!validOptions) {
return
}
atRuleNameSpaceChecker({
root,
result,
locationChecker: checker.after,
checkedRuleName: ruleName,
})
}
}
rule.ruleName = ruleName
rule.messages = messages
module.exports = rule