stylelint-plugin-grid 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/LICENSE +21 -0
  3. package/README.md +93 -0
  4. package/dist/_internal/create-stylelint-rule.d.ts +49 -0
  5. package/dist/_internal/create-stylelint-rule.d.ts.map +1 -0
  6. package/dist/_internal/create-stylelint-rule.js +34 -0
  7. package/dist/_internal/create-stylelint-rule.js.map +1 -0
  8. package/dist/_internal/grid-template-analysis.d.ts +62 -0
  9. package/dist/_internal/grid-template-analysis.d.ts.map +1 -0
  10. package/dist/_internal/grid-template-analysis.js +346 -0
  11. package/dist/_internal/grid-template-analysis.js.map +1 -0
  12. package/dist/_internal/plugin-constants.d.ts +30 -0
  13. package/dist/_internal/plugin-constants.d.ts.map +1 -0
  14. package/dist/_internal/plugin-constants.js +47 -0
  15. package/dist/_internal/plugin-constants.js.map +1 -0
  16. package/dist/_internal/rules-registry.d.ts +10 -0
  17. package/dist/_internal/rules-registry.d.ts.map +1 -0
  18. package/dist/_internal/rules-registry.js +31 -0
  19. package/dist/_internal/rules-registry.js.map +1 -0
  20. package/dist/configs/grid-all.cjs +3 -0
  21. package/dist/configs/grid-all.d.cts +3 -0
  22. package/dist/configs/grid-all.d.ts +9 -0
  23. package/dist/configs/grid-all.d.ts.map +1 -0
  24. package/dist/configs/grid-all.js +9 -0
  25. package/dist/configs/grid-all.js.map +1 -0
  26. package/dist/configs/grid-recommended.cjs +3 -0
  27. package/dist/configs/grid-recommended.d.cts +3 -0
  28. package/dist/configs/grid-recommended.d.ts +9 -0
  29. package/dist/configs/grid-recommended.d.ts.map +1 -0
  30. package/dist/configs/grid-recommended.js +9 -0
  31. package/dist/configs/grid-recommended.js.map +1 -0
  32. package/dist/plugin.cjs +1268 -0
  33. package/dist/plugin.cjs.map +7 -0
  34. package/dist/plugin.d.cts +45 -0
  35. package/dist/plugin.d.ts +45 -0
  36. package/dist/plugin.d.ts.map +1 -0
  37. package/dist/plugin.js +78 -0
  38. package/dist/plugin.js.map +1 -0
  39. package/dist/rules/consistent-area-naming.d.ts +12 -0
  40. package/dist/rules/consistent-area-naming.d.ts.map +1 -0
  41. package/dist/rules/consistent-area-naming.js +86 -0
  42. package/dist/rules/consistent-area-naming.js.map +1 -0
  43. package/dist/rules/no-dense-auto-flow.d.ts +8 -0
  44. package/dist/rules/no-dense-auto-flow.d.ts.map +1 -0
  45. package/dist/rules/no-dense-auto-flow.js +44 -0
  46. package/dist/rules/no-dense-auto-flow.js.map +1 -0
  47. package/dist/rules/no-invalid-areas.d.ts +8 -0
  48. package/dist/rules/no-invalid-areas.d.ts.map +1 -0
  49. package/dist/rules/no-invalid-areas.js +42 -0
  50. package/dist/rules/no-invalid-areas.js.map +1 -0
  51. package/dist/rules/no-invalid-auto-repeat.d.ts +8 -0
  52. package/dist/rules/no-invalid-auto-repeat.d.ts.map +1 -0
  53. package/dist/rules/no-invalid-auto-repeat.js +189 -0
  54. package/dist/rules/no-invalid-auto-repeat.js.map +1 -0
  55. package/dist/rules/no-invalid-minmax.d.ts +8 -0
  56. package/dist/rules/no-invalid-minmax.d.ts.map +1 -0
  57. package/dist/rules/no-invalid-minmax.js +58 -0
  58. package/dist/rules/no-invalid-minmax.js.map +1 -0
  59. package/dist/rules/no-mismatched-template-rows.d.ts +8 -0
  60. package/dist/rules/no-mismatched-template-rows.d.ts.map +1 -0
  61. package/dist/rules/no-mismatched-template-rows.js +50 -0
  62. package/dist/rules/no-mismatched-template-rows.js.map +1 -0
  63. package/dist/rules/no-overlapping-areas.d.ts +8 -0
  64. package/dist/rules/no-overlapping-areas.d.ts.map +1 -0
  65. package/dist/rules/no-overlapping-areas.js +48 -0
  66. package/dist/rules/no-overlapping-areas.js.map +1 -0
  67. package/dist/rules/no-unknown-areas.d.ts +8 -0
  68. package/dist/rules/no-unknown-areas.d.ts.map +1 -0
  69. package/dist/rules/no-unknown-areas.js +47 -0
  70. package/dist/rules/no-unknown-areas.js.map +1 -0
  71. package/dist/rules/no-unused-areas.d.ts +8 -0
  72. package/dist/rules/no-unused-areas.d.ts.map +1 -0
  73. package/dist/rules/no-unused-areas.js +48 -0
  74. package/dist/rules/no-unused-areas.js.map +1 -0
  75. package/dist/rules/prefer-gap-properties.d.ts +8 -0
  76. package/dist/rules/prefer-gap-properties.d.ts.map +1 -0
  77. package/dist/rules/prefer-gap-properties.js +58 -0
  78. package/dist/rules/prefer-gap-properties.js.map +1 -0
  79. package/dist/rules/require-explicit-rows-with-column-flow.d.ts +8 -0
  80. package/dist/rules/require-explicit-rows-with-column-flow.d.ts.map +1 -0
  81. package/dist/rules/require-explicit-rows-with-column-flow.js +52 -0
  82. package/dist/rules/require-explicit-rows-with-column-flow.js.map +1 -0
  83. package/dist/rules/validate-area-shapes.d.ts +8 -0
  84. package/dist/rules/validate-area-shapes.d.ts.map +1 -0
  85. package/dist/rules/validate-area-shapes.js +47 -0
  86. package/dist/rules/validate-area-shapes.js.map +1 -0
  87. package/dist/rules/validate-track-counts.d.ts +9 -0
  88. package/dist/rules/validate-track-counts.d.ts.map +1 -0
  89. package/dist/rules/validate-track-counts.js +67 -0
  90. package/dist/rules/validate-track-counts.js.map +1 -0
  91. package/docs/rules/configs/grid-all.md +42 -0
  92. package/docs/rules/configs/grid-recommended.md +37 -0
  93. package/docs/rules/configs/index.md +46 -0
  94. package/docs/rules/consistent-area-naming.md +41 -0
  95. package/docs/rules/getting-started.md +55 -0
  96. package/docs/rules/guides/current-status.md +44 -0
  97. package/docs/rules/no-dense-auto-flow.md +57 -0
  98. package/docs/rules/no-invalid-areas.md +55 -0
  99. package/docs/rules/no-invalid-auto-repeat.md +58 -0
  100. package/docs/rules/no-invalid-minmax.md +57 -0
  101. package/docs/rules/no-mismatched-template-rows.md +36 -0
  102. package/docs/rules/no-overlapping-areas.md +40 -0
  103. package/docs/rules/no-unknown-areas.md +39 -0
  104. package/docs/rules/no-unused-areas.md +44 -0
  105. package/docs/rules/overview.md +54 -0
  106. package/docs/rules/prefer-gap-properties.md +45 -0
  107. package/docs/rules/require-explicit-rows-with-column-flow.md +56 -0
  108. package/docs/rules/validate-area-shapes.md +46 -0
  109. package/docs/rules/validate-track-counts.md +39 -0
  110. package/package.json +355 -0
