A few days ago, I installed CSS Linter in my favorite editor, Sublime Text 3. I opened up the stylesheet for my website, and saw that the Linter had found 325 errors in 1942 lines of code. While there were no show-stopper errors (like missing a closing bracket), there were many warnings. Warnings such as “Don’t use adjoining classes”, “Don’t use IDs in selectors”, and “Heading (H2) has already been defined”. My immediate reaction was one of slight panic. If I were to set about resolving each issue, my site’s design would undoubtedly have to change. For example, if I were to define my heading tags only once, it means I would never be able to change the font size of that tag anywhere else on the site. Basically, following the “rules” would mean rethinking everything I know when writing CSS.
I then turned to the web to see what others say about CSS Linting. I found this great post by Matt Wilcox. He mentions that blindly following what these tools tell you to do is a bunch of crap. Most of the tool’s warnings are based purely on browser performance, not helping you write valid HTML and CSS. I’m going to give Linter a shot for a little while longer, but I can already tell that I’ll get tired of ignoring most of the warning messages.