Description
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.