diff --git a/packages/eslint-plugin-nx/src/utils/ast-utils.ts b/packages/eslint-plugin-nx/src/utils/ast-utils.ts index 41239a034601a..afcd492839c22 100644 --- a/packages/eslint-plugin-nx/src/utils/ast-utils.ts +++ b/packages/eslint-plugin-nx/src/utils/ast-utils.ts @@ -202,6 +202,13 @@ export function getRelativeImportPath(exportedMember, filePath, basePath) { dirname(filePath), `${modulePath}.ts` ); + if (!existsSync(moduleFilePath)) { + // might be a tsx file + moduleFilePath = joinPathFragments( + dirname(filePath), + `${modulePath}.tsx` + ); + } if (!existsSync(moduleFilePath)) { // might be a index.ts moduleFilePath = joinPathFragments(