Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 1.56 KB

File metadata and controls

66 lines (46 loc) · 1.56 KB

ember/template-no-mut-helper

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

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

Disallow usage of the (mut) helper.

The (mut) helper was used in classic Ember to create two-way bindings. In modern Ember (Octane and beyond), this pattern is discouraged in favor of explicit one-way data flow with actions or setters.

Rule Details

This rule disallows using the (mut) helper in templates.

Examples

Incorrect ❌

<template>
  <Input @value={{this.name}} @onChange={{mut this.name}} />
</template>
<template>
  {{input value=(mut this.name)}}
</template>
<template>
  <CustomComponent @onChange={{mut this.value}} />
</template>

Correct ✅

<template>
  <Input @value={{this.name}} @onChange={{this.updateName}} />
</template>
<template>
  <Input @value={{this.name}} @onChange={{fn (mut this "name")}} />
</template>
<template>
  <CustomComponent @onChange={{this.handleChange}} />
</template>

Related Rules

References