@@ -0,0 +1,55 @@
1
+ # no-invalid-areas
2
+
3
+ Disallow malformed `grid-template-areas` declarations.
4
+
5
+ This rule reports:
6
+
7
+ - values without quoted row strings
8
+ - row strings with different column counts
9
+ - area tokens that are neither valid custom identifiers nor blank `.` markers
10
+
11
+ ## Incorrect
12
+
13
+ ```css
14
+ .layout {
15
+ grid-template-areas:
16
+ "header header"
17
+ "nav";
18
+ }
19
+ ```
20
+
21
+ ```css
22
+ .layout {
23
+ grid-template-areas: "main 1bad";
24
+ }
25
+ ```
26
+
27
+ ## Correct
28
+
29
+ ```css
30
+ .layout {
31
+ grid-template-areas:
32
+ "header header"
33
+ "nav main";
34
+ }
35
+ ```
36
+
37
+ ## Stylelint Config
38
+
39
+ ```js
40
+ export default {
41
+ plugins: ["stylelint-plugin-grid"],
42
+ rules: {
43
+ "grid/no-invalid-areas": true
44
+ }
45
+ };
46
+ ```
47
+
48
+ ## Related Rules
49
+
50
+ - [`validate-area-shapes`](./validate-area-shapes.md) checks whether parsed named
51
+ areas form rectangles.
52
+ - [`validate-track-counts`](./validate-track-counts.md) compares parsed template
53
+ dimensions with sibling track declarations.
54
+ - [`grid-recommended`](./configs/grid-recommended.md) enables this rule by
55
+ default.
@@ -0,0 +1,58 @@
1
+ # no-invalid-auto-repeat
2
+
3
+ Disallow definitely invalid CSS Grid auto-repeat track sizes.
4
+
5
+ CSS Grid auto-repeat only accepts fixed track sizes. This rule catches common
6
+ invalid patterns such as bare `fr` tracks and `minmax()` calls with intrinsic or
7
+ flexible minimums inside `repeat(auto-fit, ...)` or `repeat(auto-fill, ...)`.
8
+
9
+ The rule checks `grid-template-columns` and `grid-template-rows`. It avoids
10
+ reporting runtime-dependent values such as `var()` and `env()`.
11
+
12
+ ## Incorrect
13
+
14
+ ```css
15
+ .cards {
16
+ grid-template-columns: repeat(auto-fit, 1fr);
17
+ }
18
+ ```
19
+
20
+ ```css
21
+ .cards {
22
+ grid-template-columns: repeat(auto-fill, minmax(auto, 1fr));
23
+ }
24
+ ```
25
+
26
+ ## Correct
27
+
28
+ ```css
29
+ .cards {
30
+ grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
31
+ }
32
+ ```
33
+
34
+ ```css
35
+ .cards {
36
+ grid-template-columns: repeat(auto-fill, [card] minmax(0, 1fr));
37
+ }
38
+ ```
39
+
40
+ ## Stylelint Config
41
+
42
+ ```js
43
+ export default {
44
+ plugins: ["stylelint-plugin-grid"],
45
+ rules: {
46
+ "grid/no-invalid-auto-repeat": true
47
+ }
48
+ };
49
+ ```
50
+
51
+ ## Related Rules
52
+
53
+ - [`no-invalid-minmax`](./no-invalid-minmax.md) checks invalid `minmax()`
54
+ minimums outside auto-repeat contexts too.
55
+ - [`validate-track-counts`](./validate-track-counts.md) compares explicit track
56
+ counts with named area templates.
57
+ - [`grid-recommended`](./configs/grid-recommended.md) enables this rule by
58
+ default.
@@ -0,0 +1,57 @@
1
+ # no-invalid-minmax
2
+
3
+ Disallow flexible `fr` values as the minimum argument in CSS Grid `minmax()`
4
+ track sizes.
5
+
6
+ In CSS Grid track sizing, the first `minmax()` argument must be an inflexible
7
+ minimum. A value such as `minmax(1fr, 20rem)` is invalid and can cause the
8
+ browser to ignore the declaration. Use an inflexible minimum such as `0`, a
9
+ length, or a percentage instead.
10
+
11
+ ## Incorrect
12
+
13
+ ```css
14
+ .layout {
15
+ grid-template-columns: minmax(1fr, 20rem) 2fr;
16
+ }
17
+ ```
18
+
19
+ ```css
20
+ .layout {
21
+ grid-auto-rows: minmax(0.5fr, auto);
22
+ }
23
+ ```
24
+
25
+ ## Correct
26
+
27
+ ```css
28
+ .layout {
29
+ grid-template-columns: minmax(0, 1fr) minmax(12rem, 20rem);
30
+ }
31
+ ```
32
+
33
+ ```css
34
+ .layout {
35
+ grid-auto-rows: minmax(10rem, auto);
36
+ }
37
+ ```
38
+
39
+ ## Stylelint Config
40
+
41
+ ```js
42
+ export default {
43
+ plugins: ["stylelint-plugin-grid"],
44
+ rules: {
45
+ "grid/no-invalid-minmax": true
46
+ }
47
+ };
48
+ ```
49
+
50
+ ## Related Rules
51
+
52
+ - [`no-invalid-auto-repeat`](./no-invalid-auto-repeat.md) checks auto-repeat
53
+ track sizes that must be fixed.
54
+ - [`validate-track-counts`](./validate-track-counts.md) compares explicit track
55
+ counts with named area templates.
56
+ - [`grid-recommended`](./configs/grid-recommended.md) enables this rule by
57
+ default.
@@ -0,0 +1,36 @@
1
+ # no-mismatched-template-rows
2
+
3
+ Require `grid-template-rows` track count to match `grid-template-areas` row
4
+ count when both declarations appear in the same block.
5
+
6
+ ## Incorrect
7
+
8
+ ```css
9
+ .layout {
10
+ grid-template-areas:
11
+ "header"
12
+ "main";
13
+ grid-template-rows: auto;
14
+ }
15
+ ```
16
+
17
+ ## Correct
18
+
19
+ ```css
20
+ .layout {
21
+ grid-template-areas:
22
+ "header"
23
+ "main";
24
+ grid-template-rows: auto 1fr;
25
+ }
26
+ ```
27
+
28
+ Dynamic track lists such as `repeat(auto-fit, ...)` are skipped because their
29
+ count cannot be known statically.
30
+
31
+ ## Related Rules
32
+
33
+ - [`validate-track-counts`](./validate-track-counts.md) also checks column-count
34
+ drift.
35
+ - [`no-invalid-areas`](./no-invalid-areas.md) validates the parsed template rows.
36
+ - [`grid-recommended`](./configs/grid-recommended.md) enables this rule by default.
@@ -0,0 +1,40 @@
1
+ # no-overlapping-areas
2
+
3
+ Disallow multiple selectors assigning the same single-name `grid-area` value in
4
+ one stylesheet.
5
+
6
+ This rule is not recommended by default because some projects intentionally
7
+ stack multiple items in the same area. Use it when duplicate area assignments
8
+ usually indicate layout collisions in your codebase.
9
+
10
+ ## Incorrect
11
+
12
+ ```css
13
+ .header {
14
+ grid-area: header;
15
+ }
16
+
17
+ .mobileHeader {
18
+ grid-area: header;
19
+ }
20
+ ```
21
+
22
+ ## Correct
23
+
24
+ ```css
25
+ .header {
26
+ grid-area: header;
27
+ }
28
+
29
+ .sidebar {
30
+ grid-area: sidebar;
31
+ }
32
+ ```
33
+
34
+ ## Related Rules
35
+
36
+ - [`no-unused-areas`](./no-unused-areas.md) verifies that declared template areas
37
+ are actually assigned.
38
+ - [`no-unknown-areas`](./no-unknown-areas.md) verifies that assigned area names
39
+ exist in a template.
40
+ - [`grid-all`](./configs/grid-all.md) enables this stricter same-stylesheet rule.
@@ -0,0 +1,39 @@
1
+ # no-unknown-areas
2
+
3
+ Disallow single-name `grid-area` references that do not match any named area
4
+ declared by `grid-template-areas` in the same stylesheet.
5
+
6
+ ## Incorrect
7
+
8
+ ```css
9
+ .layout {
10
+ grid-template-areas: "header main";
11
+ }
12
+
13
+ .sidebar {
14
+ grid-area: sidebr;
15
+ }
16
+ ```
17
+
18
+ ## Correct
19
+
20
+ ```css
21
+ .layout {
22
+ grid-template-areas: "header main";
23
+ }
24
+
25
+ .header {
26
+ grid-area: header;
27
+ }
28
+ ```
29
+
30
+ The rule only checks single-name `grid-area` declarations. Line-based shorthand
31
+ placements are ignored.
32
+
33
+ ## Related Rules
34
+
35
+ - [`no-unused-areas`](./no-unused-areas.md) checks the inverse problem: declared
36
+ template areas without matching item assignments.
37
+ - [`no-overlapping-areas`](./no-overlapping-areas.md) reports duplicate
38
+ single-name assignments in the same stylesheet.
39
+ - [Current status](./guides/current-status.md) explains the same-file assumptions.
@@ -0,0 +1,44 @@
1
+ # no-unused-areas
2
+
3
+ Disallow named template areas that are never referenced by a single-name
4
+ `grid-area` declaration in the same stylesheet.
5
+
6
+ This rule is intentionally not recommended by default. It is useful when grid
7
+ containers and grid items are authored together, but it can be noisy when
8
+ templates and items live in separate files.
9
+
10
+ ## Incorrect
11
+
12
+ ```css
13
+ .layout {
14
+ grid-template-areas: "header main";
15
+ }
16
+
17
+ .main {
18
+ grid-area: main;
19
+ }
20
+ ```
21
+
22
+ ## Related Rules
23
+
24
+ - [`no-unknown-areas`](./no-unknown-areas.md) catches item assignments that do not
25
+ exist in any same-stylesheet template.
26
+ - [`no-overlapping-areas`](./no-overlapping-areas.md) catches duplicate
27
+ single-name assignments.
28
+ - [`grid-all`](./configs/grid-all.md) enables this stricter same-stylesheet rule.
29
+
30
+ ## Correct
31
+
32
+ ```css
33
+ .layout {
34
+ grid-template-areas: "header main";
35
+ }
36
+
37
+ .header {
38
+ grid-area: header;
39
+ }
40
+
41
+ .main {
42
+ grid-area: main;
43
+ }
44
+ ```
@@ -0,0 +1,54 @@
1
+ ---
2
+ title: Overview
3
+ description: Overview of stylelint-plugin-grid and its package surface.
4
+ ---
5
+
6
+ # stylelint-plugin-grid
7
+
8
+ `stylelint-plugin-grid` validates authored CSS Grid templates, area
9
+ assignments, and grid-specific compatibility patterns that generic declaration
10
+ rules do not understand.
11
+
12
+ The package intentionally focuses on static CSS that Stylelint can inspect
13
+ reliably: `grid-template-areas`, sibling template track declarations, and
14
+ single-name `grid-area` assignments.
15
+
16
+ ## Exports
17
+
18
+ - A default Stylelint plugin pack export.
19
+ - A plugin-scoped shareable config map: `gridPluginConfigs`
20
+ - `grid-recommended`
21
+ - `grid-all`
22
+ - Static metadata exports: `meta`, `rules`, `ruleNames`, `ruleIds`, and
23
+ `configNames`.
24
+
25
+ ## Rule Families
26
+
27
+ The initial catalog covers:
28
+
29
+ - malformed `grid-template-areas` row strings and area tokens
30
+ - non-rectangular named areas
31
+ - invalid auto-repeat and `minmax()` track sizing syntax
32
+ - row and column track-count drift
33
+ - unknown or unused named area references
34
+ - duplicate single-name area assignments that can create overlapping grid items
35
+ - consistent grid area naming
36
+ - dense auto-placement patterns that can disconnect visual and source order
37
+ - column auto-placement blocks that omit explicit row sizing
38
+ - migration from legacy `grid-gap` aliases to modern gap properties
39
+
40
+ The package does not try to infer runtime layout across separate files,
41
+ framework conditionals, or class composition. Rules that need same-stylesheet
42
+ knowledge are kept out of `grid-recommended` unless their false-positive risk is
43
+ low.
44
+
45
+ ## Next Steps
46
+
47
+ - [Install and configure the plugin](./getting-started.md).
48
+ - [Compare the shareable configs](./configs/).
49
+ - [Review the current static-analysis boundaries](./guides/current-status.md).
50
+ - Start with [`no-invalid-areas`](./no-invalid-areas.md),
51
+ [`no-invalid-auto-repeat`](./no-invalid-auto-repeat.md),
52
+ [`no-invalid-minmax`](./no-invalid-minmax.md),
53
+ [`validate-area-shapes`](./validate-area-shapes.md), and
54
+ [`validate-track-counts`](./validate-track-counts.md) for template correctness.
@@ -0,0 +1,45 @@
1
+ # prefer-gap-properties
2
+
3
+ Prefer modern `gap`, `row-gap`, and `column-gap` over legacy grid gap aliases.
4
+
5
+ This rule is autofixable.
6
+
7
+ ## Incorrect
8
+
9
+ ```css
10
+ .layout {
11
+ display: grid;
12
+ grid-gap: 1rem;
13
+ grid-column-gap: 2rem;
14
+ }
15
+ ```
16
+
17
+ ## Correct
18
+
19
+ ```css
20
+ .layout {
21
+ display: grid;
22
+ gap: 1rem;
23
+ column-gap: 2rem;
24
+ }
25
+ ```
26
+
27
+ ## Stylelint Config
28
+
29
+ ```js
30
+ export default {
31
+ plugins: ["stylelint-plugin-grid"],
32
+ rules: {
33
+ "grid/prefer-gap-properties": true
34
+ }
35
+ };
36
+ ```
37
+
38
+ ## Related Docs
39
+
40
+ - [Getting Started](./getting-started.md) shows how to enable the recommended
41
+ baseline.
42
+ - [`grid-recommended`](./configs/grid-recommended.md) enables this autofixable rule
43
+ by default.
44
+ - [`validate-track-counts`](./validate-track-counts.md) covers template dimensions
45
+ after gap declarations are modernized.
@@ -0,0 +1,56 @@
1
+ # require-explicit-rows-with-column-flow
2
+
3
+ Require explicit row sizing when a rule uses `grid-auto-flow: column`.
4
+
5
+ Column auto-placement fills columns instead of rows. Without row sizing in the
6
+ same block, browsers can create implicit tracks in surprising ways and produce a
7
+ single long row-like layout. This rule asks for either `grid-template-rows` or
8
+ `grid-auto-rows` next to the `grid-auto-flow: column` declaration.
9
+
10
+ This is intentionally an opt-in policy rule. It checks same-block declarations
11
+ only and does not try to infer row sizing from other selectors or media-query
12
+ cascade layers.
13
+
14
+ ## Incorrect
15
+
16
+ ```css
17
+ .cards {
18
+ grid-auto-flow: column;
19
+ grid-template-columns: repeat(3, 1fr);
20
+ }
21
+ ```
22
+
23
+ ## Correct
24
+
25
+ ```css
26
+ .cards {
27
+ grid-auto-flow: column;
28
+ grid-auto-rows: minmax(10rem, auto);
29
+ }
30
+ ```
31
+
32
+ ```css
33
+ .cards {
34
+ grid-auto-flow: column;
35
+ grid-template-rows: repeat(3, minmax(0, 1fr));
36
+ }
37
+ ```
38
+
39
+ ## Stylelint Config
40
+
41
+ ```js
42
+ export default {
43
+ plugins: ["stylelint-plugin-grid"],
44
+ rules: {
45
+ "grid/require-explicit-rows-with-column-flow": true
46
+ }
47
+ };
48
+ ```
49
+
50
+ ## Related Rules
51
+
52
+ - [`no-dense-auto-flow`](./no-dense-auto-flow.md) catches dense packing mode
53
+ when source order safety matters.
54
+ - [`validate-track-counts`](./validate-track-counts.md) compares explicit track
55
+ counts with named area templates.
56
+ - [`grid-all`](./configs/grid-all.md) enables this stricter policy rule.
@@ -0,0 +1,46 @@
1
+ # validate-area-shapes
2
+
3
+ Require every named grid template area to form one contiguous rectangle.
4
+
5
+ CSS Grid rejects non-rectangular areas. This rule catches the problem at the
6
+ authored template declaration instead of leaving it to browser behavior.
7
+
8
+ ## Incorrect
9
+
10
+ ```css
11
+ .layout {
12
+ grid-template-areas:
13
+ "main side"
14
+ "main main";
15
+ }
16
+ ```
17
+
18
+ ## Correct
19
+
20
+ ```css
21
+ .layout {
22
+ grid-template-areas:
23
+ "main side"
24
+ "main side";
25
+ }
26
+ ```
27
+
28
+ ## Stylelint Config
29
+
30
+ ```js
31
+ export default {
32
+ plugins: ["stylelint-plugin-grid"],
33
+ rules: {
34
+ "grid/validate-area-shapes": true
35
+ }
36
+ };
37
+ ```
38
+
39
+ ## Related Rules
40
+
41
+ - [`no-invalid-areas`](./no-invalid-areas.md) catches malformed template strings
42
+ before shape validation matters.
43
+ - [`validate-track-counts`](./validate-track-counts.md) checks the track dimensions
44
+ for the same template.
45
+ - [`no-mismatched-template-rows`](./no-mismatched-template-rows.md) focuses only on
46
+ row-count drift.
@@ -0,0 +1,39 @@
1
+ # validate-track-counts
2
+
3
+ Require sibling `grid-template-rows` and `grid-template-columns` declarations to
4
+ match the dimensions of `grid-template-areas`.
5
+
6
+ ## Incorrect
7
+
8
+ ```css
9
+ .layout {
10
+ grid-template-areas:
11
+ "nav main"
12
+ "nav footer";
13
+ grid-template-columns: 12rem;
14
+ grid-template-rows: auto auto auto;
15
+ }
16
+ ```
17
+
18
+ ## Correct
19
+
20
+ ```css
21
+ .layout {
22
+ grid-template-areas:
23
+ "nav main"
24
+ "nav footer";
25
+ grid-template-columns: 12rem 1fr;
26
+ grid-template-rows: auto auto;
27
+ }
28
+ ```
29
+
30
+ The rule understands explicit tracks and integer `repeat(...)` notation. It
31
+ skips dynamic repeat counts.
32
+
33
+ ## Related Rules
34
+
35
+ - [`no-invalid-areas`](./no-invalid-areas.md) validates the template rows this rule
36
+ measures.
37
+ - [`no-mismatched-template-rows`](./no-mismatched-template-rows.md) is the narrower
38
+ row-only check.
39
+ - [`grid-recommended`](./configs/grid-recommended.md) enables this rule by default.