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

feat: new rule: sort-heritage-clauses #334

Merged
merged 3 commits into from
Oct 24, 2024

Conversation

hugop95
Copy link
Contributor

@hugop95 hugop95 commented Oct 21, 2024

Description

This PR adds a sort-heritage-clauses (feel free to suggest another name if you find a better one) that allows users to sort classes implements and interfaces extends clauses.

Example:

interface Interface extends Loggable, Pausable, Startable {
 // ...
}
class Class implements Loggable, Pausable, Startable {
 // ...
}

Options

{
    customGroups: { [key in T[number]]: string[] | string }
    type: 'alphabetical' | 'line-length' | 'natural'
    specialCharacters: 'remove' | 'trim' | 'keep'
    groups: (Group<T>[] | Group<T>)[]
    matcher: 'minimatch' | 'regex'
    order: 'desc' | 'asc'
    ignoreCase: boolean
}

There is only one predefined group: unknown.

I don't believe that partitionByNewline and partitionByComment have relevant use cases here.

  •  Add tests.
  • Update documentation.

What is the purpose of this pull request?

  • New Feature
  • Documentation update

@hugop95 hugop95 force-pushed the feat/sort-heritage-clauses branch 3 times, most recently from 8f0bd81 to b4ff00e Compare October 22, 2024 23:48
@hugop95 hugop95 marked this pull request as ready for review October 22, 2024 23:53
Copy link

@OlivierZal OlivierZal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, as usual!

@azat-io
Copy link
Owner

azat-io commented Oct 23, 2024

Looks awesome, thank you!
I'll get back to all your pull requests this weekend.

@azat-io
Copy link
Owner

azat-io commented Oct 24, 2024

😍

@azat-io azat-io merged commit b2d5ed9 into azat-io:next Oct 24, 2024
8 checks passed
@hugop95 hugop95 deleted the feat/sort-heritage-clauses branch October 25, 2024 05:33
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

Successfully merging this pull request may close these issues.

3 participants