Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stylelint rules around variable colon whitespace
- Loading branch information
Brett Jankord
authored and
Brett Jankord
committed
Aug 5, 2016
1 parent
63f711c
commit b817dd5
Showing
8 changed files
with
80 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import config from "../" | ||
import stylelint from "stylelint" | ||
import postcss from "postcss" | ||
import scssSyntax from "postcss-scss" | ||
import test from "tape" | ||
|
||
const invalidScss = ( | ||
`$spaceaftervariablecolon:#fff; | ||
`) | ||
|
||
test("Space after variable colon scss", t => { | ||
t.plan(2) | ||
|
||
postcss() | ||
.use(stylelint({ code: invalidScss, config: config,})) | ||
.process(invalidScss, { syntax: scssSyntax }) | ||
.then(checkResult) | ||
.catch(logError) | ||
|
||
function checkResult(result) { | ||
t.equal(result.warnings().length, 1, "flags 1 warning") | ||
t.is(result.warnings()[0].text, "Expected single space after \":\" (scss/dollar-variable-colon-space-after)", "correct warning text") | ||
} | ||
}) | ||
|
||
function logError(err) { | ||
console.log(err.stack) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import config from "../" | ||
import stylelint from "stylelint" | ||
import postcss from "postcss" | ||
import scssSyntax from "postcss-scss" | ||
import test from "tape" | ||
|
||
const invalidScss = ( | ||
`$spaceaftervariablename : #f00; | ||
`) | ||
|
||
test("Space after variable name scss", t => { | ||
t.plan(2) | ||
|
||
postcss() | ||
.use(stylelint({ code: invalidScss, config: config,})) | ||
.process(invalidScss, { syntax: scssSyntax }) | ||
.then(checkResult) | ||
.catch(logError) | ||
|
||
function checkResult(result) { | ||
t.equal(result.warnings().length, 1, "flags 1 warning") | ||
t.is(result.warnings()[0].text, "Unexpected whitespace before \":\" (scss/dollar-variable-colon-space-before)", "correct warning text") | ||
} | ||
}) | ||
|
||
function logError(err) { | ||
console.log(err.stack) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters