hudochenkov/stylelint-order

It does not add an empty line between groups

maksimsemenov opened this issue · 6 comments

I'm trying to use order/properties-order rule with emptyLineBefore: 'always', but it does not add an empty line.

Here is the repo with a reproducible example: https://github.com/maksimsemenov/stylelint-order-bug

If you run npx stylelint src/**/* it show an errors, that empty lin is missing. But if you run it with the fix options (npx stylelint --fix src/**/*) it doesn't show any errors, but empty lines are not added as well.

I was trying to debug it, and it seems that addEmptyLineBefore function is called and it changes the node, but these changes are not written to the file. However, the properties for reordered, so it writes some changes to the files, but not the empty line.

Thanks for providing reproducible example!

declaration-empty-line-before, which is set in stylelint-config-standard removes an empty line. You need to disable this rule.

Ohh, thanks! That makes sense now. Thanks for explaining this.

Will it be helpful to add this into docs? I can work on PR, but just want to check if it is something that is needed

Sounds like a good idea.

What value is needed for declaration-empty-line-before? I’ve tried lots of values but with no success.

Got it! declaration-empty-line-before: null

I want to use ...

        'declaration-empty-line-before': ['always', {
            except: ['first-nested', 'after-comment', 'after-declaration'],
        }],

... to force an empty line before a block of declarations.

Unfortunately setting this, empty lines between declarations via order/properties-order do not work anymore.

Update: I found this issue describing the problem.

I see that reference to stylelint-config-standard is already present in the docs for properties-order

@hudochenkov could you close this issue? Or is there anything more to do?