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 ed6585a1..183b35c0 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "homepage": "https://github.com/primer/stylelint-config-primer#readme", "dependencies": { "stylelint-scss": "^1.4.1", + "stylelint-order": "^0.4.4", "stylelint-selector-no-utility": "^1.5.0" }, "devDependencies": { diff --git a/tests/index.js b/tests/index.js index ec611924..b159b1e1 100644 --- a/tests/index.js +++ b/tests/index.js @@ -11,6 +11,7 @@ const validCss = const invalidCss = `.foo { + color: #fff; top: .2em; } ` @@ -48,8 +49,9 @@ 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") }) })