Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 1.82 KB

File metadata and controls

63 lines (43 loc) · 1.82 KB

ember/template-no-index-component-invocation

💼 This rule is enabled in the 📋 template-lint-migration config.

Disallows invoking components using an explicit /index or ::Index suffix.

Components and Component Templates can be structured as app/components/foo-bar/index.js and app/components/foo-bar/index.hbs. This allows additional files related to the component (such as a README.md file) to be co-located on the filesystem.

For template-only components, they can be either app/components/foo-bar.hbs or app/components/foo-bar/index.hbs without a corresponding JavaScript file.

Similarly, for addons, templates can be placed inside addon/components with the same rules laid out above.

In all of these case, if a template file is present in app/components or addon/components, it will take precedence over any corresponding template files in app/templates, the layout property on classic components, or a template with the same name that is made available with the resolver API. Instead of being resolved at runtime, a template in app/components will be associated with the component's JavaScript class at build time.

Examples

This rule forbids the following:

<template><Foo::Index /></template>
<template>{{component 'foo/index'}}</template>
<template>{{foo/index}}</template>

This rule allows the following:

<template><Foo /></template>
<template>{{component 'foo'}}</template>
<template>{{foo}}</template>

Migration

  • replace all ::Index> to >
  • replace all /index}} to }}

References