Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.26 KB

File metadata and controls

63 lines (45 loc) · 1.26 KB

ember/template-no-dynamic-subexpression-invocations

Disallow dynamic helper invocations.

Dynamic helper invocations (where the helper name comes from a property or argument) make code harder to understand and can have performance implications. Use explicit helper names instead.

Rule Details

This rule disallows invoking helpers dynamically using this or @ properties.

Examples

Incorrect ❌

<template>
  {{(this.helper "arg")}}
</template>
<template>
  {{(@helperName "value")}}
</template>

Correct ✅

<template>
  {{format-date this.date}}
</template>
<template>
  {{(upper-case this.name)}}
</template>
<template>
  {{this.formattedData}}
</template>
{{! Body-position dynamic helpers are allowed }}
<template>
  {{this.formatter this.data}}
</template>

Related Rules

References