hudochenkov / stylelint-order

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

Doesn't fix empty strings after sorting #95

Closed mishanga closed 4 years ago

mishanga commented 5 years ago

Before autofix:

.Divider {
    height: 100%;

    width: 100%;
}

After autofix:

.Divider {

    width: 100%;
    height: 100%;
}

Config:

module.exports = {
    "plugins": [
        "stylelint-order",
    ],
    "rules": {
        "order/properties-order": [
            {
                "emptyLineBefore": "always",
                "properties": [
                    "width",
                    "height",
                ],
            },
        ],
    },
};

Versions:

stylelint@9.10.1
stylelint-order@2.2.1
shaikme commented 5 years ago

this bug has 2 cases: 1) When stylelint remove property from first position

Снимок экрана 2019-08-20 в 12 57 41

2) When stylelint insert property to first position

Снимок экрана 2019-08-20 в 13 05 02
hudochenkov commented 5 years ago

stylelint-order preserve empty lines before properties (and other nodes) unless emptyLineBefore and/or noEmptyLineBetween are specified. What happens in @mishanga case, that width had empty line before it, and it was preserved, because when property is the first in rule plugin doesn't change empty lines.

shaikme commented 5 years ago

@hudochenkov in our case emptyLineBefore and noEmptyLineBetween specified, do you know how to avoid emty lines in this case?

hudochenkov commented 4 years ago

Improvement released in stylelint-order@4.0.0. Happy New Year!