Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 2.26 KB

File metadata and controls

77 lines (55 loc) · 2.26 KB

ember/template-no-invalid-link-text

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

Disallows invalid or uninformative link text content.

Link text should be descriptive and provide context about the destination. Generic phrases like "click here" or "read more" are not accessible because they don't convey meaningful information, especially for screen reader users who may navigate by links alone.

Rule Details

This rule disallows the following link text values:

  • "click here"
  • "more info"
  • "read more"
  • "more"

Comparison is case-insensitive and whitespace is normalized.

Links with a valid aria-label or aria-labelledby attribute are exempt. A valid aria-label must be non-empty and must not itself be a disallowed text value.

Examples

Examples of incorrect code for this rule:

<template>
  <a href="/about">Click here</a>
</template>
<template>
  <a href="/docs">Read more</a>
</template>
<template>
  <LinkTo @route="info">More info</LinkTo>
</template>

Examples of correct code for this rule:

<template>
  <a href="/about">About Us</a>
</template>
<template>
  <a href="/docs">Documentation</a>
</template>
<template>
  <a href="/page" aria-label="View user profile">Click here</a>
</template>

Options

Name Type Default Description
allowEmptyLinks boolean false When true, allows links with no text content.
linkComponents string[] [] Additional component names treated as links (besides <a> and <LinkTo>).

References