kutsan/stylelint-config-clean-order

Adjust severity level

axten opened this issue · 6 comments

axten commented

Hello,
first of all: thank you for your effort creating this config!
I started using this config because I like your order set - but now I realized that you forced the severity level to "warn".
This results is that pre commit hook and pipeline is not failing on wrong order.
There seems no easy way to reverse that - so possible ways to fix this I see are:

  • make severity somehow configurable
  • remove severity from rule definition so that defaultSeverity setting can influence
  • provide 2 flavors e.g. "stylelint-config-clean-order/warn"

what do you think?
kind regards

Hello,

I think it makes sense to use warning level severity because there is no logical issue with rules but only formatting problems. If you're using stylelint extensions in your editor, I think it's no fun to see formatting problems as errors when you're writing CSS.

We're using stylelint --max-warnings=0 to limit maximum allowed warnings in our team with great success. You can even do this with eslint. Would this work for you? There is also a way to override rules but it looks a little bit messy in a config file.

make severity somehow configurable

I don't think there is a reliable way to achieve that. Stylelint configs can be JSON file and as far as I know there isn't a way to pass some kind of config object to config packages.

remove severity from rule definition so that defaultSeverity setting can influence

They will be using error level by default and I think we shouldn't change their severity like this.

provide 2 flavors e.g. "stylelint-config-clean-order/warn"

If it's possible I want to keep this config opinionated at some level. If we can't go with the solutions that I mentioned above, I'll research a bit to see how can I do this elegantly.

axten commented

thanks for fast reply!
In my case this workaround should be ok but it fails when you have other rules that really should just be warnings, e.g. max-nesting-depth
Would be great if you find a solution for the third suggestion.
kind regards

You're welcome! For what it's worth, I'm also checking TypeScript/JavaScript formatting problems with prettier --check . in CI. I think even warnings shouldn't make the build pass. We're doing in more strict way but yours are also okay.

axten commented

All good.
can totally agree with your point of view.
but adding "stylelint-config-clean-order/error" or "stylelint-config-clean-order/default" could be a way to satisfy both worlds/views.

Kreeg commented

+1

kutsan commented

Hello again,

I'm sorry it took a while but I published v5.1.0 with a support to changing severity level to error. You can extend the config with error suffix to use it. Your feedback is welcome.

{
  "extends": ["stylelint-config-clean-order/error"]
}