Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 1.38 KB

File metadata and controls

36 lines (22 loc) · 1.38 KB

ember/template-inline-link-to

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

Disallows the inline form of the link-to component and enforces the block form instead.

Ember's link-to component has both an inline form and a block form. This rule forbids the inline form.

Examples

This rule forbids the following (inline form):

{{link-to 'Link text' 'routeName' prop1 prop2}}

This rule allows the following (block form):

{{#link-to 'routeName' prop1 prop2}}Link text{{/link-to}}

Rationale

The block form is a little longer but has advantages over the inline form:

  • It maps closer to the use of HTML anchor tags which wrap their inner content.
  • It provides an obvious way for developers to put nested markup and components inside of their link.
  • The block form's argument order is more direct: "link to route". The inline form's argument order is somewhat ambiguous (link text then link target). This is opposite of the order in HTML (href then link text).

References