Specify scales for space.
a {
margin: 1rem;
}
/** ↑
* This space */
This rule can automatically fix all of the problems reported.
This rule checks <length>
and <percentage>
values.
This rule can be paired with the declaration-property-unit-allowed-list
rule in stylelint, using the RegEx:
/^inset|gap|^margin|^padding/
array
of objects
as {scale: [], units: []}
Negative spaces on the scale are implicitly allowed.
Given:
[
{ "scale": [1, 2], "units": ["em", "rem"] },
{ "scale": [16, 32], "units": ["px"] }
]
The following patterns are considered violations:
a {
margin: 16rem;
}
a {
padding: 2px;
}
The following patterns are not considered violations:
a {
margin: 1em;
}
a {
padding: 2rem;
}
a {
gap: -32px;
}
Given:
[
[{ "scale": [1, 2], "units": ["rem"] }],
{
"ignoreFunctionArguments": { "clamp": [1], "min": [0, 1] }
}
]
The following patterns are not considered problems:
a {
gap: clamp(1rem, 0.37rem + 0.45vw, 2rem);
}
a {
gap: min(3rem, 4rem);
}