eslint-plugin-vue
eslint-plugin-vue copied to clipboard
`vue/attributes-order`: keep data-test attribute at the end of inline attributes
What rule do you want to change?
I would like to sort Vue component attribute data-test always at the end of the list of attributes so it will be always at the same position.
Does this change cause the rule to produce more or fewer warnings? Probably
How will the change be implemented? (New option, new default behavior, etc.)? it would be great to have special order type like "DATA_TEST__ID"
Please provide some example code that this change will affect:
<UFormGroup :label="Strings.PASSWORD" name="password" data-test="form-group-username">
<UInput :disabled="isActionsLocked" type="password" v-model="formState.password" />
</UFormGroup>
What does the rule currently do for this code?
It keeps data-test attribute always at the end of the list of all inline attributes
Hmm, a group only for data-test (and data-testid, which is more common) is much more specific than the current groups in the vue/attributes-order rule.
Also, it overlaps with either ATTR_DYNAMIC or ATTR_STATIC, so the rule would have to include that attributes in those groups if DATA_TEST_ID is not specified, and exclude it from those groups if it is specified separately.
But since data-test and data-testid are commonly used, it might actually be worth it.
An alternative would be to add support for exact attribute matching, which would be more versatile, but also more effort.