-
Notifications
You must be signed in to change notification settings - Fork 133
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
Add import groups configuration #36
Comments
I like the idea of a nested array for configuring groups. Unfortunately, prettier does not allow this type of option. Only int, boolean, choice and path are allowed. {
"importOrder": [
"^react",
"^(?!react)\\w+$",
"", // empty string separates import
"^[./]"
]
} |
I added PR #42 as implementation |
Hi @ayusharma did you have time to look into my PR? Totally OK if you don't like it, just a little feedback would be nice, if there is any chance that you could look into it. :-) |
Closing the issue in favor of #42 |
I see that #42 was closed. This is a shame. This is currently one of the only widely-available and actively maintained import sorting packages, but its inability to let people configure it in a few more ways (such as being able to decide what patterns are grouped together and which are separated) makes it far less usable in projects which have an established convention. |
Dude, I agree with you but please keep it cool. |
I have re-open #42 due to the fact that it can help a lot of people and solve lot's of issues. Let's work on it and improve the PR. |
Summary
My actual use-case is that I want React to be imported as first but I also want line breaking between my imports. If in the
importOrder
configuration I setup the following :"importOrder": ["^react", "^(?!react)\\w+$"]
(from #7 (comment)) withimportOrderSeparation: true
, it will add a line break between my imports fromnode_modules
.Actual behavior
Expected behavior
For the moment, if you want to
importOrderSeparation
, there is no way of configuring import groups. I think it could be awesome if we could specify in the configuration where is the line breaking.Possible solution
Create a configuration like:
We could event remove the
importOrderSeparation
option because this way will allow you to put everything in the same block:I'll be glad to PR this ;)
Related to #1 & #7
The text was updated successfully, but these errors were encountered: