From 4863e5124d02c84545fb16b9c03335520cd2270a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Jona=C5=A1?= Date: Thu, 19 May 2022 09:07:02 +0200 Subject: [PATCH] fix(linter): make entry point check for ts paths more specific (#10365) --- packages/eslint-plugin-nx/src/utils/ast-utils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin-nx/src/utils/ast-utils.ts b/packages/eslint-plugin-nx/src/utils/ast-utils.ts index 9be4ff0ccf83d..996a4962569db 100644 --- a/packages/eslint-plugin-nx/src/utils/ast-utils.ts +++ b/packages/eslint-plugin-nx/src/utils/ast-utils.ts @@ -29,7 +29,7 @@ export function getBarrelEntryPointByImportScope( } export function getBarrelEntryPointProjectNode( - importScope: MappedProjectGraphNode + projectNode: MappedProjectGraphNode ): { path: string; importScope: string }[] | null { const tsConfigBase = tryReadBaseJson(); @@ -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) =>