This rule enforces that when using ...attributes (spread attributes), you should not also use a class attribute. The ...attributes syntax is used to forward HTML attributes from a parent component to a child component, and it already handles class merging automatically.
This rule forbids the following:
This rule allows the following:
When using ...attributes, any classes passed from the parent component will be automatically merged with the component's own classes. Adding a class attribute alongside ...attributes can lead to confusion about which classes take precedence and may result in unexpected styling behavior.
For example:
Instead, you should either:
- Use
...attributesalone to allow class merging from the parent - Use
classalone if you want to enforce specific classes
- Splattributes in the Ember.js guides