Skip to content

Commit

Permalink
fix(linter): make entry point check for ts paths more specific (#10365)
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed May 19, 2022
1 parent 5baaab4 commit 4863e51
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/eslint-plugin-nx/src/utils/ast-utils.ts
Expand Up @@ -29,7 +29,7 @@ export function getBarrelEntryPointByImportScope(
}

export function getBarrelEntryPointProjectNode(
importScope: MappedProjectGraphNode<any>
projectNode: MappedProjectGraphNode<any>
): { path: string; importScope: string }[] | null {
const tsConfigBase = tryReadBaseJson();

Expand All @@ -38,7 +38,10 @@ export function getBarrelEntryPointProjectNode(
.filter((entry) => {
const sourceFolderPaths = tsConfigBase.compilerOptions.paths[entry];
return sourceFolderPaths.some((sourceFolderPath) => {
return sourceFolderPath.includes(importScope.data.root);
return (
sourceFolderPath === projectNode.data.sourceRoot ||
sourceFolderPath.indexOf(`${projectNode.data.sourceRoot}/`) === 0
);
});
})
.map((entry) =>
Expand Down

0 comments on commit 4863e51

Please sign in to comment.