Skip to content

Latest commit

 

History

History
74 lines (52 loc) · 1.53 KB

File metadata and controls

74 lines (52 loc) · 1.53 KB

ember/template-no-route-action

💼 This rule is enabled in the following configs: strict-gjs, strict-gts.

Disallows the use of the {{route-action}} helper.

The route-action helper from ember-route-action-helper is deprecated. Modern Ember applications should use the {{fn}} helper or closure actions instead.

Rule Details

This rule disallows the use of {{route-action}} in templates.

Examples

Examples of incorrect code for this rule:

<template>
  {{route-action "save"}}
</template>
<template>
  <button {{on "click" (route-action "save")}}>Save</button>
</template>
<template>
  <Component @action={{route-action "update"}} />
</template>

Examples of correct code for this rule:

<template>
  <button {{on "click" (fn this.save)}}>Save</button>
</template>
<template>
  <button {{on "click" this.handleClick}}>Click</button>
</template>
<template>
  <Component @action={{this.handleAction}} />
</template>

Migration

Replace:

<button {{on "click" (route-action "save" model)}}>Save</button>

With:

<button {{on "click" (fn this.save model)}}>Save</button>

References