matype / stylefmt

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

State of stylefmt #214

Open hudochenkov opened 8 years ago

hudochenkov commented 8 years ago

Stylefmt position itself as a tool, which changes CSS according to stylelint's config. But it's not entirely accurate. Stylefmt has opinionated default settings, which applies regardless stylelint's config. For example, I have a stylelint config which has almost every stylelint rule configured. Stylefmt regardless settings put empty lines between rules (both nested and in root) and make a multiline selectors single line. After that stylelint throws a lot of errors, of course.

A community needs a complimentary tool for stylelint to fix CSS. A community needs a tool they can rely on. But right now stylefmt is a mix of a tool, which changes CSS according to stylelint's config, and a tool, which changes CSS with hardcoded options.

Would you like to change stylefmt to a tool which will use only stylelint's config for its modification?

I believe, stylefmt should not change anything without stylelint config and work stylelint way. I mean, it should make changes with enabled rules only. Each rule should care only about itself.

Also, I think each supported rule should be 100% compatible with stylelint (if it's technically possible). It means if stylefmt changes something according to a rule, stylelint should pass and not throws errors. Things like that shouldn't happen https://github.com/morishitter/stylefmt/issues/175

matype commented 8 years ago

@hudochenkov I will try to refactor all stylefmt's code and all of its default rules load from the original stylelint config (e.g. stylelint-config-stylefmt(optional)) on the next major version.

I think each supported rule should be 100% compatible with stylelint (if it's technically possible).

I need more contributors :)

hudochenkov commented 8 years ago

It's great! I would like to help with declaration-block-properties-order. This rule formatter is based on my postcss-sorting, and, because of this, there are some side effects. For example, postcss-sorting removes all empty lines. And has some others side effects.

I'll release next version of postcss-sorting with ability to sort rules without side effects, so it will fit better in stylefmt. With this version I'll fix https://github.com/morishitter/stylefmt/issues/175.

Also, I released stylelint-declaration-block-order for checking the order of content within declaration blocks. It covers variables, nested rules, etc. It'll play nicely with postcss-sorting. Can stylefmt support stylelint plugin's config? I would like to add support for this plugin into stylefmt.

lkraav commented 8 years ago

A community needs a complimentary tool for stylelint to fix CSS. A community needs a tool they can rely on. But right now stylefmt is a mix of a tool, which changes CSS according to stylelint's config, and a tool, which changes CSS with hardcoded options.

This also took me a while to understand. I was expecting a blank stylelint configuration to result in unchanged output. Perhaps this should be reflected in README with more emphasis to avoid wasting time.

lkraav commented 8 years ago

I see several issues addressing this already, #157 for example. Good to know it's coming.

macgyver commented 7 years ago

I need more contributors :)

@morishitter I'd love to contribute but it seems like the basic architecture is in flux right now - is there a way to contribute in a small way that won't conflict with the greater changes on the roadmap? Some oss projects like to add labels such as "good beginner ticket" to issues...

matype commented 7 years ago

@macgyver stylefmt is not large project like facebook/flux, so feel free to send me PR :)