Skip to content

function-linear-gradient-no-nonstandard-direction

Reports a linear-gradient() that starts with a side keyword (top, left bottom) instead of to top or an angle.

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.

Reported
...
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);
...
css:
lint:
rules:
function-linear-gradient-no-nonstandard-direction: warn # off, warn (default), error
less:
lint:
rules:
function-linear-gradient-no-nonstandard-direction: warn # off, warn (default), error
scss:
lint:
rules:
function-linear-gradient-no-nonstandard-direction: warn # off, warn (default), error

Enabled 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.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
stylelint function-linear-gradient-no-nonstandard-direction full