hudochenkov / stylelint-order

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

declaration-block-order: Support `selector` for rules #1

Closed hudochenkov closed 7 years ago

hudochenkov commented 8 years ago

Config:

{
    type: 'rule',
    selector: '/^&:\w/'
}

selector is RegEx for selector matching.

It will match:

a {
    &:hover {
        color: blue;
    }
    &:focus {
        color: red;
    }
}

Won't match:

a {
    &::before {
        content: "b";
    }
    &::after {
        content: "a";
    }
}

Proposed https://github.com/stylelint/stylelint/issues/1500#issuecomment-230105435

psixdev commented 7 years ago

Discussed in #3. Need extend this config by hasBlock property to support mixins such as .my-mixin(); less mixin.

hudochenkov commented 7 years ago

Created separate issue for Less mixins #9

hudochenkov commented 7 years ago

Done in https://github.com/hudochenkov/stylelint-order/commit/37e6912de2d58c0ecd087df1bba8a64949871e7b