Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 1.13 KB

File metadata and controls

47 lines (32 loc) · 1.13 KB

ember/template-simple-modifiers

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

Require simple modifier syntax.

The modifier helper should have a simple string or path expression as its first argument (the modifier name). Complex expressions should not be used as the first argument.

Examples

This rule forbids the following:

<template>
  <div {{(modifier (unless this.condition 'simple-modifier'))}}></div>
</template>
<template>
  <div {{(modifier)}}></div>
</template>

This rule allows the following:

<template>
  <div {{(modifier 'track-interaction' @data)}}></div>
</template>
<template>
  <div {{(modifier this.modifierName)}}></div>
</template>

Why?

Using complex expressions as the modifier name reduces readability and makes it harder to understand which modifier is being applied.

References