From 9dafbd4b71373f6c66ae01de90d983c9891df5d7 Mon Sep 17 00:00:00 2001 From: Florian Guitton Date: Tue, 3 May 2022 10:42:16 +0100 Subject: [PATCH] chore(core): Addressing PR feedback adding Elvis chaining --- packages/nx/src/utils/project-graph-utils.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/nx/src/utils/project-graph-utils.ts b/packages/nx/src/utils/project-graph-utils.ts index 2b1aa3f87c8725..bf8e0a06e0b634 100644 --- a/packages/nx/src/utils/project-graph-utils.ts +++ b/packages/nx/src/utils/project-graph-utils.ts @@ -10,11 +10,7 @@ export function projectHasTarget( project: ProjectGraphProjectNode, target: string ) { - return !!( - project.data && - project.data.targets && - project.data.targets[target] - ); + return !!project?.data?.targets?.[target]; } export function projectHasTargetAndConfiguration( @@ -24,17 +20,12 @@ export function projectHasTargetAndConfiguration( ) { return ( projectHasTarget(project, target) && - project.data.targets[target].configurations && - project.data.targets[target].configurations[configuration] + project.data.targets[target].configurations?.[configuration] ); } export function projectHasTag(project: ProjectGraphProjectNode, tag: string) { - return !!( - project.data && - project.data.tags && - project.data.tags.includes(tag) - ); + return !!project?.data?.tags?.includes(tag); } export function mergeNpmScriptsWithTargets(