Use same properties-order logic as stylelint-order
See original GitHub issueAccording to the properties-order definition for stylelint-order:
If an (unprefixed) property name is not included in your array and it contains a hyphen (e.g. padding-left), this rule will look for the string before that first hyphen in your array (e.g. padding) and use that position.
This creates an inconsistency with how postcss-sorting
handles properties-order
.
If I have the following rule:
'properties-order': [
'border',
'color',
],
'unspecified-properties-position': 'bottom',
And the following css:
.container {
border: 6px solid black;
border-right-width: 18px;
color: red;
}
The css linting by stylelint-order
will not give any warnings.
However, if I were to then run postcss-sorting
, the border-right-width
is moved to the bottom resulting in the following css:
.container {
border: 6px solid black;
color: red;
border-right-width: 18px;
}
Now the css linting by stylelint-order
will give the error:
[stylelint] Expected "border-right-width" to come before "color" (order/properties-order)
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
A plugin pack of order related linting rules for Stylelint. - GitHub
Rules. order : Specify the order of content within declaration blocks. properties-order : Specify the order of properties within declaration blocks.
Read more >Stylelint Config - Order - Fylgja.dev
A sharable stylelint config object that enforces Fylgja's CSS order rules. ... the order of our code, the logic is to keep properties...
Read more >stylelint-config-logic-order - npm
stylelint -config-logic-order. This stylelint configuration validates the order of CSS properties according to Logic CSS.
Read more >postcss-sorting - UNPKG
lib/properties-order/README.md): Specify the order of properties within ... Use [stylelint-order] with `--fix` option for empty line before property groups.
Read more >Rules | Stylelint
rule-selector-property-disallowed-list : Specify a list of disallowed properties for selectors within rules. Selector. selector-attribute-name-disallowed-list ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alright, I understand the direction you’re taking. Thank you for taking the time to explain your thoughts.
If you list out all the
border-*
properties, than this config will work exactly the same instylelint-order
andpostcss-sorting
right now and in future versions.It is, but it’s one time effort, and you don’t have to write down every property from the head. You can use this as a reference.