Skip to content

Commit 1b8a37a

Browse files
authored
add docs for stylelint rule syntax (#849)
1 parent 6e93483 commit 1b8a37a

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

plugins/postcss-conditional-values/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,25 @@ color: csstools-if(--a-condition yellow else red);
119119
csstools-if(<custom-property-name> <declaration-value> else <declaration-value>);
120120
```
121121

122+
#### [Stylelint](https://stylelint.io/user-guide/rules/declaration-property-value-no-unknown/#propertiessyntax--property-syntax-)
123+
124+
Stylelint is able to check for unknown property values.
125+
Setting the correct configuration for this rule makes it possible to check even non-standard syntax.
126+
127+
```js
128+
// Disallow unknown values for properties within declarations.
129+
'declaration-property-value-no-unknown': [
130+
true,
131+
{
132+
propertiesSyntax: {
133+
color: '| csstools-if( <custom-property-name> <\'color\'> else <\'color\'> )',
134+
'background-color': '| csstools-if( <custom-property-name> <\'background-color\'> else <\'background-color\'> )',
135+
// ... more properties ...
136+
},
137+
},
138+
],
139+
```
140+
122141
### `true` and `false` keywords
123142

124143
The `true` and `false` keywords are syntactic sugar for `initial` and `<space>`.

plugins/postcss-conditional-values/docs/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,25 @@ color: csstools-if(--a-condition yellow else red);
7373
csstools-if(<custom-property-name> <declaration-value> else <declaration-value>);
7474
```
7575

76+
#### [Stylelint](https://stylelint.io/user-guide/rules/declaration-property-value-no-unknown/#propertiessyntax--property-syntax-)
77+
78+
Stylelint is able to check for unknown property values.
79+
Setting the correct configuration for this rule makes it possible to check even non-standard syntax.
80+
81+
```js
82+
// Disallow unknown values for properties within declarations.
83+
'declaration-property-value-no-unknown': [
84+
true,
85+
{
86+
propertiesSyntax: {
87+
color: '| csstools-if( <custom-property-name> <\'color\'> else <\'color\'> )',
88+
'background-color': '| csstools-if( <custom-property-name> <\'background-color\'> else <\'background-color\'> )',
89+
// ... more properties ...
90+
},
91+
},
92+
],
93+
```
94+
7695
### `true` and `false` keywords
7796

7897
The `true` and `false` keywords are syntactic sugar for `initial` and `<space>`.

plugins/postcss-design-tokens/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,27 @@ design-token() = design-token( <token-path> [ to <unit> ]? )
379379
The plugin can convert `px` to `rem` and `rem` to `px` via the [`unitsandvalues`](#unitsandvalues) plugin options.
380380
When a design token is unit-less any `unit` can be assigned with `to`.
381381
382+
#### [Stylelint](https://stylelint.io/user-guide/rules/declaration-property-value-no-unknown/#propertiessyntax--property-syntax-)
383+
384+
Stylelint is able to check for unknown property values.
385+
Setting the correct configuration for this rule makes it possible to check even non-standard syntax.
386+
387+
```js
388+
// Disallow unknown values for properties within declarations.
389+
'declaration-property-value-no-unknown': [
390+
true,
391+
{
392+
propertiesSyntax: {
393+
color: '| <design-token()>',
394+
// ... more properties ...
395+
},
396+
typesSyntax: {
397+
'<design-token()>': 'design-token( <string> [ to <ident> ]? )',
398+
},
399+
},
400+
],
401+
```
402+
382403
## Further reading
383404
384405
- [Why we think PostCSS Design Tokens is needed]

plugins/postcss-design-tokens/docs/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,27 @@ design-token() = design-token( <token-path> [ to <unit> ]? )
248248
The plugin can convert `px` to `rem` and `rem` to `px` via the [`unitsandvalues`](#unitsandvalues) plugin options.
249249
When a design token is unit-less any `unit` can be assigned with `to`.
250250
251+
#### [Stylelint](https://stylelint.io/user-guide/rules/declaration-property-value-no-unknown/#propertiessyntax--property-syntax-)
252+
253+
Stylelint is able to check for unknown property values.
254+
Setting the correct configuration for this rule makes it possible to check even non-standard syntax.
255+
256+
```js
257+
// Disallow unknown values for properties within declarations.
258+
'declaration-property-value-no-unknown': [
259+
true,
260+
{
261+
propertiesSyntax: {
262+
color: '| <design-token()>',
263+
// ... more properties ...
264+
},
265+
typesSyntax: {
266+
'<design-token()>': 'design-token( <string> [ to <ident> ]? )',
267+
},
268+
},
269+
],
270+
```
271+
251272
## Further reading
252273
253274
- [Why we think PostCSS Design Tokens is needed]

0 commit comments

Comments
 (0)