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.
Currently in case we have alias
"foo/*": ["src/foo/*"]we allow to use relative paths to files insrc/foofor any file insidesrc/foo, so filesrc/foo/bar/index.tsmay use import../bazinstead offoo/baz.eslint-plugin-paths/src/rules/alias.ts
Lines 33 to 39 in dee7f4f
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.