Closed hariettem closed 6 years ago
I'm not sure a separator is reason enough to add a new package to the extension, if we add every small style alternative the extension size will increment unnecessarily.
I'm not against this addition but at least the name of the style should be very clear so users can understand what that style does just by looking at it, in this case I think it's not. module-scope-ordered
is not telling me what is different from module-scope
, does that mean module-scope
is not ordered?
In fact module-compact
and module-scope
should be merged, the fact that module-compact
doesn't sort scoped modules properly is a bug. So we'll eventually remove module-scope
from here since module-compact
should behave like that.
A new version has been released with the new module-compact
maybe that covers your needs?
Fair enough.
module-compact
works well but I can do without the compact part. My needs requires the separator.
The problem with module-scope
is the separator is applied between the scope and non-scope modules.
The issue seems to be how import-sort styles aren't configurable, which leads to needing copies with minor switches.
I can totally see how having styles being json configs like this would be better:
[
{ 'match': [ 'noMembers', 'absoluteModule' ] },
{ 'separator': true }
{ 'match': [ 'noMembers', 'relativeModule' ] },
{ 'separator': true }
{
match: [ 'nodeModule' ],
sort: [ 'name' ],
sortNamedMembers: [ 'alias' ]
},
{ separator: true },
{
match: [ 'scopedModule', 'absoluteModule' ],
sort: [ 'name' ],
sortNamedMembers: [ 'alias' ]
},
{ separator: true },
]
Then you can pass your own in the sort-import config file. Instead of the current method that requires you to publish code (bit of an overkill for creating additional styles).
Can't agree more with you, this is something that annoyed me since I started using import-sort
. If you think you can provide an implementation it would be an awesome addition to the project and to import-sort
itself.
Closed because it's implemented in package module-compact
module-scoped is great but the separator between scoped imports is annoying. This fork of mine just orders scoped imports last in the external module section.