Repository: vue-a11y/eslint-plugin-vuejs-accessibility (ts)

Issue:
Anchor has content question
Hi, I have a anchor tag that is an icon and, because of that, it has no text related to it. I've made some research and it seems we can use `aria-label` in scenarios like that. But, adding `aria-label` to the anchor tag, it still shows the error "vuejs-accessibility/anchor-has-content".

Should this rule consider a valid content, when the tag has aria-label attribute?

Thank you

Pull request:
For the `anchor-has-content` rule, allow anchors with explicit aria labels to pass
Closes #15


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2115072..d48ecb6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
 
 ## [Unreleased]
 
+### Changed
+
+- For the `anchor-has-content` rule, allow anchors with explicit aria labels to pass.
+
 ## [0.2.0] - 2020-06-26
 
 ### Changed
diff --git a/src/rules/anchor-has-content.js b/src/rules/anchor-has-content.js
index 904e63b..80a3e8c 100644
--- a/src/rules/anchor-has-content.js
+++ b/src/rules/anchor-has-content.js
@@ -1,6 +1,7 @@
 const {
   defineTemplateBodyVisitor,
   getElementType,
+  hasAriaLabel,
   hasContent,
   makeDocsURL
 } = require("../utils");
@@ -34,7 +35,11 @@ module.exports = {
         const elementTypes = ["a"].concat(components);
         const elementType = getElementType(node);
 
-        if (elementTypes.includes(elementType) && !hasContent(node)) {
+        if (
+          elementTypes.includes(elementType) &&
+          !hasContent(node) &&
+          !hasAriaLabel(node)
+        ) {
           context.report({ node, messageId: "default" });
         }
       }


Test patch:
diff --git a/src/rules/__tests__/anchor-has-content.test.js b/src/rules/__tests__/anchor-has-content.test.js
index cc9dcf3..7b0c8af 100644
--- a/src/rules/__tests__/anchor-has-content.test.js
+++ b/src/rules/__tests__/anchor-has-content.test.js
@@ -8,7 +8,8 @@ makeRuleTester("anchor-has-content", rule, {
     "<a v-text='msg' />",
     "<a v-html='msg' />",
     "<a><slot /></a>",
-    "<Anchor  />"
+    "<Anchor  />",
+    "<a aria-label='This is my label' />"
   ],
   invalid: [
     "<a />",