💼 This rule is enabled in the 📋 template-lint-migration config.
HBS Only: This rule applies to classic
.hbstemplate files only (loose mode). It is not relevant forgjs/gtsfiles (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}}.
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>- Deprecate {{with}} RFC
- More information is available at the Deprecation Guide