bryanrsmith / eslint-plugin-sort-class-members

An ESLint rule for enforcing consistent ES6 class member order
119 stars 21 forks source link

feat(decorators): add support for decorator groups #57

Closed eduardn closed 4 years ago

eduardn commented 4 years ago

Using this with MobX stores and noticed an issue where it reads the property name as being the decorator name (i.e observable instead of bar for @observable bar;) and it breaks the alphabetical order.

I have also introduced a new property that can be used to group properties with the same decorator together while still keeping the ability to have them alphabetically sorted.

Let me know what you think and if it makes sense to be part of the plugin.

bryanrsmith commented 4 years ago

Thanks! Looks great to me. Would you mind adding a short description of the new groupByDecorator property to the configuration documentation in the readme?

eduardn commented 4 years ago

Thanks for having a look! Added the docs.

bryanrsmith commented 4 years ago

Published as v1.8.0. Thank you @eduardn!

thedaaron commented 4 years ago

Hello, it don't match decorators that have parentheses, like @Prop({required: true})