function-calc-no-unspaced-operator
Disallow invalid unspaced operator within math functions, such as calc() or min().
a { top: calc(1px + 2px); }/** ↑ * The space around this operator */Use this rule to avoid declarations that browsers ignore. In calc(), + and - without surrounding whitespace are parsed as signed numbers, which invalidates the whole declaration.
This rule requires a single whitespace or a newline plus indentation before the + or - operator, and a single whitespace or a newline after that operator.
The fix option can automatically fix all of the problems reported by this rule.
This rule supports 1 message argument: the operator.
Options
Section titled “Options”{ "function-calc-no-unspaced-operator": true}The following patterns are considered problems:
a { top: calc(1px+2px); }a { top: calc(1px+ 2px); }a { transform: rotate(atan(-2+1)); }The following patterns are not considered problems:
a { top: calc(1px + 2px); }a { top: calc(calc(1em * 2) / 3); }a { top: calc(calc(1em*2)/3); }a { top: calc(var(--foo) + var(--bar));}a { top: calc(var(--foo) + var(--bar));}