-
-
Notifications
You must be signed in to change notification settings - Fork 392
no unused vars
Sid Vishnoi edited this page Jul 8, 2020
·
7 revisions
Enable this lint rule to get a warning if a variable is defined but not used. The first use of variable (<var>
) is considered its definition. Only unused variables in sections that contain a <ol class="algorithm"></ol>
are reported.
For example:
<section id="foo">
<p>|varA| is defined here.</p>
<ol class="algorithm">
<li>|varA| is used here.</li>
<li>|varB| is unused.</li>
<li>|varC| is not unused as it's used again as |varC|.</li>
</ol>
</section>
You'll receive a warning pointing you to the unused <var>
s.
var respecConfig = {
lint: {
"no-unused-vars": true,
},
};
To ignore warning on per-variable basis, add a data-ignore-unused
attribute to <var>
as:
<var data-ignore-unused>someUnusedVar</var> is unused, but warning is ignored.
Note that the |someVar|
shorthand does not support this attribute.
💖 Support ReSpec by becoming a sponsor via Open Collective. 💖
✨ View rendered version of this documentation at https://respec.org/docs/ ✨
- addSectionLinks
- authors
- caniuse
- edDraftURI
- editors
- favicon
- format (markdown)
- formerEditors
- github
- highlightVars
- isPreview
- license
- lint
- localBiblio
- logos
- maxTocLevel
- mdn
- modificationDate
- noTOC
- otherLinks
- pluralize
- postProcess
- preProcess
- previousDiffURI
- previousMaturity
- previousPublishDate
- prevRecShortname
- prevRecURI
-
processVersion(Deprecated) - publishDate
-
refNote(Deprecated) - shortName
- specStatus
- subjectPrefix
- subtitle
- testSuiteURI
- xref
- additionalCopyrightHolders
-
addPatentNote(Deprecated) - alternateFormats
- canonicalURI
- charterDisclosureURI
- copyrightStart
- crEnd
-
darkMode(deprecated, use dark mode) - doJsonLd
- errata
- group
- implementationReportURI
- lcEnd
- level
- noRecTrack
- prevED
- submissionCommentNumber
-
wg(Deprecated) -
wgId(Deprecated) -
wgPatentPolicy(Deprecated) -
wgPatentURI(Deprecated) - wgPublicList
-
wgURI(Deprecated)
a11y
check-punctuation
local-refs-exist
no-headingless-sections
no-http-props
no-unused-vars
no-unused-dfns
informative-dfn
privsec-section
wpt-tests-exist
Handled by ReSpec for you.
- data-abbr
-
data-cite(Not recommended) - data-dfn-for
- data-dfn-type
- data-format
- data-include-format
- data-include-replace
- data-include
- data-link-for
- data-link-type
- data-local-lt
- data-lt-no-plural
- data-lt-noDefault
- data-lt
- data-number
- data-oninclude
- data-sort
- data-tests
-
data-transform(Deprecated) - data-type
- dir
- lang