-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not support groupByDecorator for method type #69
Comments
Firstly, thanks to Bryan for making this plugin! I'm sharing another example use case for this issue & my work-around... I'm trying to use this rule with export default class MyComponent extends Vue {
// Interface
@Prop() propExample!: number
@Emit() emitExample (): number { return 123 }
// State
localExample = 123
get getterExample (): number { return 123 }
// Lifecycle
mounted (): void { ... }
@Watch('localExample') onLocalChange (): void { ... }
// Methods
methodExample (...): number { ... } Currently the
...then use this configuration: 'sort-class-members/sort-class-members': [
'error',
{
order: [
'[static-properties]',
'[static-methods]',
'[injects]',
'[provides]',
'[props]',
'[emits]',
'[properties]',
'[getters]',
'[setters]',
'constructor',
'[vue-before-create]',
'[vue-created]',
'[vue-before-mount]',
'[vue-mounted]',
'[vue-before-update]',
'[vue-updated]',
'[vue-before-unmount]',
'[vue-unmounted]',
'[vue-error-captured]',
'[vue-render-tracked]',
'[vue-render-triggered]',
'[vue-activated]',
'[watches]',
'[methods]'
],
groups: {
injects: [{ groupByDecorator: 'Inject', type: 'property' }],
provides: [{ groupByDecorator: 'Provide', type: 'property' }],
props: [{ groupByDecorator: 'Prop', type: 'property' }],
emits: [{ name: '/emit.+/', type: 'method' }],
getters: [{ type: 'method', kind: 'get' }],
setters: [{ type: 'method', kind: 'set' }],
watches: [{ name: '/on.+/', type: 'method' }],
'vue-before-create': [{ name: 'beforeCreate', type: 'method' }],
'vue-created': [{ name: 'created', type: 'method' }],
'vue-before-mount': [{ name: 'beforeMount', type: 'method' }],
'vue-mounted': [{ name: 'mounted', type: 'method' }],
'vue-before-update': [{ name: 'beforeUpdate', type: 'method' }],
'vue-updated': [{ name: 'updated', type: 'method' }],
'vue-activated': [{ name: 'activated', type: 'method' }],
'vue-deactivated': [{ name: 'deactivated', type: 'method' }],
'vue-before-unmount': [{ name: 'beforeUnmount', type: 'method' }],
'vue-unmounted': [{ name: 'unmounted', type: 'method' }],
'vue-error-captured': [{ name: 'errorCaptured', type: 'method' }],
'vue-render-tracked': [{ name: 'renderTracked', type: 'method' }],
'vue-render-triggered': [{ name: 'renderTriggered', type: 'method' }]
},
accessorPairPositioning: 'getThenSet'
}
] Hope it helps or inspires someone :) |
@lordantonelli - Probably not perfect, but you can get somewhere with this: groups: {
setters: [{ type: 'method', kind: 'set' }], // @Input
[lifecycle-events]: [{ name: '/on.+/', type: 'method' }], // @HostListener
}, |
Hi, I've opened a PR here to support both types: #80 |
Since #80 has been merged and published, can this issue be closed? |
The groupByDecorator is only available to property type, but I can define decorator on method too:
Is it possible to configure lint for this case?
The text was updated successfully, but these errors were encountered: