function-linear-gradient-no-nonstandard-direction
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesscorrectnessno fixdefault: warncss/stylelint-recommended
What it does
Section titled “What it does”Reports a linear-gradient() that starts with a side keyword (top, left bottom) instead of to top or an angle.
Why it matters
Section titled “Why it matters”Before the standard, prefixed gradients named the side the gradient starts from. The standard names the side it goes to, so top and to top mean opposite directions. Code copied from the old notation draws the gradient reversed or is dropped.
To fix, write to bottom for a gradient that starts at the top, or use an angle.
Example
Section titled “Example”... background: linear-gradient(top, red, blue); background: linear-gradient(to top, red, blue); background: linear-gradient(45deg, red, blue); background: -webkit-linear-gradient(top, red, blue);...Configuration
Section titled “Configuration”css: lint: rules: function-linear-gradient-no-nonstandard-direction: warn # off, warn (default), errorless: lint: rules: function-linear-gradient-no-nonstandard-direction: warn # off, warn (default), errorscss: lint: rules: function-linear-gradient-no-nonstandard-direction: warn # off, warn (default), errorEnabled by the presets: css/stylelint-recommended.
Suppress one line with sudsy-disable-next-line function-linear-gradient-no-nonstandard-direction 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-linear-gradient-no-nonstandard-direction |
full |