no-invalid-repeat-count
Disallow invalid fixed repeat counts in CSS Grid track templates.
The first argument to a fixed repeat() must be a positive integer. Counts such
as 0, negative numbers, and decimals make the track template invalid. This
rule leaves auto-fit, auto-fill, and dynamic values to the rules that own
those cases.
Incorrectโ
.layout {
grid-template-columns: repeat(0, 1fr);
}
.layout {
grid-template-rows: repeat(2.5, auto);
}
Correctโ
.layout {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.layout {
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}
Stylelint Configโ
export default {
plugins: ["stylelint-plugin-grid"],
rules: {
"grid/no-invalid-repeat-count": true
}
};
Related Rulesโ
no-invalid-auto-repeatchecks track sizes insiderepeat(auto-fit, ...)andrepeat(auto-fill, ...).validate-track-countscompares expanded track counts with named area templates.grid-recommendedenables this rule by default.