From 3295a75cd6cb9de8db6ee6d78ad1ba30f140a792 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 75ac82ffbe5364..a8f04391c89777 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(