From b05844bc90d3aebb2289830b5ffb5d3eb7d11c80 Mon Sep 17 00:00:00 2001 From: Sergei Zharinov <zharinov@users.noreply.github.com> Date: Thu, 3 Feb 2022 18:36:29 +0300 Subject: [PATCH] refactor(datasource/hex): Enable strict null checks (#13983) Co-authored-by: Michael Kriese <michael.kriese@visualon.de> --- lib/datasource/hex/index.ts | 7 ++++++- tsconfig.strict.json | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/datasource/hex/index.ts b/lib/datasource/hex/index.ts index 5d812d8dbd..6c197eb05f 100644 --- a/lib/datasource/hex/index.ts +++ b/lib/datasource/hex/index.ts @@ -27,6 +27,11 @@ export class HexDatasource extends Datasource { lookupName, registryUrl, }: GetReleasesConfig): Promise<ReleaseResult | null> { + // istanbul ignore if + if (!registryUrl) { + return null; + } + // Get dependency name from lookupName. // If the dependency is private lookupName contains organization name as following: // hexPackageName:organizationName @@ -75,7 +80,7 @@ export class HexDatasource extends Datasource { } if (meta?.links?.Github) { - result.sourceUrl = hexRelease.meta.links.Github; + result.sourceUrl = meta?.links?.Github; } return result; diff --git a/tsconfig.strict.json b/tsconfig.strict.json index fe2af8a5e1..0a075968b4 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -19,6 +19,7 @@ "lib/datasource/dart", "lib/datasource/gitlab-tags/util.ts", "lib/datasource/helm/common.ts", + "lib/datasource/hex", "lib/datasource/metadata.ts", "lib/datasource/sbt-plugin/util.ts", "lib/globals.d.ts", @@ -81,6 +82,7 @@ "lib/datasource/go/common.ts", "lib/datasource/go/types.ts", "lib/datasource/helm/common.ts", + "lib/datasource/hex/**/*.spec.ts", "lib/logger/err-serializer.spec.ts", "lib/util/cache/**/*.spec.ts", "lib/util/exec/buildpack.spec.ts", -- GitLab