Skip to content
Marcos Caceres edited this page Mar 27, 2026 · 8 revisions

no-unused-vars linting rule

Default: false

Warns when a <var> element in an algorithm is defined (first occurrence) but never referenced again. Only checks variables inside <ol class="algorithm"> sections.

Example violation

<ol class="algorithm">
  <li>Let |request| be a new request.</li>
  <li>Let |unused| be null.</li>       <!-- warned: never used again -->
  <li>Set |request|'s URL to the URL.</li>
</ol>

How to enable

var respecConfig = {
  lint: { "no-unused-vars": true },
};

Suppress for one variable

<var data-ignore-unused>someVar</var>

Notes

  • Only applies inside <ol class="algorithm"> sections
  • The first occurrence of a |variable| is treated as its definition
  • The |variable| shorthand does not support data-ignore-unused — use <var data-ignore-unused> explicitly

Guides

Configuration options

W3C Configuration options

Linting rules

Internal properties

Handled by ReSpec for you.

Special <section> IDs

HTML elements

Custom Elements

HTML attributes

CSS Classes

Special properties

Clone this wiki locally