You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-3Lines changed: 30 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Lint and autofix style sheets order with [stylelint-order].
12
12
* Sorts properties.
13
13
* Sorts at-rules by different options.
14
14
* Groups properties, custom properties, dollar variables, nested rules, nested at-rules.
15
-
* Supports CSS, SCSS (if[postcss-scss] parser is used), [PreCSS] and most likely any other syntax added by other PostCSS plugins.
15
+
* Supports CSS, SCSS (using[postcss-scss]), HTML (with [postcss-html]), CSS-in-JS (with [postcss-jsx]), [PreCSS] and most likely any other syntax added by other PostCSS plugins.
16
16
17
17
## Installation
18
18
@@ -29,7 +29,9 @@ The plugin has no default options. Everything is disabled by default.
29
29
-[`unspecified-properties-position`](./lib/properties-order/unspecified-properties-position.md): Specify position for properties not specified in `properties-order`.
30
30
-`throw-validate-errors`: Throw config validation errors instead of just showing and ignoring them. Defaults to `false`.
31
31
32
-
## Handling comments
32
+
## Caveats
33
+
34
+
### Handling comments
33
35
34
36
Comments that are before node and on a separate line linked to that node. Shared-line comments are also linked to that node. Shared-line comments are comments which are located after a node and on the same line as a node.
35
37
@@ -42,10 +44,33 @@ a {
42
44
}
43
45
```
44
46
45
-
## Ignored at-rules
47
+
###Ignored at-rules
46
48
47
49
Some at-rules, like [control](https://sass-lang.com/documentation/file.SASS_REFERENCE.html#control_directives__expressions) and [function](https://sass-lang.com/documentation/file.SASS_REFERENCE.html#function_directives) directives in Sass, are ignored. It means rules won't touch content inside these at-rules, as doing so could change or break functionality.
48
50
51
+
### CSS-in-JS
52
+
53
+
Plugin will ignore rules, which have template literal interpolation, to avoid breaking logic:
54
+
55
+
```js
56
+
constComponent=styled.div`
57
+
/* The following properties WILL NOT be sorted, because interpolation is on properties level */
58
+
z-index: 1;
59
+
top: 1px;
60
+
${props=>props.great&&'color: red'};
61
+
position: absolute;
62
+
display: block;
63
+
64
+
div {
65
+
/* The following properties WILL be sorted, because interpolation for property value only */
66
+
z-index: 2;
67
+
position: static;
68
+
top: ${2+10}px;
69
+
display: inline-block;
70
+
}
71
+
`;
72
+
```
73
+
49
74
## Migration from `2.x`
50
75
51
76
Remove all `*-empty-line-before` and `clean-empty-lines` options. Use [stylelint] with `--fix` option instead.
@@ -207,6 +232,8 @@ I recommend [Prettier] for formatting style sheets.
0 commit comments