function-calc-no-unspaced-operator
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesscorrectnessno fixdefault: warncss/stylelint-recommended
What it does
Section titled “What it does”Reports + and - inside calc() that lack whitespace on one or both sides (calc(1px+2px)), on the operator.
Why it matters
Section titled “Why it matters”CSS requires whitespace around + and - in calc(); 1px+2px is read as a number with a sign, not as a sum, so the whole declaration is invalid and the browser drops it. * and / do not need the space.
To fix, put a space on each side of the operator.
Example
Section titled “Example”... width: calc(-#{$x} + 10px); width: calc(10px + -#{$x}); width: calc(10px - -$x); width: calc(10px -#{$x});}Configuration
Section titled “Configuration”css: lint: rules: function-calc-no-unspaced-operator: warn # off, warn (default), errorless: lint: rules: function-calc-no-unspaced-operator: warn # off, warn (default), errorscss: lint: rules: function-calc-no-unspaced-operator: warn # off, warn (default), errorEnabled by the presets: css/stylelint-recommended.
Suppress one line with sudsy-disable-next-line function-calc-no-unspaced-operator in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint | function-calc-no-unspaced-operator |
full |