no headingless sections - speced/respec GitHub Wiki

no-headingless-sections linting rule

Default: true

Warns when a <section> element does not begin with a heading element (<h2><h6>).

Example violation

<!-- BAD: no heading -->
<section id="intro">
  <p>Content without a heading.</p>
</section>

How to fix

<section id="intro">
  <h2>Introduction</h2>
  <p>Content with a heading.</p>
</section>

How to disable

var respecConfig = {
  lint: { "no-headingless-sections": false },
};

Notes

  • Sections without headings are inaccessible — screen readers and ToC generation depend on headings
  • The one exception is the <body> element itself, which is not required to start with a heading
⚠️ **GitHub.com Fallback** ⚠️