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,57 @@
# declaration-bang-space-before
Require a single space or disallow whitespace before the bang of declarations.
```css
a { color: pink !important; }
/** ↑
* The space before this exclamation mark */
```
## Options
`string`: `"always"|"never"`
### `"always"`
There *must always* be a single space before the bang.
The following patterns are considered warnings:
```css
a { color: pink!important; }
```
```css
a { color: pink ! important; }
```
The following patterns are *not* considered warnings:
```css
a { color: pink !important; }
```
```css
a { color:pink ! important; }
```
### `"never"`
There *must never* be whitespace before the bang.
The following patterns are considered warnings:
```css
a { color : pink !important; }
```
The following patterns are *not* considered warnings:
```css
a { color: pink!important; }
```
```css
a { color: pink! important; }
```

View File

@@ -0,0 +1,40 @@
"use strict"
const declarationBangSpaceChecker = require("../declarationBangSpaceChecker")
const ruleMessages = require("../../utils/ruleMessages")
const validateOptions = require("../../utils/validateOptions")
const whitespaceChecker = require("../../utils/whitespaceChecker")
const ruleName = "declaration-bang-space-before"
const messages = ruleMessages(ruleName, {
expectedBefore: () => "Expected single space before \"!\"",
rejectedBefore: () => "Unexpected whitespace before \"!\"",
})
const rule = function (expectation) {
const checker = whitespaceChecker("space", expectation, messages)
return (root, result) => {
const validOptions = validateOptions(result, ruleName, {
actual: expectation,
possible: [
"always",
"never",
],
})
if (!validOptions) {
return
}
declarationBangSpaceChecker({
root,
result,
locationChecker: checker.before,
checkedRuleName: ruleName,
})
}
}
rule.ruleName = ruleName
rule.messages = messages
module.exports = rule