jsx-a11y/scope

Disallow the scope attribute on elements other than <th>

fixable

Also called jsx_a11y/scope

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#

example.jsx1 problem
const row = (
  <tr>
    <td scope="row">Total</td>
    <td>{total}</td>
  </tr>
);
example.jsxNo problems
const row = (
  <tr>
    <th scope="row">Total</th>
    <td>{total}</td>
  </tr>
);