CSSLint / csslint

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

Leading semicolon (un)forgivable? #245

Closed iDGS closed 12 years ago

iDGS commented 12 years ago

Silly, I know, but when composing, I like to align all the "fly specks" of CSS where I can easily see them, E.g.,

  nav ul
, nav ol
            {
            ;   list-style                      :   none
            ;   list-style-image                :   none
            }

(Hope you didn't hurt yourself when you fainted ;-) I'd argue (briefly, and none too stridently) that it's in the OOCSS tradition to separate container from content, which is what I'm doing visually by getting those braces onto lines of their own, and by pulling the commas, colons and semicolons into columns where it takes but a glance to verify that my fat fingers haven't done other than what was intended. (Most of my typos involve those 3 characters--you?) As a fringe benefit, that {;;} column makes a nice visual "wrapper" IMHO, and--best of all--I can copy/paste lines in any order with impunity, never having to worry about those braces. Mash it all into unreadability later, if you must. No big deal. However,...

You guessed it--CSS Lint is a little, um, "unfriendly" to that first semicolon, saying :

            4   5   Parsing Errors  Expected RBRACE at line 4, col 5.
                            ;   list-style                      :   none

Yet, I've previously searched the W3C CSS spec, and couldn't find a prohibition against the above style of CSS coding. Indeed, the W3C validator does not complain, nor do any of the browsers I've tested it on. So...

Is it really, REALLY a parsing error?

Or, if it's actually forgivable, may I humble ask that you would? :-)

nzakas commented 12 years ago

Well, it's a parsing error in that the parser wasn't expecting to see it. It does look like the grammar supports your claim that this is valid syntax. The parser just needs to be updated.

nzakas commented 12 years ago

Doh, missed check in comment to close this bug. It's fixed now.