Skip to content

[import/no-internal-modules] path normalisation makes preventing package internal imports impossible #2384

Open
@gordonmleigh

Description

@gordonmleigh

It feels like the this rule ought to be support my use case of preventing an import from deep inside any package, e.g. somepackage/some/internal/path. There doesn't appear to me to be any way to achieve that, due to the normalisation that takes place.

So I set an "allow" config for "allow": ["./**"], so that reaching is prevented except for relative paths; however, the normalisation that happens inside the rule scrubs all . and .. segments away for some reason. There doesn't therefore be any possibility of distinguishing between relative and package imports.

How is this use case supposed to be achieved?

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