Skip to content

Add sort by length option #224

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

KLewin23
Copy link

Adds the option to be able to sort within import groups by length mentioned #76, choices are

  • asc shortest to longest
  • desc longest to shortest
  • null no length rule applied

After length imports are sorted alphabetically

I have an internal fork with this implemented already so this doesn't affect me, but this is the general setup I have been using

@devlsh
Copy link

devlsh commented Apr 24, 2023

Would love to have this!

@expiritus2
Copy link

I also would love to have this. When it will be on the prod guys?

@KLewin23
Copy link
Author

Had to update the branch, think it needs reaproving

@spookyuser
Copy link

If this gets merged prettier can be renamed prettiest :)

@jackdh
Copy link

jackdh commented Sep 29, 2023

+1 for this, could we merge it?

@KLewin23
Copy link
Author

Gonna need someone to approve and merge it, keep coming back to it approved with merge blocks

@KLewin23
Copy link
Author

@annesnour03 can you approve so I can get this put away

@KLewin23
Copy link
Author

I still cant merge it @annesnour03 so idk if you can if not... it waits even more XD

@spookyuser
Copy link

image

@jackdh
Copy link

jackdh commented Nov 16, 2023

@ayusharma @byara come to our rescue please!

@Miguel-A-Jara
Copy link

Any news on this :)? @ayusharma & @byara

@Dugnist
Copy link

Dugnist commented Aug 17, 2024

@ayusharma @byara please add this

@KLewin23
Copy link
Author

1 year later XD

@KLewin23
Copy link
Author

KLewin23 commented Nov 25, 2024

@ayusharma Could someone approve / merge this again please

@OwenMelbz
Copy link

👀

@Miguel-A-Jara
Copy link

So sad that we've been waiting for this feature for so long and nobody can merge it!

@spookyuser
Copy link

I think react 20 will be published before this pr gets merged

@@ -21,7 +21,7 @@ export const getSortedNodes: GetSortedNodes = (nodes, options) => {
const {
importOrderSeparation,
importOrderSortSpecifiers,
importOrderGroupNamespaceSpecifiers,
importOrderGroupNamespaceSpecifiers,importOrderSortByLength

Choose a reason for hiding this comment

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

Suggested change
importOrderGroupNamespaceSpecifiers,importOrderSortByLength
importOrderGroupNamespaceSpecifiers,
importOrderSortByLength

Copy link
Author

Choose a reason for hiding this comment

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

should be in now, im gonna go through and check it still works as the merge may not be ok given how long its been

Copy link
Author

Choose a reason for hiding this comment

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

If you're still around, latest commit should fix any tests, update docs / types and work

Choose a reason for hiding this comment

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

looks good to me, I really appreciate the effort. Hopefully some maintainer is able to merge this wonderful PR! 😉

Copy link
Author

Choose a reason for hiding this comment

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

I think if you approve the pr again, we can get it in. Unless Github is leading me astray telling me it needs you to review.. if not the wait goes on 😅

Copy link

@trueberryless trueberryless left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@dingshaohua-com
Copy link

love this!

@dingshaohua-com
Copy link

look this: https://github.com/SanderRonde/prettier-plugin-sort-imports#readme,can do this work

@spookyuser
Copy link

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.