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,94 @@
# at-rule-name-newline-after
Require a newline after at-rule names.
```css
@media
/*↑*/ (max-width: 600px) {}
/** ↑
* The newline after this at-rule name */
```
## Options
`string`: `"always"|"always-multi-line"`
### `"always"`
There *must always* be a newline after at-rule names.
The following patterns are considered warnings:
```css
@charset "UTF-8";
```
```css
@media (min-width: 700px) and
(orientation: landscape) {}
```
The following patterns are *not* considered warnings:
```css
@charset
"UTF-8";
```
```css
@import
"x.css" screen and
(orientation:landscape);
```
```css
@media
(min-width: 700px) and (orientation: landscape) {}
```
```css
@media
(min-width: 700px) and
(orientation: landscape) {}
```
### `"always-multi-line"`
There *must always* be a newline after at-rule names in at-rules with multi-line parameters.
The following patterns are considered warnings:
```css
@import "x.css" screen and
(orientation:landscape);
```
```css
@media (min-width: 700px) and
(orientation: landscape) {}
```
The following patterns are *not* considered warnings:
```css
@charset "UTF-8";
```
```css
@charset
"UTF-8";
```
```css
@import "x.css" screen and (orientation:landscape);
```
```css
@media (min-width: 700px) and (orientation: landscape) {}
```
```css
@media
(min-width: 700px) and
(orientation: landscape) {}
```

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-newline-after"
const messages = ruleMessages(ruleName, {
expectedAfter: name => `Expected newline after at-rule name \"${name}\"`,
})
const rule = function (expectation) {
const checker = whitespaceChecker("newline", expectation, messages)
return (root, result) => {
const validOptions = validateOptions(result, ruleName, {
actual: expectation,
possible: [
"always",
"always-multi-line",
],
})
if (!validOptions) {
return
}
atRuleNameSpaceChecker({
root,
result,
locationChecker: checker.afterOneOnly,
checkedRuleName: ruleName,
})
}
}
rule.ruleName = ruleName
rule.messages = messages
module.exports = rule