Friday, February 17, 2017

grumblesmurf: pointless css lint rules

I've already done my curmudgeonly grumble about linting, but today I ran into one lint rule that means especially pointless: length-zero-no-unit, that any length measure that's zero should not have units.

A zero length is a zero length of px, em, cm, or whatever, but for some reason some Lint-heads decide that a since a zero "CAN be an unlabeled" it "SHOULD be unlabeled" (which then gets parlayed into "MUST be unalabled", if your company enforces linting rules for builds.) This page tries to justify it as "saving bytes", which is a pretty weaksauce argument in a world minification and what not.

The other argument is "consistency", but actually I think it makes things more inconcistent: if you have a bunch of "px" values, but one of them happens to be zero, it's not allowed that it be a "0px" measure like its siblings.

In the chat though my department lead came down on the side of not establishing a mechanism for the group to vote down irksome lint-rules. I think it's less that this particular rule is defensible, and more that they want to avoid the quagmire of long debates about other rules that developers find pointless or excessively pedantic.

1 comment:

  1. I find the csslint is pointless in general. I actually prefer JS/ESLINT for better performance of bigger code builds with javascript. However, I've never really ran into an issue with performance with css as I'd find in js.

    ReplyDelete