1
1
mirror of https://github.com/primer/css.git synced 2024-12-20 20:51:38 +03:00

replace declaration-block-properties-order rules (deprecated) by stylelint-order plugin

This commit is contained in:
nguyenmanh1507 2017-05-26 22:14:21 +07:00
parent cfac2c6c5d
commit 0fe553ed76
3 changed files with 9 additions and 5 deletions

View File

@ -1,7 +1,8 @@
module.exports = { module.exports = {
"plugins": [ "plugins": [
"stylelint-scss", "stylelint-scss",
"stylelint-selector-no-utility" "stylelint-selector-no-utility",
"stylelint-order"
], ],
"rules": { "rules": {
"at-rule-blacklist": ["extend"], "at-rule-blacklist": ["extend"],
@ -42,7 +43,7 @@ module.exports = {
} }
], ],
"declaration-block-no-shorthand-property-overrides": true, "declaration-block-no-shorthand-property-overrides": true,
"declaration-block-properties-order": [ "order/properties-order": [
"position", "position",
"top", "top",
"right", "right",

View File

@ -33,7 +33,8 @@
"ava": "*", "ava": "*",
"eslint": "*", "eslint": "*",
"eslint-plugin-github": "*", "eslint-plugin-github": "*",
"stylelint": "*" "stylelint": "*",
"stylelint-order": "^0.4.4"
}, },
"peerDependencies": { "peerDependencies": {
"stylelint": "^7.7.1" "stylelint": "^7.7.1"

View File

@ -10,6 +10,7 @@ const validCss =
const invalidCss = const invalidCss =
`.foo { `.foo {
color: #fff;
top: .2em; top: .2em;
} }
` `
@ -47,7 +48,8 @@ test("a warning with invalid css", t => {
const { errored, results } = data const { errored, results } = data
const { warnings } = results[0] const { warnings } = results[0]
t.truthy(errored, "errored") t.truthy(errored, "errored")
t.is(warnings.length, 1, "flags one warning") t.is(warnings.length, 2, "flags two warning")
t.is(warnings[0].text, "Expected a leading zero (number-leading-zero)", "correct warning text") t.is(warnings[0].text, 'Expected "top" to come before "color" (order/properties-order)', "correct warning text")
t.is(warnings[1].text, "Expected a leading zero (number-leading-zero)", "correct warning text")
}) })
}) })