question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use same properties-order logic as stylelint-order

See original GitHub issue

According 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:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TrevorSayrecommented, Jun 1, 2017

Alright, I understand the direction you’re taking. Thank you for taking the time to explain your thoughts.

0reactions
hudochenkovcommented, Jun 1, 2017

If you list out all the border-* properties, than this config will work exactly the same in stylelint-order and postcss-sorting right now and in future versions.

This seems like more effort.

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found