Skip to content

Commit 1269b5d

Browse files
author
Limon Monte
committed
feat: add stylelint-csstree-validator
1 parent a4e791b commit 1269b5d

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ module.exports = {
44
"stylelint-config-property-sort-order-smacss",
55
],
66
"plugins": [
7-
// "stylelint-csstree-validator",
7+
"stylelint-csstree-validator",
88
"stylelint-order",
99
"stylelint-scss"
1010
],
1111
"rules": {
1212
"at-rule-no-unknown": null,
13-
// "csstree/validator": true,
13+
"csstree/validator": true,
1414
"declaration-empty-line-before": null,
1515
"number-leading-zero": null,
1616
"no-descending-specificity": null,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"stylelint-config-property-sort-order-smacss": "^5.0.0",
1919
"stylelint-config-standard": "^18.3.0",
20+
"stylelint-csstree-validator": "^1.4.0",
2021
"stylelint-scss": "^3.9.0"
2122
},
2223
"devDependencies": {

test/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,13 @@ test('order/properties-order (stylelint-config-property-sort-order-smacss)', asy
2727
assert.strictEqual(output.results[0].warnings.length, 1)
2828
assert.strictEqual(output.results[0].warnings[0].text.trim(), 'Expected "top" to come before "color" (order/properties-order)')
2929
})
30+
31+
test('csstree/validator (stylelint-csstree-validator)', async () => {
32+
const output = await stylelint.lint({
33+
code: 'a { max-width: auto; }\n',
34+
config,
35+
})
36+
37+
assert.strictEqual(output.results[0].warnings.length, 1)
38+
assert.strictEqual(output.results[0].warnings[0].text.trim(), 'Invalid value for `max-width` (csstree/validator)')
39+
})

yarn.lock

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,14 @@ css-property-sort-order-smacss@^2.1.3:
516516
resolved "https://registry.yarnpkg.com/css-property-sort-order-smacss/-/css-property-sort-order-smacss-2.1.3.tgz#b9cf1753b3612ee7d18fe99224f483353ea38e53"
517517
integrity sha512-tMGlBxcfQq5VYmMFp4tGqxkNeXDBmlGbyuuz1FFGRvCUj9CvocShe23d4kFyfxW6JMlhlBVfnZRa8AO8kgceJA==
518518

519+
520+
version "1.0.0-alpha.30"
521+
resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.30.tgz#84a4c687cc2536a60e470d41cc9b999bceebb6ed"
522+
integrity sha512-/yR+59CTMG5yJ3yG/sLgwiz8kBqNZzkyp6T7qyg3DPTD2IJ7/bs8BRDOQfRTjvXpP2cPB8Z7AY/31597iMY4+Q==
523+
dependencies:
524+
mdn-data "~2.0.3"
525+
source-map "^0.5.3"
526+
519527
cssesc@^3.0.0:
520528
version "3.0.0"
521529
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
@@ -1374,6 +1382,11 @@ mdast-util-compact@^1.0.0:
13741382
dependencies:
13751383
unist-util-visit "^1.1.0"
13761384

1385+
mdn-data@~2.0.3:
1386+
version "2.0.3"
1387+
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.3.tgz#a70100a453697827fa3ecc33cd23c8e63490a550"
1388+
integrity sha512-DCfx3pMW1vNlxApB8XrHAFvhUcvVAdmu3BU9r4tF6eWwv9Eg+gvQpdr2EGaEWsrPlk+jZSkEKxfdezo6d2pWYg==
1389+
13771390
meow@^5.0.0:
13781391
version "5.0.0"
13791392
resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4"
@@ -2015,7 +2028,7 @@ source-map-url@^0.4.0:
20152028
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
20162029
integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=
20172030

2018-
source-map@^0.5.0, source-map@^0.5.6:
2031+
source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6:
20192032
version "0.5.7"
20202033
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
20212034
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
@@ -2158,6 +2171,13 @@ stylelint-config-standard@^18.3.0:
21582171
dependencies:
21592172
stylelint-config-recommended "^2.2.0"
21602173

2174+
stylelint-csstree-validator@^1.4.0:
2175+
version "1.4.0"
2176+
resolved "https://registry.yarnpkg.com/stylelint-csstree-validator/-/stylelint-csstree-validator-1.4.0.tgz#f660350c300d98565540c48748a3f23e075e15ca"
2177+
integrity sha512-7XiJT4cvn77dyT+Dr9uc9w22UB+gdQ0UUNc6DG9ler5isnavsYRTuf0wsmvwGWym/WorDNv2yAIBOfG1gOS57g==
2178+
dependencies:
2179+
css-tree "1.0.0-alpha.30"
2180+
21612181
stylelint-order@^3.0.0:
21622182
version "3.0.0"
21632183
resolved "https://registry.yarnpkg.com/stylelint-order/-/stylelint-order-3.0.0.tgz#ec44afb93a3183dcf8c91540d4486de776250506"

0 commit comments

Comments
 (0)