diff --git a/lib/rules/template-require-input-label.js b/lib/rules/template-require-input-label.js index 747cc27f58..df540ed0ce 100644 --- a/lib/rules/template-require-input-label.js +++ b/lib/rules/template-require-input-label.js @@ -160,16 +160,10 @@ module.exports = { labelCount++; } - const hasId = hasAttr(node, 'id'); - const hasAriaLabel = hasAttr(node, 'aria-label'); - const hasAriaLabelledBy = hasAttr(node, 'aria-labelledby'); - if (hasId) { + if (hasAttr(node, 'aria-label')) { labelCount++; } - if (hasAriaLabel) { - labelCount++; - } - if (hasAriaLabelledBy) { + if (hasAttr(node, 'aria-labelledby')) { labelCount++; } @@ -177,7 +171,11 @@ module.exports = { return; } - if (validLabel && hasId) { + // An `id` may pair with a sibling `