Skip to content
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

Alphabetical ordering of interfaces, classes, properties and methods #629

Open
Fevol opened this issue Apr 20, 2024 · 0 comments
Open

Alphabetical ordering of interfaces, classes, properties and methods #629

Fevol opened this issue Apr 20, 2024 · 0 comments

Comments

@Fevol
Copy link

Fevol commented Apr 20, 2024

Request: Add an option to sort interfaces, classes, types, and their properties and methods in an alphabetical order
Related issues: #561 #585
Configuration options: Expose an option to order each set individually, e.g. "sortProperties": "caseSensitive", similar to module.sortImportDeclarations

Example:
Given file:

class Z {
     constructor();

     weights: Record<string, number>;
     longString: string;
}

interface A {
    someKey: boolean;
    aProperty: number;
    
    zeroCount(): number;
    doSomething(): void;
}

Should become:

interface A {
    aProperty: number;
    someKey: boolean;
    
    doSomething(): void;
    zeroCount(): number;
}

class Z {
     constructor();

     longString: string;
     weights: Record<string, number>;
}

Apologies if this issue is too broad in scope. I have already implemented a (very bad) way to do this using ts-morph, but my implementation leaves much to be desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant