hudochenkov / stylelint-order

A plugin pack of order related linting rules for Stylelint.
MIT License
916 stars 61 forks source link

Оne CSS property in different contexts #193

Open alkorlos opened 6 months ago

alkorlos commented 6 months ago

Thank you for the great tool, it has significantly improved my DX for many years

Encountered an issue that manifests itself even with your configuration. In this configuration, the property column-gap occurs twice: firstly as a property of grid, and secondly as a property of multicolumns.

When used as a value for grid, the expected order is as follows:

.block {
    display: grid;
    column-gap: 50px;
    margin: 10px;
}

But due to the fact that column-gap is duplicated in the configuration below, the first value is ignored, resulting in:

.block {
    display: grid;
    margin: 10px;
    column-gap: 50px;
}

In your configuration, properties are grouped separated by empty lines. Is it possible to perform a check: if a property occurs more than once in the configuration, check for the presence of other rules from the groups to which this property belongs? Example for the styles above — column-gap occurs twice in the configuration, but display is only in the first group, so sorting will take this into account.

For this example, it's not a critical issue, but with a larger number of properties in a rule and empty lines between property groups, this improvement would be very helpful.