Skip to content

import/order pathGroups and pathGroupsExcludedImportTypes is too confusing #2897

Closed
@ackvf

Description

@ackvf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy