Skip to main content

no-reversed-placement-lines

Disallow reversed or zero-width numeric CSS Grid placement line ranges.

Numeric line ranges such as grid-column: 4 / 2 and grid-row: 3 / 3 do not describe a forward span across tracks. This rule only compares plain numeric line pairs in the same block and ignores named lines, spans, mixed signs, and dynamic values.

Incorrectโ€‹

.item {
grid-column: 4 / 2;
}
.item {
grid-row-start: 7;
grid-row-end: 6;
}

Correctโ€‹

.item {
grid-column: 2 / 4;
}
.item {
grid-row: span 2 / 5;
}

Stylelint Configโ€‹

export default {
plugins: ["stylelint-plugin-grid"],
rules: {
"grid/no-reversed-placement-lines": true
}
};