CSSLint / csslint

Automated linting of Cascading Stylesheets
http://csslint.net
Other
4.77k stars 483 forks source link

Warning for !important declarations #20

Closed huckfinnaafb closed 13 years ago

huckfinnaafb commented 13 years ago

!important can quickly become an abused tool if not properly designing your CSS, and while certainly useful for leaf nodes or user-stylesheets, it should be noted that overuse can quickly create unneeded complexity with regards to specificity.

stubbornella commented 13 years ago

So, you think it should be an error instead?

huckfinnaafb commented 13 years ago

If it's coded in as a warning currently, it's not working for me or a few other users I've talked to. I get no feedback from valid CSS with !important declarations, either errors or warnings.

Gavrisimo commented 13 years ago

At the moment its not throwing at us anything, no error and no warning. I would go with error for this one, !important 90% of the time means specificity issue is happening which can be fixed in some other way.

shinuza commented 13 years ago

This is not an error by default, it's valid, but may lead to specificity war when overused. This should be a warning and may cause an error when the file contains an certain number of !important declarations.

Gavrisimo commented 13 years ago

Less then 5 - warning, more then 5 - error?

shinuza commented 13 years ago

I've set it to 10, (OOCSS has 8 of them, so I figure out 10 would be realistic) see this pull request

stubbornella commented 13 years ago

Nice work. The pull request has been merged.