🔧 This rule is automatically fixable by the --fix CLI option.
The rule helps you standardize templates:
- Component invocations
- Helper invocations
- Modifier invocations
By sorting things that are order-independent, you can more easily refactor code. In addition, sorting removes style differences, so you can review another person's code more effectively.
Tip
The --fix option for this rule doesn't preserve formatting. You can use prettier, prettier-plugin-ember-hbs-tag, and prettier-plugin-ember-template-tag to format templates in *.hbs, hbs tags, and <template> tags, respectively.
When invoking a component, list things in the following order:
- Arguments
- Attributes
- Modifiers
- Splattributes
The order clearly shows how the component is customized more and more. Things are alphabetized within each group.
Note
In rare cases, the order of ...attributes can matter. Similarly, the order can matter when an ARIA attribute has multiple values.
Disable the rule per instance in either case.
When invoking a helper, list the named arguments in alphabetical order.
Similarly to helpers, list the named arguments in alphabetical order.
It's intended that there are no options for sorting. Alphabetical sort is the simplest for everyone to understand and to apply across different projects. It's also the easiest to maintain.
To better meet your needs, consider creating a plugin for ember-template-lint.
1. If you passed an empty string as an argument's value, it has been replaced with {{""}}. Let ember-template-lint fix the formatting change.
- <MyComponent @description={{""}} />
+ <MyComponent @description="" />2. Comments such as {{! @glint-expect-error }} may have shifted. Move them to the correct location.
Source code and tests were copied from ember-codemod-sort-invocations.