Stylelint: Add ignore option to length-zero-no-unit for flexbox

Created on 23 Apr 2017  路  3Comments  路  Source: stylelint/stylelint

Feature request:
Add option to disable length-zero-no-unit per given property. Why? Because flex rule requires unit for last parameter to support IE10 and IE11. See: https://github.com/philipwalton/flexbugs#6-the-default-flex-value-has-changed

Currently when linting following ruleset:

.something {
    flex: 1 1 0px;
}

I get error Stylelint: Unexpected unit (length-zero-no-unit)

There is workaround available to disable this on every place where 0 unit is used in flex property. However it would be nice to able to disable "flex" "length-zero-no-unit" globally. Adding this kind of option would allow disabling length-zero-no-unit for different properties also.

I searched github issues but could not find anything related to this.

Great project btw 馃憤 , It has helped me to simplify style rules. :)

All 3 comments

Seems like this rule passes stylelint validation:

flex: 1 1 0%;

but that seems like undocumented feature.

Thanks, @Havunen. I'm more inclined to have users disable this particular rule for this particular line (/* stylelint-disable-line length-zero-no-unit */), rather than building in an exception to accommodate an IE bug.

@Havunen Thanks for your request. We also recommend keeping your source code _clean_ and instead use processors to workaround bugs in browsers. In this instance, I think postcss-flexbugs-fixes will help.

Was this page helpful?
0 / 5 - 0 ratings