import { BaseRuleVisitor, getTagName, hasAttribute } from "./rule-utils.js";
class AnchorRechireHrefVisitor extends BaseRuleVisitor {
    visitHTMLOpenTagNode(node) {
        this.checkATag(node);
        super.visitHTMLOpenTagNode(node);
    }
    checkATag(node) {
        const tagName = getTagName(node);
        if (tagName !== "a") {
            return;
        }
        if (!hasAttribute(node, "href")) {
            this.addOffense("Add an `href` attribute to `<a>` to ensure it is focusable and accessible.", node.tag_name.location, "error");
        }
    }
}
export class HTMLAnchorRequireHrefRule {
    name = "html-anchor-require-href";
    check(node) {
        const visitor = new AnchorRechireHrefVisitor(this.name);
        visitor.visit(node);
        return visitor.offenses;
    }
}
//# sourceMappingURL=html-anchor-require-href.js.map