---
# Don't modify this file manually. This file is auto generated from source, and you will lose your changes next time the website is built.
# Head to the `biomejs/biome` repository, and modify the source code in there.

title: noInvalidGridAreas
description: Learn more about noInvalidGridAreas
---
import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs>
<TabItem label="CSS" icon="seti:css">
## Summary
- Rule available since: `v1.9.0`
- Diagnostic Category: [`lint/correctness/noInvalidGridAreas`](/reference/diagnostics#diagnostic-category)
- This rule is **recommended**, meaning it is enabled by default.
- This rule doesn't have a fix.
- The default severity of this rule is [**error**](/reference/diagnostics#error).
- Sources: 
  - Same as [`named-grid-areas-no-invalid`](https://github.com/stylelint/stylelint/blob/main/lib/rules/named-grid-areas-no-invalid/README.md)

## How to configure
```json title="biome.json"
{
	"linter": {
		"rules": {
			"correctness": {
				"noInvalidGridAreas": "error"
			}
		}
	}
}

```
## Description
Disallows invalid named grid areas in CSS Grid Layouts.

For a named grid area to be valid, all strings must define:

- the same number of cell tokens
- at least one cell token

And all named grid areas that spans multiple grid cells must form a single filled-in rectangle.

## Examples

### Invalid

```css
a { grid-template-areas: "a a"
                         "b b b"; }
```

<pre class="language-text"><code class="language-text">code-block.css:1:26 <a href="https://biomejs.dev/linter/rules/use-consistent-grid-areas">lint/correctness/noInvalidGridAreas</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Inconsistent cell count in grid areas are not allowed.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>a &#123; grid-template-areas: &quot;a a&quot;<br />   <strong>   │ </strong>                         <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong>                         &quot;b b b&quot;; &#125;<br />    <strong>3 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Consider adding the same number of cell tokens in each string.</span><br />  <br /></code></pre>

```css
a { grid-template-areas: "b b b"
                         ""; }
```

<pre class="language-text"><code class="language-text">code-block.css:1:33 <a href="https://biomejs.dev/linter/rules/use-consistent-grid-areas">lint/correctness/noInvalidGridAreas</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Empty grid areas are not allowed.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>a &#123; grid-template-areas: &quot;b b b&quot;<br />   <strong>   │ </strong>                                <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>2 │ </strong>                         &quot;&quot;; &#125;<br />   <strong>   │ </strong>                         <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>3 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Consider adding the cell token within string.</span><br />  <br /></code></pre>

```css
a { grid-template-areas: "a a a"
                         "b b a"; }
```

<pre class="language-text"><code class="language-text">code-block.css:1:33 <a href="https://biomejs.dev/linter/rules/use-consistent-grid-areas">lint/correctness/noInvalidGridAreas</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Duplicate filled in rectangle are not allowed.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>a &#123; grid-template-areas: &quot;a a a&quot;<br />   <strong>   │ </strong>                                <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>2 │ </strong>                         &quot;b b a&quot;; &#125;<br />   <strong>   │ </strong>                         <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>3 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Consider removing the duplicated filled-in rectangle: </span><span style="color: lightgreen;"><strong>a</strong></span><br />  <br /></code></pre>

### Valid

```css
a { grid-template-areas: "a a a"
                         "b b b"; }
```

```css
a { grid-template-areas: "a a a"
                         "a a a"; }
```

## Related links

- [Disable a rule](/linter/#disable-a-rule)
- [Configure the code fix](/linter#configure-the-code-fix)
- [Rule options](/linter/#rule-options)
- [Source Code](https://github.com/biomejs/biome/blob/main/crates/biome_css_analyze/src/lint/correctness/no_invalid_grid_areas.rs)
- [Test Cases](https://github.com/biomejs/biome/blob/main/crates/biome_css_analyze/tests/specs/correctness/noInvalidGridAreas)

</TabItem>
</Tabs>