Search code examples
stylelint

Is there a rule to prevent empty lines at the beginning of the block?


Is there a stylelint rule to obtain the following?

I've read the documentation but I wasn't unable to find one

/* bad */
a {

  color: pink;
}

/* good */
a {
  color: pink;
}

Solution

  • This solves my issue

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

    Ref: https://stylelint.io/user-guide/rules/declaration-empty-line-before/#first-nested