diff --git a/lib/config/migrate-validate.spec.ts b/lib/config/migrate-validate.spec.ts index ff6744efd614b87637a22ac12dc45277c6580363..e64b707b59ecafefe464b5f20738df30aa06c985 100644 --- a/lib/config/migrate-validate.spec.ts +++ b/lib/config/migrate-validate.spec.ts @@ -37,7 +37,7 @@ describe('config/migrate-validate', () => { it('isOnboarded', async () => { const input: RenovateConfig = {}; const res = await migrateAndValidate( - { ...config, repoIsOnboarded: true, warnings: undefined }, + { ...config, repoIsOnboarded: true }, input ); expect(res.warnings).toBeUndefined(); diff --git a/lib/config/presets/gitea/index.ts b/lib/config/presets/gitea/index.ts index dfc8884396195f8aeb1729b5f834a0c67b8d9930..8728cf2027637e06eaa191d47125e2af9c97c9e3 100644 --- a/lib/config/presets/gitea/index.ts +++ b/lib/config/presets/gitea/index.ts @@ -37,7 +37,7 @@ export function getPresetFromEndpoint( filePreset: string, presetPath?: string, endpoint = Endpoint, - tag?: string + tag?: string | undefined ): Promise<Preset | undefined> { return fetchPreset({ repo, diff --git a/lib/config/presets/github/index.ts b/lib/config/presets/github/index.ts index 315c5125942ca81b82e58bd614f874c345265e80..da087ae1c4582e6851425bb72239937c05556f44 100644 --- a/lib/config/presets/github/index.ts +++ b/lib/config/presets/github/index.ts @@ -14,7 +14,7 @@ export async function fetchJSONFile( repo: string, fileName: string, endpoint: string, - tag?: string | null + tag?: string | undefined ): Promise<Preset> { let ref = ''; if (is.nonEmptyString(tag)) { @@ -42,7 +42,7 @@ export function getPresetFromEndpoint( filePreset: string, presetPath?: string, endpoint = Endpoint, - tag?: string + tag?: string | undefined ): Promise<Preset | undefined> { return fetchPreset({ repo, @@ -58,7 +58,7 @@ export function getPreset({ repo, presetName = 'default', presetPath, - tag = undefined, + tag, }: PresetConfig): Promise<Preset | undefined> { return getPresetFromEndpoint(repo, presetName, presetPath, Endpoint, tag); } diff --git a/lib/config/presets/gitlab/index.ts b/lib/config/presets/gitlab/index.ts index 5c2902fc02796ff2776895e955e7606c47e0c425..b1f4071ccd9923bb2b184445c77f90995fd695a7 100644 --- a/lib/config/presets/gitlab/index.ts +++ b/lib/config/presets/gitlab/index.ts @@ -24,7 +24,7 @@ export async function fetchJSONFile( repo: string, fileName: string, endpoint: string, - tag?: string | null + tag?: string | undefined ): Promise<Preset> { let url = endpoint; let ref = ''; @@ -60,7 +60,7 @@ export function getPresetFromEndpoint( presetName: string, presetPath?: string, endpoint = Endpoint, - tag?: string | null + tag?: string | undefined ): Promise<Preset | undefined> { return fetchPreset({ repo, diff --git a/lib/config/presets/local/common.ts b/lib/config/presets/local/common.ts index 144eada8fa4c44a1c0e1d32fde7f1c3c51c2aaa8..c22e6f86f3dea1280ce0f01dba173ee83e37a8c5 100644 --- a/lib/config/presets/local/common.ts +++ b/lib/config/presets/local/common.ts @@ -8,7 +8,7 @@ export async function fetchJSONFile( repo: string, fileName: string, _endpoint?: string, - tag?: string | null + tag?: string | undefined ): Promise<Preset> { let raw: string | null; try { @@ -35,7 +35,7 @@ export function getPresetFromEndpoint( filePreset: string, presetPath: string | undefined, endpoint: string, - tag?: string | null + tag?: string | undefined ): Promise<Preset | undefined> { return fetchPreset({ repo, diff --git a/lib/config/presets/types.ts b/lib/config/presets/types.ts index cc31c2e27ab4a97ae56f01349b628d2d58d60f68..943739dafa33883fc4732442d4f1362e8c5775ee 100644 --- a/lib/config/presets/types.ts +++ b/lib/config/presets/types.ts @@ -5,9 +5,9 @@ export type Preset = RenovateConfig & Record<string, unknown>; export type PresetConfig = { repo: string; - presetPath?: string; + presetPath?: string | undefined; presetName?: string; - tag?: string; + tag?: string | undefined; }; export interface PresetApi { @@ -19,24 +19,24 @@ export interface PresetApi { export interface ParsedPreset { presetSource: string; repo: string; - presetPath?: string; + presetPath?: string | undefined; presetName: string; - tag?: string; - params?: string[]; + tag?: string | undefined; + params?: string[] | undefined; } export type PresetFetcher = ( repo: string, fileName: string, endpoint: string, - tag?: string | null + tag?: string | undefined ) => Promise<Preset | null | undefined>; export type FetchPresetConfig = { repo: string; filePreset: string; - presetPath?: string; + presetPath?: string | undefined; endpoint: string; - tag?: string | null; + tag?: string | undefined; fetch: PresetFetcher; }; diff --git a/lib/config/presets/util.ts b/lib/config/presets/util.ts index 270da8757e5ff751fab4ec8125eaf7b321c78f11..8d8382e3d5560910ac68d1722f8e24ce04a34f5a 100644 --- a/lib/config/presets/util.ts +++ b/lib/config/presets/util.ts @@ -17,7 +17,7 @@ export async function fetchPreset({ filePreset, presetPath, endpoint: _endpoint, - tag = null, + tag, fetch, }: FetchPresetConfig): Promise<Preset | undefined> { // TODO: fix me, can be undefiend #7154 diff --git a/lib/instrumentation/decorator.ts b/lib/instrumentation/decorator.ts index 39f1d365a84e39a51c7e3932b76a565664569470..30f8ce6de1f4bfeea974021559b6383606eee791 100644 --- a/lib/instrumentation/decorator.ts +++ b/lib/instrumentation/decorator.ts @@ -1,3 +1,4 @@ +import { SpanKind } from '@opentelemetry/api'; import { Decorator, decorate } from '../util/decorator'; import type { SpanParameters } from './types'; import { instrument as instrumentFunc } from '.'; @@ -9,7 +10,7 @@ export function instrument<T>({ name, attributes, ignoreParentSpan, - kind, + kind = SpanKind.INTERNAL, }: SpanParameters): Decorator<T> { return decorate(async ({ callback }) => { return await instrumentFunc(name, callback, { diff --git a/lib/instrumentation/types.ts b/lib/instrumentation/types.ts index 8b312d03d754d24ef3077e7dc751d74221a6720a..a753ecb56d1436472ea678d647f1e9b1ffa170a4 100644 --- a/lib/instrumentation/types.ts +++ b/lib/instrumentation/types.ts @@ -12,7 +12,7 @@ export interface SpanParameters { /** * Attributes which should be added to the span */ - attributes?: Attributes; + attributes?: Attributes | undefined; /** * Should this span be added to the root span or to the current active span diff --git a/lib/modules/datasource/datasource.ts b/lib/modules/datasource/datasource.ts index a8cb0b3ebc8a78970bfd2c1170c1a3210806ee6e..95d6abf947b9bc7ef358ba6b0c4e964ccaa8cd6e 100644 --- a/lib/modules/datasource/datasource.ts +++ b/lib/modules/datasource/datasource.ts @@ -22,7 +22,7 @@ export abstract class Datasource implements DatasourceApi { defaultRegistryUrls?: string[] | (() => string[]); - defaultVersioning: string | undefined; + defaultVersioning?: string | undefined; registryStrategy: RegistryStrategy | undefined = 'first'; diff --git a/lib/modules/datasource/docker/index.ts b/lib/modules/datasource/docker/index.ts index c2192fec8dfd01270156a97a16062d0c0cadc13c..43e66d2321d35c77761e8d4f07357ea4f8e0fcff 100644 --- a/lib/modules/datasource/docker/index.ts +++ b/lib/modules/datasource/docker/index.ts @@ -234,7 +234,7 @@ export async function getAuthHeaders( } async function getECRAuthToken( - region: string | undefined, + region: string, opts: HostRule ): Promise<string | null> { const config: ECRClientConfig = { region }; diff --git a/lib/modules/datasource/galaxy-collection/index.ts b/lib/modules/datasource/galaxy-collection/index.ts index 701536848b5e14bb1c2adf9c9cb9a3893e7f695d..2e71f354336acde61ae6be46d107103e32361f17 100644 --- a/lib/modules/datasource/galaxy-collection/index.ts +++ b/lib/modules/datasource/galaxy-collection/index.ts @@ -93,7 +93,7 @@ export class GalaxyCollectionDatasource extends Datasource { try { const release: Release = { version: basicRelease.version, - isDeprecated: basicRelease.isDeprecated, + isDeprecated: !!basicRelease.isDeprecated, downloadUrl: versionDetails.download_url, newDigest: versionDetails.artifact.sha256, dependencies: versionDetails.metadata.dependencies, @@ -118,7 +118,7 @@ export class GalaxyCollectionDatasource extends Datasource { // extract base information which are only provided on the release from the newest release const result: ReleaseResult = { releases: filteredReleases, - sourceUrl: newestVersionDetails?.metadata.repository, + sourceUrl: newestVersionDetails?.metadata.repository ?? null, homepage: newestVersionDetails?.metadata.homepage, tags: newestVersionDetails?.metadata.tags, }; diff --git a/lib/modules/datasource/go/__snapshots__/releases-direct.spec.ts.snap b/lib/modules/datasource/go/__snapshots__/releases-direct.spec.ts.snap index 40b52a688f5542f53a83d7283ca994eedcec702f..4e65ba27707cd45f89caf33bed03cab0c796feb8 100644 --- a/lib/modules/datasource/go/__snapshots__/releases-direct.spec.ts.snap +++ b/lib/modules/datasource/go/__snapshots__/releases-direct.spec.ts.snap @@ -31,7 +31,7 @@ exports[`modules/datasource/go/releases-direct getReleases support git 1`] = ` "version": "v2.0.0", }, ], - "sourceUrl": undefined, + "sourceUrl": null, } `; diff --git a/lib/modules/datasource/go/releases-direct.ts b/lib/modules/datasource/go/releases-direct.ts index b9fb0b61301cd4f1028ae44f97974111ad68b167..13950d682f5632aaf058faea4666a24d8879827d 100644 --- a/lib/modules/datasource/go/releases-direct.ts +++ b/lib/modules/datasource/go/releases-direct.ts @@ -85,7 +85,7 @@ export class GoDirectDatasource extends Datasource { return null; } - const sourceUrl = getSourceUrl(source); + const sourceUrl = getSourceUrl(source) ?? null; /** * github.com/org/mod/submodule should be tagged as submodule/va.b.c diff --git a/lib/modules/datasource/go/releases-goproxy.ts b/lib/modules/datasource/go/releases-goproxy.ts index a541c06c2872b3e091cbe3d14fdd557c37e9a9dd..7d00bfaa18eb45e704d4a56b9fcb9d38c16052e8 100644 --- a/lib/modules/datasource/go/releases-goproxy.ts +++ b/lib/modules/datasource/go/releases-goproxy.ts @@ -92,7 +92,7 @@ export class GoProxyDatasource extends Datasource { const datasource = await BaseGoDatasource.getDatasource( packageName ); - const sourceUrl = getSourceUrl(datasource); + const sourceUrl = getSourceUrl(datasource) ?? null; result = { releases, sourceUrl }; } catch (err) { logger.trace({ err }, `Can't get datasource for ${packageName}`); diff --git a/lib/modules/datasource/golang-version/index.ts b/lib/modules/datasource/golang-version/index.ts index d0cd118bbb055d508b673d767aa9b3b9ed9687f7..33a9959da861f2a784c48a2803431d3bf6fcbc60 100644 --- a/lib/modules/datasource/golang-version/index.ts +++ b/lib/modules/datasource/golang-version/index.ts @@ -67,7 +67,7 @@ export class GolangVersionDatasource extends Datasource { lines.splice(0, startOfReleases + 1); // Parse the release list - let release: Omit<Release, 'version'> & { version?: string } = { + let release: Omit<Release, 'version'> & { version?: string | undefined } = { version: undefined, }; let skipFutureRelease = false; diff --git a/lib/modules/datasource/types.ts b/lib/modules/datasource/types.ts index a112d5fd5eec5ab09b730405afc68dc76cc966b8..095d9f2ef1fcf16dd506d314f8e85b24e0f341fd 100644 --- a/lib/modules/datasource/types.ts +++ b/lib/modules/datasource/types.ts @@ -48,12 +48,12 @@ export interface Release { isStable?: boolean; releaseTimestamp?: any; version: string; - newDigest?: string; + newDigest?: string | undefined; constraints?: Record<string, string[]>; dependencies?: Record<string, string>; devDependencies?: Record<string, string>; registryUrl?: string; - sourceUrl?: string; + sourceUrl?: string | undefined; sourceDirectory?: string; } @@ -61,11 +61,11 @@ export interface ReleaseResult { deprecationMessage?: string; isPrivate?: boolean; releases: Release[]; - tags?: Record<string, string>; + tags?: Record<string, string> | undefined; // URL metadata changelogUrl?: string; dependencyUrl?: string; - homepage?: string; + homepage?: string | undefined; gitRef?: string; sourceUrl?: string | null; sourceDirectory?: string; @@ -81,8 +81,8 @@ export interface DatasourceApi extends ModuleApi { getDigest?(config: DigestConfig, newValue?: string): Promise<string | null>; getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null>; defaultRegistryUrls?: string[] | (() => string[]); - defaultVersioning?: string; - defaultConfig?: Record<string, unknown>; + defaultVersioning?: string | undefined; + defaultConfig?: Record<string, unknown> | undefined; /** * Strategy to use when multiple registryUrls are available to the datasource. @@ -90,7 +90,7 @@ export interface DatasourceApi extends ModuleApi { * hunt: registryUrls will be tried in order until one returns a result * merge: all registryUrls will be tried and the results merged if more than one returns a result */ - registryStrategy?: RegistryStrategy; + registryStrategy?: RegistryStrategy | undefined; /** * Whether custom registryUrls are allowed. @@ -102,7 +102,7 @@ export interface DatasourceApi extends ModuleApi { * true: datasoure index wrapper should cache all results (based on registryUrl/packageName) * false: caching is not performed, or performed within the datasource implementation */ - caching?: boolean; + caching?: boolean | undefined; /** optional URLs to add to docs as references */ urls?: string[]; diff --git a/lib/modules/platform/types.ts b/lib/modules/platform/types.ts index eeafd70cd235a406b315fd6340c7aa140b7028f8..06b9fc1896db756663ebbf7539e70ddc89511477 100644 --- a/lib/modules/platform/types.ts +++ b/lib/modules/platform/types.ts @@ -95,6 +95,7 @@ export type PlatformPrOptions = { usePlatformAutomerge?: boolean; forkModeDisallowMaintainerEdits?: boolean; }; + export interface CreatePRConfig { sourceBranch: string; targetBranch: string; diff --git a/lib/util/github/graphql/types.ts b/lib/util/github/graphql/types.ts index 1fbbca8bd8f12c7ce50e79ef631791d58c22f53f..41344df196f76921925b252ceb5fcf0cb7547328 100644 --- a/lib/util/github/graphql/types.ts +++ b/lib/util/github/graphql/types.ts @@ -55,7 +55,7 @@ export interface GithubPackageConfig { /** * Default: https://api.github.com */ - registryUrl?: string; + registryUrl?: string | undefined; } /** diff --git a/lib/workers/repository/onboarding/pr/index.ts b/lib/workers/repository/onboarding/pr/index.ts index d1d7ce2b71422e332442ca3d0910b99ffe4a4e74..923dec654e8c2da5da6645889cb7e34ac433e602 100644 --- a/lib/workers/repository/onboarding/pr/index.ts +++ b/lib/workers/repository/onboarding/pr/index.ts @@ -171,7 +171,10 @@ If you need any further assistance then you can also [request help here](${ prTitle: config.onboardingPrTitle!, prBody, labels, - platformOptions: getPlatformPrOptions({ ...config, automerge: false }), + platformOptions: getPlatformPrOptions({ + ...config, + automerge: false, + }), }); logger.info( { pr: `Pull Request #${pr!.number}` }, diff --git a/lib/workers/repository/update/pr/index.ts b/lib/workers/repository/update/pr/index.ts index f333e266fce6a0b8f2ab003b21a9335e9089b968..cc308d54ab14cee40faa986f9da9c1fe66c46e3d 100644 --- a/lib/workers/repository/update/pr/index.ts +++ b/lib/workers/repository/update/pr/index.ts @@ -47,11 +47,11 @@ export function getPlatformPrOptions( ); return { - azureAutoApprove: config.azureAutoApprove, - azureWorkItemId: config.azureWorkItemId, - bbUseDefaultReviewers: config.bbUseDefaultReviewers, - gitLabIgnoreApprovals: config.gitLabIgnoreApprovals, - forkModeDisallowMaintainerEdits: config.forkModeDisallowMaintainerEdits, + azureAutoApprove: !!config.azureAutoApprove, + azureWorkItemId: config.azureWorkItemId ?? 0, + bbUseDefaultReviewers: !!config.bbUseDefaultReviewers, + gitLabIgnoreApprovals: !!config.gitLabIgnoreApprovals, + forkModeDisallowMaintainerEdits: !!config.forkModeDisallowMaintainerEdits, usePlatformAutomerge, }; } @@ -391,7 +391,7 @@ export async function ensurePr( prBody, labels: prepareLabels(config), platformOptions: getPlatformPrOptions(config), - draftPR: config.draftPR, + draftPR: !!config.draftPR, }); incLimitedValue('PullRequests');