stylefmt icon indicating copy to clipboard operation
stylefmt copied to clipboard

State of stylefmt

Open hudochenkov opened this issue 9 years ago • 6 comments

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

hudochenkov avatar Sep 30 '16 08:09 hudochenkov

@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 :)

morishxt avatar Oct 02 '16 07:10 morishxt

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.

hudochenkov avatar Oct 02 '16 09:10 hudochenkov

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 avatar Oct 02 '16 12:10 lkraav

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

lkraav avatar Oct 02 '16 13:10 lkraav

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...

macgyver avatar Oct 22 '16 15:10 macgyver

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

morishxt avatar Oct 24 '16 06:10 morishxt