Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to follow only rules described in .stylelintrc #86

Open
cbrwizard opened this issue Apr 6, 2016 · 9 comments · May be fixed by #320
Open

Option to follow only rules described in .stylelintrc #86

cbrwizard opened this issue Apr 6, 2016 · 9 comments · May be fixed by #320

Comments

@cbrwizard
Copy link

Hey, it's great that you added support for .stylelintrc!
I started using it in my project and I have noticed that, apparently, stylefmt uses a merging strategy when choosing rules: it follows .stylelintrc rules and also applies stylefmt's standard ones for the rules it didn't find/recognize in .stylelintrc.
For instance, I follow stylelint-config-standard rules, where a block like

.selector-x { width: 10%; }

is allowed. Having a .stylelintrc with these simple contents

{
  "extends": "stylelint-config-standard"
}

does not raise an error or a warning when running stylelint for a block like the one ^. However, it gets auto formatted into

.selector-x { 
  width: 10%;
}

when I run stylefmt.

I think it would be great if there was a CLI option --only-stylelint or something like that which when passed would force stylefmt to format only the rules found/recognized in .stylelintrc file and do not do anything extra.

@s10wen
Copy link

s10wen commented Jun 22, 2016

@cbrwizard nice idea, I'd be interested in this as well.

@gjjones
Copy link

gjjones commented Jul 14, 2016

This tool is a strong candidate at my organization, but the enforcement of default rules is a current point of contention. Stylelint does explicitly state that rules are off by default, where as stylefmt will have default values applied for rules even if they are omitted. This seems to be a design difference between stylefmt and the project it is based off of.

Are there plans to realign this difference and allow rules to be off unless they are turned on, such as how stylelint works?

And maybe a better question, would you even want PRs that try to add this behavior? 😄

@matype
Copy link
Owner

matype commented Jul 29, 2016

Now, stylefmt can handle many stylelint rules, so I decided to implement --onlyStylelint option. :)

@ArmorDarks
Copy link

Same issue here. It makes Stylefmt format all places, which are acceptable by Stylelint config file.

It would be great to see --onlyStylelint, but I'd say it would be more appropriate to make external config file mandatory and instead add --defaultRules which will apply default rules, because so far Stylefmt goings against Stylelint paradigm, where config isn't default, but completely declarative.

@s10wen
Copy link

s10wen commented Aug 10, 2016

I'd like to see stylefmt have no rules set by default, then you can choose to enable the rules in the .stylelintrc / stylefmt as required.

@mparpaillon
Copy link

Is this fixed ? I have the same issue. Thanks

@evanwarner
Copy link

I'm also confused about the state of this issue, and I think it's a vital one to address. Stylefmt making opinionated changes to code that on occasion directly counter what is set in .stylelintrc seems wrong.

Take, for example, this Stylelint setting: "value-list-comma-newline-after": "always"
This enforces that any declaration with multiple values be formatted on multiple lines. However, Stylefmt automatically reformats value lists to be on one line. So in this case, Stylefmt actually creates a linting error.

I think it's essential that Stylefmt becomes a no-defaults tool so that it is in sync with the tool it uses for configuration.

@benfrain
Copy link

benfrain commented Mar 3, 2017

@morishitter can you confirm, is --onlyStylelint in the current version (just checking as nothing in the readme regarding it). Thanks for this great tool 👍

@cascornelissen
Copy link

@benfrain; I'm afraid not... I can't seem to find it anywhere in the repository: https://github.com/morishitter/stylefmt/search?utf8=%E2%9C%93&q=onlyStylelint.

@morishitter, an update on this would be greatly appreciated.

@ghost ghost linked a pull request Aug 28, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants