From 52b2bdbb48085c1f1b2e1c28d0011eb7cb2afe97 Mon Sep 17 00:00:00 2001 From: Sergei Zharinov <zharinov@users.noreply.github.com> Date: Mon, 29 Nov 2021 19:04:43 +0300 Subject: [PATCH] refactor(util/cache): Enable strict nulls (#12887) --- lib/util/cache/repository/index.ts | 10 +++++----- tsconfig.strict.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/util/cache/repository/index.ts b/lib/util/cache/repository/index.ts index 415b629e4b..e81ba7bbf0 100644 --- a/lib/util/cache/repository/index.ts +++ b/lib/util/cache/repository/index.ts @@ -11,16 +11,16 @@ import type { Cache } from './types'; // Increment this whenever there could be incompatibilities between old and new cache structure export const CACHE_REVISION = 9; -let repositoryCache: RepositoryCacheConfig = 'disabled'; -let cacheFileName: string; -let cache: Cache = Object.create({}); +let repositoryCache: RepositoryCacheConfig | undefined = 'disabled'; +let cacheFileName: string | null = null; +let cache: Cache | null = Object.create({}); export function getCacheFileName(config: RenovateConfig): string { return join( GlobalConfig.get('cacheDir'), '/renovate/repository/', config.platform, - config.repository + '.json' + `${config.repository}.json` ); } @@ -63,7 +63,7 @@ export async function initialize(config: RenovateConfig): Promise<void> { } export function getCache(): Cache { - return cache || createCache(); + return cache ?? createCache(); } export async function finalize(): Promise<void> { diff --git a/tsconfig.strict.json b/tsconfig.strict.json index eb5bc10ea2..9815efcfbd 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -23,7 +23,7 @@ "lib/platform/utils/pr-body.ts", "lib/proxy.ts", "lib/types/**/*.ts", - "lib/util/cache/package/*.ts", + "lib/util/cache/*.ts", "lib/util/clone.ts", "lib/util/date.ts", "lib/util/exec/common.ts", @@ -66,6 +66,6 @@ "lib/datasource/helm/common.ts", "lib/logger/err-serializer.spec.ts", "lib/manager/gradle/shallow/types.ts", - "lib/util/cache/package/*.spec.ts" + "lib/util/cache/*.spec.ts" ] } -- GitLab