ember/template-no-array-prototype-extensions

April 20, 2026 ยท View on GitHub

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

๐Ÿ”ง This rule is automatically fixable by the --fix CLI option.

๐Ÿ’ผ This rule is enabled in the following configs: strict-gjs, strict-gts.

Disallow usage of Ember Array prototype extensions.

Ember historically provided Array prototype extensions like firstObject and lastObject. These extensions are deprecated and should be replaced with native JavaScript array methods or computed properties.

Rule Details

This rule disallows using Ember Array prototype extensions in templates:

  • firstObject
  • lastObject
  • @each
  • []

Examples

Incorrect โŒ

<template>
  {{this.items.firstObject}}
</template>
<template>
  {{this.users.lastObject}}
</template>
<template>
  {{this.data.@each}}
</template>

Correct โœ…

<template>
  {{get this.items 0}}
</template>
<template>
  {{this.firstItem}}
</template>
<template>
  {{#each this.items as |item|}}
    {{item}}
  {{/each}}
</template>

References