Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.21 KB

File metadata and controls

49 lines (34 loc) · 1.21 KB

ember/template-require-splattributes

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

Require splattributes usage in component templates.

Ember components should accept and forward HTML attributes to their underlying elements. This is done using the ...attributes spread syntax.

Examples

This rule forbids the following:

<template>
  <div></div>
</template>
<template>
  <div></div>
  <div></div>
</template>

This rule allows the following:

<template>
  <div ...attributes></div>
</template>
<template>
  <div ...attributes></div>
  <div></div>
</template>

Why?

Components that don't use ...attributes cannot accept HTML attributes from their consumers, limiting the flexibility and reusability of components. The ...attributes syntax ensures that consumers can pass attributes like class, id, aria-*, and others to your component.

References