You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
ackvf
changed the title
import/orderpathGroups and pathGroupsExcludedImportTypes is too confusing.import/orderpathGroups and pathGroupsExcludedImportTypes is too confusing
Oct 13, 2023
There is some convoluted logic involved in how
import/order
withpathGroups
andpathGroupsExcludedImportTypes
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 anexternal
import, it will get ignored bypathGroups
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 againstpathGroups
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.
The text was updated successfully, but these errors were encountered: