-
Notifications
You must be signed in to change notification settings - Fork 45
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
Feature: sort-imports - add option to sort within sub groups or remove new line between some groups #401
Feature: sort-imports - add option to sort within sub groups or remove new line between some groups #401
Comments
Hi @RARgames If I understand correctly, this issue is solely related to newlines and not to sorting itself. I see two ways to approach this:
|
Yes, sorry for the long explanation, I was a bit tired. I'm quite new to perfectionist (saw it some time ago and decided to use it today). However, I think that the 2nd option is even better, as it allows different settings for each custom group. |
I see two ways to resolve this: -
|
What rule do you want to change?
sort-imports
Describe the problem
I'm not sure if anything like this is possible right now. I couldn't find it in the docs.
Probably a new option is needed e.g. sort only within sub groups, or remove new line between defined groups
I want to achieve something like this:
Code example
I have
customGroup
for react-related imports calledreact
,I want to position it with first group:
now my imports are sorted like this:
I could change groups to:
to get:
But I cannot get what I want.
The issue is that ['react', 'builtin', 'external', 'internal'] is treated as 1 group for sorting, and I'd like to get sorting within
react
separately from the rest. Maybe some syntax like this could help:Entries in the main array are separated by new line as defined in
newlinesBetween
, but further divisions decide about what is sorted together - just an idea.Additional comments
No response
Validations
The text was updated successfully, but these errors were encountered: