no dfn in abstract - speced/respec GitHub Wiki

no-dfn-in-abstract linting rule

Default: false

Warns when a <dfn> element appears in <section id="abstract">, <section id="sotd">, or any other unnumbered section.

The abstract is a summary of the spec, not a definitions section. Definitions placed there are semantically out of place and appear in the terms index without section numbers.

How to enable

var respecConfig = {
  lint: { "no-dfn-in-abstract": true },
};

Example violation

<!-- BAD: dfn in the abstract -->
<section id="abstract">
  <p>This spec defines the <dfn data-export>widget</dfn> API.</p>
</section>

How to fix

Move the definition to a numbered section:

<section id="abstract">
  <p>This spec defines the Widget API.</p>
</section>

<section>
  <h2>Terminology</h2>
  <p>A <dfn data-export>widget</dfn> is a user interface component.</p>
</section>

How to disable

var respecConfig = {
  lint: { "no-dfn-in-abstract": false },
};

Notes

  • This rule is opt-in (false by default) — many existing specs have dfns in their abstract
  • Applies to all <dfn> elements, not just exported ones
  • Exported dfns in unnumbered sections cause a terms index crash in some versions of ReSpec — see bug #5133
⚠️ **GitHub.com Fallback** ⚠️