matype / stylefmt

stylefmt is a tool that automatically formats stylesheets.
Other
2.1k stars 89 forks source link

Custom at-rules don't get formatted according to .stylelintrc.json #280

Open chrishoage opened 7 years ago

chrishoage commented 7 years ago

Given the following .stylelintrc.json https://gist.github.com/chrishoage/bdedf025288486050fd60535bd018c3e

And the following CSS

.planButton {
  @add-mixin truncate;

  display: inline-block;
  margin: 0 20px 20px;
  width: 240px;
}

The output is this

.planButton {

  @add-mixin truncate ;
  display: inline-block;
  margin: 0 20px 20px;
  width: 240px;
}

One expects stylefmt to not a) move the custom at-rule, and b) not add a space after truncate.

I was playing around with formatAtRules and the issue appears to be that formatAtRules doesn't handle unknown at-rules very well.

Since PostCSS supports defining custom at-rules (postcss-mixins) stylefmt should respect custom at-rules and format them to the way postcss validates.