Skip to content

Add extra options to stylelint length-zero-no-unit to work well with custom variables #974

Open
@victorg1991

Description

@victorg1991

As suggested in https://stylelint.io/user-guide/rules/list/length-zero-no-unit in some case like the usage in CSS variables the unit is necessary for it to work, so it will be nice to add those extra configuration.

Here is an example where this is required:

Doesn't work

--css-variable-1: 0

body.has-some-class { 
    --css-variable-1: 25px;
}

.other-class {
   top: calc(100vh - var(--css-variable-1)) // When this variable is 0 the calc will be invalid
}

Works

--css-variable-1: 0px;

body.has-some-class { 
    --css-variable-1: 25px;
}

.other-class {
   top: calc(100vh - var(--css-variable-1)) 
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions