ember/template-no-with

April 20, 2026 ยท View on GitHub

๐Ÿ’ผ This rule is enabled in the ๐Ÿ“‹ template-lint-migration config.

HBS Only: This rule applies to classic .hbs template files only (loose mode). It is not relevant for gjs/gts files (strict mode), where these patterns cannot occur.

The use of {{with}} has been deprecated, you should replace it with either {{let}} or a combination of {{let}}, {{if}} and {{else}}.

Examples

This rule forbids the following:

<template>
  {{#with (hash name="Ben" age=4) as |person|}}
    Hi {{person.name}}, you are {{person.age}} years old.
  {{/with}}
</template>
<template>
  {{#with user.posts as |blogPosts|}}
    There are {{blogPosts.length}} blog posts.
  {{/with}}
</template>
<template>
  {{#with user.posts as |blogPosts|}}
    There are {{blogPosts.length}} blog posts.
  {{else}}
    There are no blog posts.
  {{/with}}
</template>

This rule allows the following:

<template>
  {{#let (hash name="Ben" age=4) as |person|}}
    Hi {{person.name}}, you are {{person.age}} years old.
  {{/let}}
</template>
<template>
  {{#let user.posts as |blogPosts|}}
    {{#if blogPosts.length}}
      There are {{blogPosts.length}} blog posts.
    {{/if}}
  {{/let}}
</template>
<template>
  {{#let user.posts as |blogPosts|}}
    {{#if blogPosts.length}}
      There are {{blogPosts.length}} blog posts.
    {{else}}
      There are no blog posts.
    {{/if}}
  {{/let}}
</template>

References