Closed Tsury closed 1 month ago
Hi, thank you for reporting the issue. It's a bug. The default ordering of this plugin should be compatible with @typescript-eslint/member-ordering
's default. I'm considering to fix it.
I found that @typescript-eslint/member-ordering
itself looks inconsistent around static and decorated... For instance methods, it requires decorated ones get former. On the other hand, for static methods, it requires decorated ones get latter...
Anyway, I'm considering that we have to design this plugin to have capability with @typescript-eslint/member-ordering
's default.
export class SomeClass {
@someDecorator
private static someStaticMethod() {
//
}
// error
private static someOtherStaticMethod(){
//
};
}
export class SomeClassB {
@someDecorator
private someStaticMethod() {
//
}
// OK
private someOtherStaticMethod() {
//
};
}
I'm wondering whether we should have an option to select precedence between consistency and compatibility.
@Tsury Would you try new version 0.2.1-rc.1?
Hey @seiyab, thanks for the rapid response! I just tried 0.2.1-rc.1 and it seems to behave exactly the same for me - when eslint complains about the non-decorated static methods being below the non-decorated static method, and I manually move it, upon formatting it sends them down below again.
Was I required to configure anything maybe?
@Tsury Thank you for trying. Would you reload IDE?
Eh. Reloading the IDE did resolve the issue - sorry about that, and thank you so much both for this project and both for your quick response!
I'll leave it to you to close it as you see fit.
Thank you for reporting it and verify fix! Close as resolved 👍
Hello.
I have this code:
I'm getting this issue:
Member someOtherStaticMethod should be declared before all private decorated method definitions.
When I move
someOtherStaticMethod
manually to be beforesomeStaticMethod
, the issue it resolved, but when I format with prettier, it reverts it and movessomeOtherStaticMethod
to be aftersomeStaticMethod
, making the issue appear again.eslint config:
'@typescript-eslint/member-ordering': 'error',
prettier config:
"plugins": ["prettier-plugin-sort-members"]
How can I resolve this issue? Thanks in advance.