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

import/order pathGroups and pathGroupsExcludedImportTypes is too confusing #2897

Closed
ackvf opened this issue Oct 13, 2023 · 0 comments · Fixed by #3106
Closed

import/order pathGroups and pathGroupsExcludedImportTypes is too confusing #2897

ackvf opened this issue Oct 13, 2023 · 0 comments · Fixed by #3106

Comments

@ackvf
Copy link

ackvf commented Oct 13, 2023

There is some convoluted logic involved in how import/order with pathGroups and pathGroupsExcludedImportTypes work.

I described that in detail here #2736 (comment), but in short, the gist is that if you have an import such as import { X } from 'package/src/ui' that looks as if it was an external import, it will get ignored by pathGroups pattern and will not even get tested.

This seems counterintuitive as the point of pathGroups in the first place is to match an import and assign it to a different group than implicit. But if it is first implicitly assigned to an excluded group, it will not even get matched against pathGroups an will not get assigned to the correct group at all.

From my point of view, pathGroups should be invoked first. Those matched imports should then be ignored for the next step where all unmatched imports are assigned implicit groups, after which all imports (now assigned to groups) are ordered according to expectations.

If for some reason you decide against this flow of reason, you should improve the documentation to better explain what is going on.

@ackvf ackvf changed the title import/order pathGroups and pathGroupsExcludedImportTypes is too confusing. import/order pathGroups and pathGroupsExcludedImportTypes is too confusing Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant