Skip to content

Commit 55b243f

Browse files
authored
Merge pull request #13 from nguyenmanh1507/replace-deprecated-rules
replace declaration-block-properties-order rules (deprecated) by stylelint-order plugin
2 parents cfac2c6 + 88997cd commit 55b243f

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module.exports = {
22
"plugins": [
33
"stylelint-scss",
4-
"stylelint-selector-no-utility"
4+
"stylelint-selector-no-utility",
5+
"stylelint-order"
56
],
67
"rules": {
78
"at-rule-blacklist": ["extend"],
@@ -42,7 +43,7 @@ module.exports = {
4243
}
4344
],
4445
"declaration-block-no-shorthand-property-overrides": true,
45-
"declaration-block-properties-order": [
46+
"order/properties-order": [
4647
"position",
4748
"top",
4849
"right",

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
"ava": "*",
3434
"eslint": "*",
3535
"eslint-plugin-github": "*",
36-
"stylelint": "*"
36+
"eslint-plugin-import": "^2.6.0",
37+
"stylelint": "*",
38+
"stylelint-order": "^0.4.4"
3739
},
3840
"peerDependencies": {
3941
"stylelint": "^7.7.1"

tests/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const validCss =
1010

1111
const invalidCss =
1212
`.foo {
13+
color: #fff;
1314
top: .2em;
1415
}
1516
`
@@ -47,7 +48,8 @@ test("a warning with invalid css", t => {
4748
const { errored, results } = data
4849
const { warnings } = results[0]
4950
t.truthy(errored, "errored")
50-
t.is(warnings.length, 1, "flags one warning")
51-
t.is(warnings[0].text, "Expected a leading zero (number-leading-zero)", "correct warning text")
51+
t.is(warnings.length, 2, "flags two warning")
52+
t.is(warnings[0].text, 'Expected "top" to come before "color" (order/properties-order)', "correct warning text")
53+
t.is(warnings[1].text, "Expected a leading zero (number-leading-zero)", "correct warning text")
5254
})
5355
})

0 commit comments

Comments
 (0)