Skip to content

Add option to force an alias use in files under alias directory #168

@vitonsky

Description

@vitonsky

Currently in case we have alias "foo/*": ["src/foo/*"] we allow to use relative paths to files in src/foo for any file inside src/foo, so file src/foo/bar/index.ts may use import ../baz instead of foo/baz.

const dirPathBase = path
.join(baseDir, dirPath)
.split('/')
.slice(0, -1)
.join('/');
if (filePath.startsWith(dirPathBase)) return false;

That is intentional behaviour, we have no problem with related paths inside namespace.

However it may be confused for some people who desire to force all files to use namespaces.

Let's introduce an option scope: "everywhere" to force alias use everywhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions