Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Linter · Rules

jsx-a11y/scope

Disallow the scope attribute on elements other than <th>

scope tells a screen reader whether a header cell names its column or its row. It only means something on <th>. On a <td> or anything else it's ignored, so the cell you meant as a header is read as ordinary data.

Components aren't checked.

--fix removes the attribute. If the cell is a header, change it to a <th> instead.

Configure

Off by default. To turn it on:

bunfig.toml
[lint.rules]
"jsx-a11y/scope" = "error" # or "warn"

Examples

Reported:

const row = (
  <tr>
    <td scope="row">Total</td>
    <td>{total}</td>
  </tr>
);

Not reported:

const row = (
  <tr>
    <th scope="row">Total</th>
    <td>{total}</td>
  </tr>
);