Skip to content

Latest commit

 

History

History
61 lines (44 loc) · 1.41 KB

File metadata and controls

61 lines (44 loc) · 1.41 KB

ember/template-link-href-attributes

💼 This rule is enabled in the 📋 template-lint-migration config.

Requires href attribute on <a> elements.

Anchor elements should have an href attribute to be properly recognized as links by browsers and assistive technologies. If an element is meant to be interactive but not navigate, use a <button> instead.

Rule Details

This rule ensures that all <a> elements have an href attribute.

Examples

Examples of incorrect code for this rule:

<template>
  <a>Link</a>
</template>
<template>
  <a onclick={{this.handleClick}}>Click me</a>
</template>
<template>
  <a role="button">Action</a>
</template>

Examples of correct code for this rule:

<template>
  <a href="/about">About Us</a>
</template>
<template>
  <a href="https://example.com">External Link</a>
</template>
<template>
  <button {{on "click" this.handleClick}}>Click me</button>
</template>

References