From 0fe553ed76fc58a8c76c94728bfc66e65c87f77f Mon Sep 17 00:00:00 2001 From: nguyenmanh1507 Date: Fri, 26 May 2017 22:14:21 +0700 Subject: [PATCH] replace declaration-block-properties-order rules (deprecated) by stylelint-order plugin --- index.js | 5 +++-- package.json | 3 ++- tests/index.js | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index b379d6f3..f575a49e 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ module.exports = { "plugins": [ "stylelint-scss", - "stylelint-selector-no-utility" + "stylelint-selector-no-utility", + "stylelint-order" ], "rules": { "at-rule-blacklist": ["extend"], @@ -42,7 +43,7 @@ module.exports = { } ], "declaration-block-no-shorthand-property-overrides": true, - "declaration-block-properties-order": [ + "order/properties-order": [ "position", "top", "right", diff --git a/package.json b/package.json index f085afa5..14abcbcf 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "ava": "*", "eslint": "*", "eslint-plugin-github": "*", - "stylelint": "*" + "stylelint": "*", + "stylelint-order": "^0.4.4" }, "peerDependencies": { "stylelint": "^7.7.1" diff --git a/tests/index.js b/tests/index.js index 0b027bd7..fb9fef65 100644 --- a/tests/index.js +++ b/tests/index.js @@ -10,6 +10,7 @@ const validCss = const invalidCss = `.foo { + color: #fff; top: .2em; } ` @@ -47,7 +48,8 @@ test("a warning with invalid css", t => { const { errored, results } = data const { warnings } = results[0] t.truthy(errored, "errored") - t.is(warnings.length, 1, "flags one warning") - t.is(warnings[0].text, "Expected a leading zero (number-leading-zero)", "correct warning text") + t.is(warnings.length, 2, "flags two warning") + 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") }) })