matype / stylefmt

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

Support stylelint configuration #61

Closed corysimmons closed 8 years ago

corysimmons commented 8 years ago

It's fine to have defaults, but it'd be nice if this supported users passing their own stylelint config.

matype commented 8 years ago

@corysimmons Thank you for your proposal, and I read some issues in stylelint repository that is related to CSSfmt . But I'm not going to introduce options(a config file) to format code (https://github.com/morishitter/cssfmt/issues/4).

I use stylelint in my project. It is cool! And here is my stylelint config file:

"rules": {
  "color-hex-length": "short",
  "color-no-invalid-hex": true,
  "media-feature-name-no-vendor-prefix": true,
  "number-leading-zero": "always",
  "number-no-trailing-zeros": true,
  "number-zero-length-no-unit": true,
  "property-no-vendor-prefix": true,
  "selector-no-vendor-prefix": true,
  "selector-pseudo-element-colon-notation": "double",
  "selector-root-no-composition": true
}

In my opinion, stylelint is a lint tool, so I use stylelint only to lint CSS code. I think, we don't have to consider formatting of code when we are writing it, but we should format code when we share our code to others. And the formatting should run unconsciously and automatically.

So, stylelint options that is related to format code are not necessary, I think.

(Sorry, I'm not good at English)

corysimmons commented 8 years ago

Not everyone wants to format according to your rules: https://github.com/morishitter/cssfmt#rules

I don't. I'm sure a lot of other people don't.

(your english is fine)

matype commented 8 years ago

What rule do you dislike? Almost developers write CSS in accordance with rules in my experience (without indentation size).

I got tired of maintaining config files(ex. .babelrc, .eslintrc, .editorconfig, etc). So, I created CSSfmt inspired by Gofmt. It is simple to use.

(Thanks :) )

corysimmons commented 8 years ago

I'm currently working on a strict config for stylelint. You have 22 rules defined, I have over a hundred.

It doesn't matter what I particularly want. The point of this Issue is anyone should be able to configure CSSfmt with a stylelint config file and it should format according to that.

I'm sure I'm not alone in this sentiment, but if you're content with your tool, then no problem. We'll implement this over at stylelint. Just figured I'd ask you since you already have a tool for formatting CSS.

in-in commented 8 years ago

@corysimmons You're not alone. I'm prefer this syntax,

.link
{
  overflow: hidden;
  cursor: pointer;
}

but CSSfmt forcing me use some immutable rules. Still with the CSScomb and dreaming about auto formatting according to the stylelint config.

(Sorry, I'm not good at English too)

corysimmons commented 8 years ago

corysimmons commented 8 years ago

If you do upgrade it, please support all 3 versions of configuration: https://github.com/stylelint/stylelint/blob/master/docs/user-guide/configuration.md#loading-configuration

matype commented 8 years ago

@corysimmons I see, thank you for telling me :)

corysimmons commented 8 years ago

No problem. A lot of people make config for .stylelintrc and forget the other types so I figured I'd point it out before you got started. :D

matype commented 8 years ago

:+1:

matype commented 8 years ago

@corysimmons I just released stylefmt (renamed from CSSfmt) v3.0.0, support to understand stylelint rules for formattin :tada: https://github.com/morishitter/stylefmt/releases/tag/v3.0.0

corysimmons commented 8 years ago

@davidtheclark ^ if you're interested

davidtheclark commented 8 years ago

Yeah, thanks for the ping. This is really cool. I'll be trying it out soon.