🔧 This rule is automatically fixable by the --fix CLI option.
Enforces a consistent ordering of attributes in template elements. This helps improve readability and maintainability of templates.
This rule enforces a consistent order for attributes on template elements. By default, it follows this order:
classidrolearia-*attributesdata-test-*attributestypenamevalueplaceholderdisabled
Examples of incorrect code for this rule:
<template>
<div id="main" class="container"></div>
</template><template>
<button aria-label="Submit" role="button">Send</button>
</template>Examples of correct code for this rule:
<template>
<div class="container" id="main"></div>
</template><template>
<button class="btn" role="button" aria-label="Submit">Send</button>
</template>You can customize the order by providing an order array:
module.exports = {
rules: {
'ember/template-attribute-order': [
'error',
{
order: ['class', 'id', 'role', 'aria-', 'type'],
},
],
},
};