Skip to content

Latest commit

 

History

History
67 lines (49 loc) · 1.4 KB

File metadata and controls

67 lines (49 loc) · 1.4 KB

ember/template-no-inline-linkto

🔧 This rule is automatically fixable by the --fix CLI option.

Disallows inline form of the LinkTo component.

Rule Details

The inline form of <LinkTo> (self-closing without content) should be avoided. Use the block form instead to provide link text.

This rule also disallows the curly {{link-to}} inline form (e.g., {{link-to "text" "route"}}). The block form {{#link-to}}...{{/link-to}} or <LinkTo> angle bracket syntax should be used instead.

Examples

Examples of incorrect code for this rule:

<template>
  <LinkTo @route="index" />
</template>
<template>
  <LinkTo @route="about"></LinkTo>
</template>
<template>
  {{link-to "Link text" "routeName"}}
</template>
<template>
  {{link-to "Link text" "routeName" prop1 prop2}}
</template>

Examples of correct code for this rule:

<template>
  <LinkTo @route="index">Home</LinkTo>
</template>
<template>
  <LinkTo @route="about">
    About Us
  </LinkTo>
</template>
<template>
  {{#link-to "routeName" prop1 prop2}}Link text{{/link-to}}
</template>

References