diff --git a/lib/config/types.ts b/lib/config/types.ts index d21e6292a9469ecac2d9fcbfad31fda6a7c84064..9fde0ac3300c7a8ae9198bab4a36c16e2a535044 100644 --- a/lib/config/types.ts +++ b/lib/config/types.ts @@ -419,9 +419,9 @@ export interface PackageRuleInputConfig extends Record<string, unknown> { depType?: string; depTypes?: string[]; depName?: string; - currentValue?: string; + currentValue?: string | null; currentVersion?: string; - lockedVersion?: string; + lockedVersion?: string | null; updateType?: UpdateType; isBump?: boolean; sourceUrl?: string | null; diff --git a/lib/modules/manager/types.ts b/lib/modules/manager/types.ts index 0cfd1326450b06d54cb719492f02ec4bc7bc191a..6ee514be284b9d7a566a6c4462a2848f94e5a10e 100644 --- a/lib/modules/manager/types.ts +++ b/lib/modules/manager/types.ts @@ -108,7 +108,7 @@ export interface Package<T> extends ManagerData<T> { npmPackageAlias?: boolean; packageFileVersion?: string; gitRef?: boolean; - sourceUrl?: string; + sourceUrl?: string | null; githubRepo?: string; pinDigests?: boolean; currentRawValue?: string; diff --git a/lib/util/git/index.ts b/lib/util/git/index.ts index 014c0efb17b7127ba9b6ea04a241a19f059ef5a1..303b53d8a01707ab1f49b9ad1cf5d04c3140f6a6 100644 --- a/lib/util/git/index.ts +++ b/lib/util/git/index.ts @@ -251,7 +251,7 @@ async function cleanLocalBranches(): Promise<void> { export function setGitAuthor(gitAuthor: string | undefined): void { const gitAuthorParsed = parseGitAuthor( - gitAuthor || 'Renovate Bot <renovate@whitesourcesoftware.com>' + gitAuthor ?? 'Renovate Bot <renovate@whitesourcesoftware.com>' ); if (!gitAuthorParsed) { const error = new Error(CONFIG_VALIDATION); @@ -769,7 +769,7 @@ export async function getFile( await syncGit(); try { const content = await git.show([ - 'origin/' + (branchName || config.currentBranch) + ':' + filePath, + 'origin/' + (branchName ?? config.currentBranch) + ':' + filePath, ]); return content; } catch (err) { @@ -1022,7 +1022,7 @@ export function getUrl({ return `git@${hostname}:${repository}.git`; } return URL.format({ - protocol: protocol || 'https', + protocol: protocol ?? 'https', auth, hostname, host, diff --git a/lib/workers/global/config/parse/host-rules-from-env.ts b/lib/workers/global/config/parse/host-rules-from-env.ts index 9a43ddd1b70dd6d5191becc375a970098e20a4aa..f4b85dab3fa0e776d2d227e2902b35ccb1bdcfb2 100644 --- a/lib/workers/global/config/parse/host-rules-from-env.ts +++ b/lib/workers/global/config/parse/host-rules-from-env.ts @@ -2,9 +2,14 @@ import { logger } from '../../../../logger'; import { getDatasourceList } from '../../../../modules/datasource'; import type { HostRule } from '../../../../types'; +type AuthField = 'token' | 'username' | 'password'; + +function isAuthField(x: unknown): x is AuthField { + return x === 'token' || x === 'username' || x === 'password'; +} + export function hostRulesFromEnv(env: NodeJS.ProcessEnv): HostRule[] { const datasources = new Set(getDatasourceList()); - const fields = ['token', 'username', 'password']; const hostRules: HostRule[] = []; @@ -17,11 +22,11 @@ export function hostRulesFromEnv(env: NodeJS.ProcessEnv): HostRule[] { } // Double underscore __ is used in place of hyphen - const splitEnv = envName.toLowerCase().replace(/__/g, '-').split('_'); - const hostType = splitEnv.shift(); + const hostType = splitEnv.shift()!; if (datasources.has(hostType)) { - const suffix = splitEnv.pop(); - if (fields.includes(suffix)) { - let matchHost: string; + const suffix = splitEnv.pop()!; + if (isAuthField(suffix)) { + let matchHost: string | undefined = undefined; const rule: HostRule = {}; rule[suffix] = env[envName]; if (splitEnv.length === 0) { diff --git a/lib/workers/global/config/parse/index.ts b/lib/workers/global/config/parse/index.ts index 9f15970620ddb406580a1cf99ef489bd615ee6bf..3b2947d4c6b845c82ce7b23d14fb01541d7d1346 100644 --- a/lib/workers/global/config/parse/index.ts +++ b/lib/workers/global/config/parse/index.ts @@ -84,7 +84,7 @@ export async function parseConfigs( if (config.detectHostRulesFromEnv) { const hostRules = hostRulesFromEnv(env); - config.hostRules = [...config.hostRules, ...hostRules]; + config.hostRules = [...(config.hostRules ?? []), ...hostRules]; } // Get global config logger.trace({ config }, 'Full config'); diff --git a/lib/workers/global/index.ts b/lib/workers/global/index.ts index f88d724791eee3d45140860c7a7012ed91b86ae4..f41b40ad0174566f9bf5ea2677b559d812cb759e 100644 --- a/lib/workers/global/index.ts +++ b/lib/workers/global/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import is from '@sindresorhus/is'; import { ERROR } from 'bunyan'; import fs from 'fs-extra'; @@ -56,7 +57,7 @@ function haveReachedLimits(): boolean { /* istanbul ignore next */ function checkEnv(): void { - const range = pkg.engines.node; + const range = pkg.engines!.node; const rangeNext = pkg['engines-next']?.node; if (process.release?.name !== 'node' || !process.versions?.node) { logger.warn( @@ -141,7 +142,7 @@ export async function start(): Promise<number> { } // Iterate through repositories sequentially - for (const repository of config.repositories) { + for (const repository of config.repositories!) { if (haveReachedLimits()) { break; } @@ -161,13 +162,13 @@ export async function start(): Promise<number> { } else { logger.fatal({ err }, `Fatal error: ${String(err.message)}`); } - if (!config) { + if (!config!) { // return early if we can't parse config options logger.debug(`Missing config`); return 2; } } finally { - await globalFinalize(config); + await globalFinalize(config!); logger.debug(`Renovate exiting`); } const loggerErrors = getProblems().filter((p) => p.level >= ERROR); diff --git a/lib/workers/global/initialize.ts b/lib/workers/global/initialize.ts index 0859eab1a94353998167b39e788499514cdb6337..45558a690bd88ece075aefad6529fb6858870b88 100644 --- a/lib/workers/global/initialize.ts +++ b/lib/workers/global/initialize.ts @@ -12,7 +12,7 @@ import { Limit, setMaxLimit } from './limits'; async function setDirectories(input: AllConfig): Promise<AllConfig> { const config: AllConfig = { ...input }; - process.env.TMPDIR = process.env.RENOVATE_TMPDIR || os.tmpdir(); + process.env.TMPDIR = process.env.RENOVATE_TMPDIR ?? os.tmpdir(); if (config.baseDir) { logger.debug('Using configured baseDir: ' + config.baseDir); } else { diff --git a/lib/workers/repository/error-config.ts b/lib/workers/repository/error-config.ts index 598ba15272f98f6e4a4edd9cc051e9d1e24cf627..dc42b9a442440c3eceb62aa287763e26286d0837 100644 --- a/lib/workers/repository/error-config.ts +++ b/lib/workers/repository/error-config.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { GlobalConfig } from '../../config/global'; import type { RenovateConfig } from '../../config/types'; import { logger } from '../../logger'; @@ -14,14 +15,14 @@ export async function raiseConfigWarningIssue( if (error.validationSource) { body += `Location: \`${error.validationSource}\`\n`; } - body += `Error type: ${error.validationError}\n`; + body += `Error type: ${error.validationError!}\n`; if (error.validationMessage) { body += `Message: \`${error.validationMessage.replace( regEx(/`/g), "'" )}\`\n`; } - const pr = await platform.getBranchPr(config.onboardingBranch); + const pr = await platform.getBranchPr(config.onboardingBranch!); if (pr?.state === PrState.Open) { logger.debug('Updating onboarding PR with config error notice'); body = `## Action Required: Fix Renovate Configuration\n\n${body}`; @@ -32,7 +33,7 @@ export async function raiseConfigWarningIssue( try { await platform.updatePr({ number: pr.number, - prTitle: config.onboardingPrTitle, + prTitle: config.onboardingPrTitle!, prBody: body, }); } catch (err) /* istanbul ignore next */ { diff --git a/lib/workers/repository/errors-warnings.ts b/lib/workers/repository/errors-warnings.ts index 056a50b624c8162d25b57efcf26d9b601b82f3f3..4c3d0d3ab18b7f8347b46dd449d2bebeb98213ca 100644 --- a/lib/workers/repository/errors-warnings.ts +++ b/lib/workers/repository/errors-warnings.ts @@ -1,15 +1,17 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import type { RenovateConfig } from '../../config/types'; import { logger } from '../../logger'; import type { PackageFile } from '../../modules/manager/types'; import { emojify } from '../../util/emoji'; export function getWarnings(config: RenovateConfig): string { - if (!config.warnings.length) { + const warnings = config.warnings!; + if (!warnings.length) { return ''; } - let warningText = `\n# Warnings (${config.warnings.length})\n\n`; + let warningText = `\n# Warnings (${warnings.length})\n\n`; warningText += `Please correct - or verify that you can safely ignore - these warnings before you merge this PR.\n\n`; - config.warnings.forEach((w) => { + warnings.forEach((w) => { warningText += `- \`${w.topic}\`: ${w.message}\n`; }); warningText += '\n---\n'; @@ -18,12 +20,13 @@ export function getWarnings(config: RenovateConfig): string { export function getErrors(config: RenovateConfig): string { let errorText = ''; - if (!config.errors.length) { + const errors = config.errors!; + if (!errors.length) { return ''; } - errorText = `\n# Errors (${config.errors.length})\n\n`; + errorText = `\n# Errors (${errors.length})\n\n`; errorText += `Renovate has found errors that you should fix (in this branch) before finishing this PR.\n\n`; - config.errors.forEach((e) => { + errors.forEach((e) => { errorText += `- \`${e.topic}\`: ${e.message}\n`; }); errorText += '\n---\n'; @@ -46,8 +49,8 @@ export function getDepWarnings( if (!warnings.includes(message)) { warnings.push(message); } - if (!warningFiles.includes(file.packageFile)) { - warningFiles.push(file.packageFile); + if (!warningFiles.includes(file.packageFile!)) { + warningFiles.push(file.packageFile!); } } } diff --git a/lib/workers/repository/finalise/index.ts b/lib/workers/repository/finalise/index.ts index bcc6f79e0fc7f0e8b550f81c862473b984b94c20..5a588bda292e523da925651c27edd63738674836 100644 --- a/lib/workers/repository/finalise/index.ts +++ b/lib/workers/repository/finalise/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import type { RenovateConfig } from '../../../config/types'; import { logger } from '../../../logger'; import { platform } from '../../../modules/platform'; @@ -19,11 +20,11 @@ export async function finaliseRepo( const migratedConfigData = await MigratedDataFactory.getAsync(); const migrationBranch = await checkConfigMigrationBranch( config, - migratedConfigData + migratedConfigData! ); // null if migration not needed if (migrationBranch) { branchList.push(migrationBranch); - await ensureConfigMigrationPr(config, migratedConfigData); + await ensureConfigMigrationPr(config, migratedConfigData!); } MigratedDataFactory.reset(); } diff --git a/lib/workers/repository/finalise/prune.ts b/lib/workers/repository/finalise/prune.ts index dde02f6f5ca234fa409490195d69ff0510db15f9..edf6b39725c5b63fd2215210a017e779d6a3be0e 100644 --- a/lib/workers/repository/finalise/prune.ts +++ b/lib/workers/repository/finalise/prune.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { GlobalConfig } from '../../../config/global'; import type { RenovateConfig } from '../../../config/types'; import { REPOSITORY_CHANGED } from '../../../constants/error-messages'; @@ -100,7 +101,7 @@ export async function pruneStaleBranches( return; } let renovateBranches = getBranchList().filter((branchName) => - branchName.startsWith(config.branchPrefix) + branchName.startsWith(config.branchPrefix!) ); if (!renovateBranches?.length) { logger.debug('No renovate branches found'); diff --git a/lib/workers/repository/index.ts b/lib/workers/repository/index.ts index 2e5c9095df5ea8aa0d2ae508050ef49f29301e98..6605c5233e5a7f46ac19a7e34b0d13d63cec7717 100644 --- a/lib/workers/repository/index.ts +++ b/lib/workers/repository/index.ts @@ -22,7 +22,7 @@ import { printRequestStats } from './stats'; export async function renovateRepository( repoConfig: RenovateConfig, canRetry = true -): Promise<ProcessResult> { +): Promise<ProcessResult | undefined> { splitInit(); let config = GlobalConfig.set( applySecretsToConfig(repoConfig, undefined, false) @@ -31,9 +31,9 @@ export async function renovateRepository( setMeta({ repository: config.repository }); logger.info({ renovateVersion: pkg.version }, 'Repository started'); logger.trace({ config }); - let repoResult: ProcessResult; + let repoResult: ProcessResult | undefined; queue.clear(); - const { localDir } = GlobalConfig.get(); + const localDir = GlobalConfig.get('localDir')!; try { await fs.ensureDir(localDir); logger.debug('Using localDir: ' + localDir); @@ -62,7 +62,8 @@ export async function renovateRepository( await ensureDependencyDashboard(config, branches); } await finaliseRepo(config, branchList); - repoResult = processResult(config, res); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + repoResult = processResult(config, res!); } } catch (err) /* istanbul ignore next */ { setMeta({ repository: config.repository }); diff --git a/lib/workers/repository/init/apis.ts b/lib/workers/repository/init/apis.ts index 35743546c03ab00d3ed83dcb84728ade6a09b377..fe21c16925b69be2c69db2cc73ee6220b5ae10a5 100644 --- a/lib/workers/repository/init/apis.ts +++ b/lib/workers/repository/init/apis.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { configFileNames } from '../../../config/app-strings'; import type { RenovateConfig } from '../../../config/types'; import { @@ -12,8 +13,8 @@ export type WorkerPlatformConfig = RepoResult & Record<string, any>; const defaultConfigFile = (config: RenovateConfig): string => - configFileNames.includes(config.onboardingConfigFileName) - ? config.onboardingConfigFileName + configFileNames.includes(config.onboardingConfigFileName!) + ? config.onboardingConfigFileName! : configFileNames[0]; async function getJsonFile(file: string): Promise<RenovateConfig | null> { diff --git a/lib/workers/repository/init/vulnerability.ts b/lib/workers/repository/init/vulnerability.ts index 5c7fd8d29671c9868947eb38e10fe44ed8021267..ad02bf6c38605d145971a8682446c3ee566d1d19 100644 --- a/lib/workers/repository/init/vulnerability.ts +++ b/lib/workers/repository/init/vulnerability.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import type { PackageRule, RenovateConfig } from '../../../config/types'; import { NO_VULNERABILITY_ALERTS } from '../../../constants/error-messages'; import { logger } from '../../../logger'; @@ -107,7 +108,7 @@ export async function detectVulnerabilityAlerts( const firstPatchedVersion = alert.securityVulnerability.firstPatchedVersion.identifier; const advisory = alert.securityAdvisory; - let { vulnerableRequirements } = alert; + let vulnerableRequirements = alert.vulnerableRequirements!; // istanbul ignore if if (!vulnerableRequirements.length) { if (datasource === MavenDatasource.id) { @@ -163,17 +164,17 @@ export async function detectVulnerabilityAlerts( try { prBodyNotes = ['### GitHub Vulnerability Alerts'].concat( val.advisories.map((advisory) => { + const identifiers = advisory.identifiers!; + const description = advisory.description!; let content = '#### '; let heading: string; - if (advisory.identifiers.some((id) => id.type === 'CVE')) { - heading = advisory.identifiers + if (identifiers.some((id) => id.type === 'CVE')) { + heading = identifiers .filter((id) => id.type === 'CVE') .map((id) => id.value) .join(' / '); } else { - heading = advisory.identifiers - .map((id) => id.value) - .join(' / '); + heading = identifiers.map((id) => id.value).join(' / '); } if (advisory.references.length) { heading = `[${heading}](${advisory.references[0].url})`; @@ -181,7 +182,7 @@ export async function detectVulnerabilityAlerts( content += heading; content += '\n\n'; - content += sanitizeMarkdown(advisory.description); + content += sanitizeMarkdown(description); return content; }) ); @@ -201,9 +202,13 @@ export async function detectVulnerabilityAlerts( const supportedRemediationFileTypes = ['package-lock.json']; if ( config.transitiveRemediation && - supportedRemediationFileTypes.includes(val.fileType) + supportedRemediationFileTypes.includes(val.fileType!) ) { - config.remediations[fileName] ||= []; + const remediations = config.remediations as Record< + string, + unknown[] + >; + remediations[fileName] ??= []; const currentVersion = matchCurrentVersion.replace('=', '').trim(); const newVersion = allowedVersions; const remediation = { @@ -213,7 +218,7 @@ export async function detectVulnerabilityAlerts( newVersion, prBodyNotes, }; - config.remediations[fileName].push(remediation); + remediations[fileName].push(remediation); } else { // Remediate only direct dependencies matchRule = { @@ -230,7 +235,7 @@ export async function detectVulnerabilityAlerts( config.transitiveRemediation && matchRule.matchFiles?.[0] === 'package.json' ) { - matchRule.force.rangeStrategy = 'replace'; + matchRule.force!.rangeStrategy = 'replace'; } } alertPackageRules.push(matchRule); @@ -239,6 +244,6 @@ export async function detectVulnerabilityAlerts( } } logger.debug({ alertPackageRules }, 'alert package rules'); - config.packageRules = (config.packageRules || []).concat(alertPackageRules); + config.packageRules = (config.packageRules ?? []).concat(alertPackageRules); return config; } diff --git a/lib/workers/repository/onboarding/branch/check.ts b/lib/workers/repository/onboarding/branch/check.ts index 911092d953f6a5a789eb4cf1823f8a3a90bbe02c..e61a234ccd181ff6f7dccfdc0e1e26239fdcb9db 100644 --- a/lib/workers/repository/onboarding/branch/check.ts +++ b/lib/workers/repository/onboarding/branch/check.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { configFileNames } from '../../../../config/app-strings'; import type { RenovateConfig } from '../../../../config/types'; import { @@ -45,7 +46,7 @@ export type Pr = any; const closedPrExists = (config: RenovateConfig): Promise<Pr> => platform.findPr({ - branchName: config.onboardingBranch, + branchName: config.onboardingBranch!, prTitle: config.onboardingPrTitle, state: PrState.NotOpen, }); @@ -117,7 +118,7 @@ export const isOnboarded = async (config: RenovateConfig): Promise<boolean> => { return true; } logger.debug('Repo is not onboarded and no merged PRs exist'); - if (!config.suppressNotifications.includes('onboardingClose')) { + if (!config.suppressNotifications!.includes('onboardingClose')) { // ensure PR comment await ensureComment({ number: pr.number, @@ -130,4 +131,4 @@ export const isOnboarded = async (config: RenovateConfig): Promise<boolean> => { export const onboardingPrExists = async ( config: RenovateConfig -): Promise<boolean> => !!(await platform.getBranchPr(config.onboardingBranch)); +): Promise<boolean> => !!(await platform.getBranchPr(config.onboardingBranch!)); diff --git a/lib/workers/repository/onboarding/branch/config.ts b/lib/workers/repository/onboarding/branch/config.ts index bdce49e22b5588841692a609b54816874d45f1de..6236169342a1592d1912c95004d1a55071f82c97 100644 --- a/lib/workers/repository/onboarding/branch/config.ts +++ b/lib/workers/repository/onboarding/branch/config.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { GlobalConfig } from '../../../../config/global'; import { getPreset } from '../../../../config/presets/local'; import { PRESET_DEP_NOT_FOUND } from '../../../../config/presets/util'; @@ -14,13 +15,13 @@ async function getOnboardingConfig( ): Promise<RenovateSharedConfig> { let onboardingConfig = clone(config.onboardingConfig); - let orgPreset: string; + let orgPreset: string | undefined; logger.debug( 'Checking if this org/owner has a default Renovate preset which can be used.' ); - const orgName = config.repository.split('/')[0]; + const orgName = config.repository!.split('/')[0]; // Check for org/renovate-config try { diff --git a/lib/workers/repository/onboarding/branch/create.ts b/lib/workers/repository/onboarding/branch/create.ts index 1547ffcd0d308a95dd0c6b1196438961c176f499..98870a40b6a2ee3448072158ecc42c078fd42886 100644 --- a/lib/workers/repository/onboarding/branch/create.ts +++ b/lib/workers/repository/onboarding/branch/create.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { configFileNames } from '../../../../config/app-strings'; import { GlobalConfig } from '../../../../config/global'; import type { RenovateConfig } from '../../../../config/types'; @@ -11,17 +12,17 @@ const defaultConfigFile = configFileNames[0]; export async function createOnboardingBranch( config: Partial<RenovateConfig> ): Promise<string | null> { - const configFile = configFileNames.includes(config.onboardingConfigFileName) + const configFile = configFileNames.includes(config.onboardingConfigFileName!) ? config.onboardingConfigFileName : defaultConfigFile; logger.debug('createOnboardingBranch()'); - const contents = await getOnboardingConfigContents(config, configFile); + const contents = await getOnboardingConfigContents(config, configFile!); logger.debug('Creating onboarding branch'); const commitMessageFactory = new OnboardingCommitMessageFactory( config, - configFile + configFile! ); const commitMessage = commitMessageFactory.create(); @@ -32,11 +33,11 @@ export async function createOnboardingBranch( } return commitAndPush({ - branchName: config.onboardingBranch, + branchName: config.onboardingBranch!, files: [ { type: 'addition', - path: configFile, + path: configFile!, contents, }, ], diff --git a/lib/workers/repository/onboarding/branch/index.ts b/lib/workers/repository/onboarding/branch/index.ts index 09bff1bcb727811ad1107414037ac6bcbf5e4254..030998f9d1fb6f322ca16f5d26c192fd55ad0cf0 100644 --- a/lib/workers/repository/onboarding/branch/index.ts +++ b/lib/workers/repository/onboarding/branch/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { mergeChildConfig } from '../../../../config'; import { GlobalConfig } from '../../../../config/global'; import type { RenovateConfig } from '../../../../config/types'; @@ -43,8 +44,8 @@ export async function checkOnboardingBranch( } // istanbul ignore if if (platform.refreshPr) { - const onboardingPr = await platform.getBranchPr(config.onboardingBranch); - await platform.refreshPr(onboardingPr.number); + const onboardingPr = await platform.getBranchPr(config.onboardingBranch!); + await platform.refreshPr(onboardingPr!.number); } } else { logger.debug('Onboarding PR does not exist'); @@ -71,8 +72,8 @@ export async function checkOnboardingBranch( } } if (!GlobalConfig.get('dryRun')) { - await checkoutBranch(onboardingBranch); + await checkoutBranch(onboardingBranch!); } - const branchList = [onboardingBranch]; + const branchList = [onboardingBranch!]; return { ...config, repoIsOnboarded, onboardingBranch, branchList }; } diff --git a/lib/workers/repository/onboarding/branch/rebase.ts b/lib/workers/repository/onboarding/branch/rebase.ts index 82a872ee5feb606924a44fe949013eb8573b16b7..1aadf206ef31325d526109ad8b1eb2634abba964 100644 --- a/lib/workers/repository/onboarding/branch/rebase.ts +++ b/lib/workers/repository/onboarding/branch/rebase.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { configFileNames } from '../../../../config/app-strings'; import { GlobalConfig } from '../../../../config/global'; import type { RenovateConfig } from '../../../../config/types'; @@ -8,15 +9,15 @@ import { OnboardingCommitMessageFactory } from './commit-message'; import { getOnboardingConfigContents } from './config'; const defaultConfigFile = (config: RenovateConfig): string => - configFileNames.includes(config.onboardingConfigFileName) - ? config.onboardingConfigFileName + configFileNames.includes(config.onboardingConfigFileName!) + ? config.onboardingConfigFileName! : configFileNames[0]; export async function rebaseOnboardingBranch( config: RenovateConfig ): Promise<string | null> { logger.debug('Checking if onboarding branch needs rebasing'); - if (await isBranchModified(config.onboardingBranch)) { + if (await isBranchModified(config.onboardingBranch!)) { logger.debug('Onboarding branch has been edited and cannot be rebased'); return null; } @@ -25,7 +26,7 @@ export async function rebaseOnboardingBranch( const contents = await getOnboardingConfigContents(config, configFile); if ( contents === existingContents && - !(await isBranchStale(config.onboardingBranch)) + !(await isBranchStale(config.onboardingBranch!)) ) { logger.debug('Onboarding branch is up to date'); return null; @@ -45,7 +46,7 @@ export async function rebaseOnboardingBranch( } return commitAndPush({ - branchName: config.onboardingBranch, + branchName: config.onboardingBranch!, files: [ { type: 'addition', diff --git a/lib/workers/repository/onboarding/pr/config-description.ts b/lib/workers/repository/onboarding/pr/config-description.ts index 53c6055f613523e7e617aaeb3a4cc5e1a38a2c34..c09ae1096ff59bcf7bf6aaaf7d6f04bc2380aa8c 100644 --- a/lib/workers/repository/onboarding/pr/config-description.ts +++ b/lib/workers/repository/onboarding/pr/config-description.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import is from '@sindresorhus/is'; import { configFileNames } from '../../../../config/app-strings'; import type { RenovateConfig } from '../../../../config/types'; @@ -33,7 +34,7 @@ export function getConfigDesc( config: RenovateConfig, packageFiles?: Record<string, PackageFile[]> ): string { - const configFile = configFileNames.includes(config.onboardingConfigFileName) + const configFile = configFileNames.includes(config.onboardingConfigFileName!) ? config.onboardingConfigFileName : defaultConfigFile; logger.debug('getConfigDesc()'); diff --git a/lib/workers/repository/onboarding/pr/index.ts b/lib/workers/repository/onboarding/pr/index.ts index dc3c6a5302c66f2fe6e69b0894cba3b81d15a764..409c2c0886defe51a91a13a4462524cead7a2dd5 100644 --- a/lib/workers/repository/onboarding/pr/index.ts +++ b/lib/workers/repository/onboarding/pr/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import is from '@sindresorhus/is'; import { GlobalConfig } from '../../../../config/global'; import type { RenovateConfig } from '../../../../config/types'; @@ -31,9 +32,11 @@ export async function ensureOnboardingPr( } logger.debug('ensureOnboardingPr()'); logger.trace({ config }); - const existingPr = await platform.getBranchPr(config.onboardingBranch); + const existingPr = await platform.getBranchPr(config.onboardingBranch!); logger.debug('Filling in onboarding PR template'); - let prTemplate = `Welcome to [Renovate](${config.productLinks.homepage})! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.\n\n`; + let prTemplate = `Welcome to [Renovate](${ + config.productLinks!.homepage + })! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.\n\n`; prTemplate += config.requireConfig === 'required' ? emojify( @@ -55,8 +58,12 @@ export async function ensureOnboardingPr( --- -:question: Got questions? Check out Renovate's [Docs](${config.productLinks.documentation}), particularly the Getting Started section. -If you need any further assistance then you can also [request help here](${config.productLinks.help}). +:question: Got questions? Check out Renovate's [Docs](${ + config.productLinks!.documentation + }), particularly the Getting Started section. +If you need any further assistance then you can also [request help here](${ + config.productLinks!.help + }). ` ); let prBody = prTemplate; @@ -78,13 +85,15 @@ If you need any further assistance then you can also [request help here](${confi let configDesc = ''; if (GlobalConfig.get('dryRun')) { logger.info(`DRY-RUN: Would check branch ${config.onboardingBranch}`); - } else if (await isBranchModified(config.onboardingBranch)) { + } else if (await isBranchModified(config.onboardingBranch!)) { configDesc = emojify( - `### Configuration\n\n:abcd: Renovate has detected a custom config for this PR. Feel free to ask for [help](${config.productLinks.help}) if you have any doubts and would like it reviewed.\n\n` + `### Configuration\n\n:abcd: Renovate has detected a custom config for this PR. Feel free to ask for [help](${ + config.productLinks!.help + }) if you have any doubts and would like it reviewed.\n\n` ); const isConflicted = await isBranchConflicted( - config.baseBranch, - config.onboardingBranch + config.baseBranch!, + config.onboardingBranch! ); if (isConflicted) { configDesc += emojify( @@ -94,12 +103,12 @@ If you need any further assistance then you can also [request help here](${confi configDesc += `Important: Now that this branch is edited, Renovate can't rebase it from the base branch any more. If you make changes to the base branch that could impact this onboarding PR, please merge them manually.\n\n`; } } else { - configDesc = getConfigDesc(config, packageFiles); + configDesc = getConfigDesc(config, packageFiles!); } prBody = prBody.replace('{{CONFIG}}\n', configDesc); prBody = prBody.replace( '{{WARNINGS}}\n', - getWarnings(config) + getDepWarnings(packageFiles) + getWarnings(config) + getDepWarnings(packageFiles!) ); prBody = prBody.replace('{{ERRORS}}\n', getErrors(config)); prBody = prBody.replace('{{BASEBRANCH}}\n', getBaseBranchDesc(config)); @@ -142,15 +151,15 @@ If you need any further assistance then you can also [request help here](${confi logger.info('DRY-RUN: Would create onboarding PR'); } else { const pr = await platform.createPr({ - sourceBranch: config.onboardingBranch, - targetBranch: config.defaultBranch, - prTitle: config.onboardingPrTitle, + sourceBranch: config.onboardingBranch!, + targetBranch: config.defaultBranch!, + prTitle: config.onboardingPrTitle!, prBody, labels, platformOptions: getPlatformPrOptions({ ...config, automerge: false }), }); - logger.info({ pr: pr.displayNumber }, 'Onboarding PR created'); - await addParticipants(config, pr); + logger.info({ pr: pr!.displayNumber }, 'Onboarding PR created'); + await addParticipants(config, pr!); } } catch (err) { if ( @@ -162,7 +171,7 @@ If you need any further assistance then you can also [request help here](${confi logger.warn( 'Onboarding PR already exists but cannot find it. It was probably created by a different user.' ); - await deleteBranch(config.onboardingBranch); + await deleteBranch(config.onboardingBranch!); return; } throw err; diff --git a/lib/workers/repository/onboarding/pr/pr-list.ts b/lib/workers/repository/onboarding/pr/pr-list.ts index 519b4f7ec5c6a081c6cf441ddc78da07b0017d6c..6c4af79aa5dca87b82bd1ac9ee2966138063b960 100644 --- a/lib/workers/repository/onboarding/pr/pr-list.ts +++ b/lib/workers/repository/onboarding/pr/pr-list.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import type { RenovateConfig } from '../../../../config/types'; import { logger } from '../../../../logger'; import { emojify } from '../../../../util/emoji'; @@ -19,7 +20,7 @@ export function getPrList( for (const branch of branches) { const prTitleRe = regEx(/@([a-z]+\/[a-z]+)/); - prDesc += `<details>\n<summary>${branch.prTitle.replace( + prDesc += `<details>\n<summary>${branch.prTitle!.replace( prTitleRe, '@​$1' )}</summary>\n\n`; @@ -44,11 +45,11 @@ export function getPrList( if (upgrade.sourceUrl) { text += `[${upgrade.depName}](${upgrade.sourceUrl})`; } else { - text += upgrade.depName.replace(prTitleRe, '@​$1'); + text += upgrade.depName!.replace(prTitleRe, '@​$1'); } text += upgrade.isLockfileUpdate ? ` to \`${upgrade.newVersion}\`` - : ` to \`${upgrade.newDigest || upgrade.newValue}\``; + : ` to \`${upgrade.newDigest ?? upgrade.newValue}\``; text += '\n'; } if (!seen.includes(text)) { @@ -59,13 +60,14 @@ export function getPrList( prDesc += '\n\n'; prDesc += '</details>\n\n'; } + const prHourlyLimit = config.prHourlyLimit!; if ( - config.prHourlyLimit > 0 && - config.prHourlyLimit < 5 && - config.prHourlyLimit < branches.length + prHourlyLimit > 0 && + prHourlyLimit < 5 && + prHourlyLimit < branches.length ) { prDesc += emojify( - `<br />\n\n:children_crossing: Branch creation will be limited to maximum ${config.prHourlyLimit} per hour, so it doesn't swamp any CI resources or spam the project. See docs for \`prhourlylimit\` for details.\n\n` + `<br />\n\n:children_crossing: Branch creation will be limited to maximum ${prHourlyLimit} per hour, so it doesn't swamp any CI resources or spam the project. See docs for \`prhourlylimit\` for details.\n\n` ); } return prDesc; diff --git a/lib/workers/repository/process/deprecated.ts b/lib/workers/repository/process/deprecated.ts index d1b6066db5ab0e27be16e387dba008db85397460..46469213bd36df1ba2bf42a035907e2134ed7b03 100644 --- a/lib/workers/repository/process/deprecated.ts +++ b/lib/workers/repository/process/deprecated.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { GlobalConfig } from '../../../config/global'; import type { RenovateConfig } from '../../../config/types'; import { logger } from '../../../logger'; @@ -23,12 +24,14 @@ export async function raiseDeprecationWarnings( for (const dep of packageFile.deps) { const { deprecationMessage } = dep; if (deprecationMessage) { - deprecatedPackages[dep.depName] = deprecatedPackages[dep.depName] || { + deprecatedPackages[dep.depName!] = deprecatedPackages[ + dep.depName! + ] || { deprecationMessage, depPackageFiles: [], }; - deprecatedPackages[dep.depName].depPackageFiles.push( - packageFile.packageFile + deprecatedPackages[dep.depName!].depPackageFiles.push( + packageFile.packageFile! ); } } @@ -61,7 +64,7 @@ export async function raiseDeprecationWarnings( const ensureOnce = true; await platform.ensureIssue({ title: issueTitle, - body: issueBody, + body: issueBody!, once: ensureOnce, confidential: config.confidential, }); @@ -73,11 +76,11 @@ export async function raiseDeprecationWarnings( const issueList = await platform.getIssueList(); if (issueList?.length) { const deprecatedIssues = issueList.filter( - (i) => i.title.startsWith(issueTitlePrefix) && i.state === 'open' + (i) => i.title!.startsWith(issueTitlePrefix) && i.state === 'open' ); for (const i of deprecatedIssues) { - if (!issueTitleList.includes(i.title)) { - await platform.ensureIssueClosing(i.title); + if (!issueTitleList.includes(i.title!)) { + await platform.ensureIssueClosing(i.title!); } } } diff --git a/lib/workers/repository/process/extract-update.ts b/lib/workers/repository/process/extract-update.ts index fb12b3d1c3c403eea90fdec65c38428eaf85d8cf..eab3f61620d1e3d5bbff623ba0bec1171b372b19 100644 --- a/lib/workers/repository/process/extract-update.ts +++ b/lib/workers/repository/process/extract-update.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import is from '@sindresorhus/is'; import hasha from 'hasha'; import type { RenovateConfig } from '../../../config/types'; @@ -19,12 +20,24 @@ export type ExtractResult = { packageFiles: Record<string, PackageFile[]>; }; +export interface StatsResult { + fileCount: number; + depCount: number; +} + +export interface Stats { + managers: Record<string, StatsResult>; + total: StatsResult; +} + // istanbul ignore next -function extractStats(packageFiles: Record<string, PackageFile[]>): any { +function extractStats( + packageFiles: Record<string, PackageFile[]> +): Stats | null { if (!packageFiles) { - return {}; + return null; } - const stats = { + const stats: Stats = { managers: {}, total: { fileCount: 0, @@ -52,11 +65,11 @@ export async function extract( ): Promise<Record<string, PackageFile[]>> { logger.debug('extract()'); const { baseBranch } = config; - const baseBranchSha = getBranchCommit(baseBranch); + const baseBranchSha = getBranchCommit(baseBranch!); let packageFiles: Record<string, PackageFile[]>; const cache = getCache(); cache.scan ||= {}; - const cachedExtract = cache.scan[baseBranch]; + const cachedExtract = cache.scan[baseBranch!]; const configHash = hasha(JSON.stringify(config)); // istanbul ignore if if ( @@ -78,10 +91,10 @@ export async function extract( logger.info({ err }, 'Error deleting cached dep updates'); } } else { - await checkoutBranch(baseBranch); + await checkoutBranch(baseBranch!); packageFiles = await extractAllDependencies(config); - cache.scan[baseBranch] = { - sha: baseBranchSha, + cache.scan[baseBranch!] = { + sha: baseBranchSha!, configHash, packageFiles, }; @@ -91,7 +104,7 @@ export async function extract( : [baseBranch]; Object.keys(cache.scan).forEach((branchName) => { if (!baseBranches.includes(branchName)) { - delete cache.scan[branchName]; + delete cache.scan![branchName]; } }); } diff --git a/lib/workers/repository/process/fetch.ts b/lib/workers/repository/process/fetch.ts index 2c5fc00604432adce993de8eff66f7aba26fbd4e..e022f19da324ad7b9303674c2ce98c8bc3a73e49 100644 --- a/lib/workers/repository/process/fetch.ts +++ b/lib/workers/repository/process/fetch.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import is from '@sindresorhus/is'; import pAll from 'p-all'; import { getManagerConfig, mergeChildConfig } from '../../../config'; @@ -35,10 +36,10 @@ async function fetchDepUpdates( const { depName } = dep; // TODO: fix types let depConfig = mergeChildConfig(packageFileConfig, dep); - const datasourceDefaultConfig = await getDefaultConfig(depConfig.datasource); + const datasourceDefaultConfig = await getDefaultConfig(depConfig.datasource!); depConfig = mergeChildConfig(depConfig, datasourceDefaultConfig); depConfig = applyPackageRules(depConfig); - if (depConfig.ignoreDeps.includes(depName)) { + if (depConfig.ignoreDeps!.includes(depName!)) { logger.debug({ dependency: depName }, 'Dependency is ignored'); dep.skipReason = 'ignored'; } else if (depConfig.enabled === false) { @@ -104,7 +105,7 @@ export async function fetchUpdates( fetchManagerUpdates(config, packageFiles, manager) ); await Promise.all(allManagerJobs); - PackageFiles.add(config.baseBranch, { ...packageFiles }); + PackageFiles.add(config.baseBranch!, { ...packageFiles }); logger.debug( { baseBranch: config.baseBranch }, 'Package releases lookups complete' diff --git a/lib/workers/repository/process/index.ts b/lib/workers/repository/process/index.ts index 1c93822bad364aca003ade5d2a02980313ece1ae..4eb1b36921adbd6f2f021e3d8713e73628bb5b4d 100644 --- a/lib/workers/repository/process/index.ts +++ b/lib/workers/repository/process/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { mergeChildConfig } from '../../../config'; import { GlobalConfig } from '../../../config/global'; import type { RenovateConfig } from '../../../config/types'; @@ -37,7 +38,7 @@ async function getBaseBranchConfig( try { baseBranchConfig = await platform.getJsonFile( - configFileName, + configFileName!, config.repository, baseBranch ); @@ -59,7 +60,7 @@ async function getBaseBranchConfig( baseBranchConfig.baseBranches = config.baseBranches; } - if (config.baseBranches.length > 1) { + if (config.baseBranches!.length > 1) { baseBranchConfig.branchPrefix += `${baseBranch}-`; baseBranchConfig.hasBaseBranches = true; } @@ -76,7 +77,7 @@ export async function extractDependencies( let res: ExtractResult = { branches: [], branchList: [], - packageFiles: null, + packageFiles: null!, }; if (config.baseBranches?.length) { logger.debug({ baseBranches: config.baseBranches }, 'baseBranches'); diff --git a/lib/workers/repository/process/limits.ts b/lib/workers/repository/process/limits.ts index 5619fa5bc7df3f9b4500102b2fffcef7126f11df..3557c05cf49485bbbab79a2a4b9e03e7a4d0142c 100644 --- a/lib/workers/repository/process/limits.ts +++ b/lib/workers/repository/process/limits.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { DateTime } from 'luxon'; import type { RenovateConfig } from '../../../config/types'; import { logger } from '../../../logger'; @@ -19,8 +20,8 @@ export async function getPrHourlyRemaining( const soFarThisHour = prList.filter( (pr) => pr.sourceBranch !== config.onboardingBranch && - pr.sourceBranch.startsWith(config.branchPrefix) && - DateTime.fromISO(pr.createdAt) > currentHourStart + pr.sourceBranch.startsWith(config.branchPrefix!) && + DateTime.fromISO(pr.createdAt!) > currentHourStart ); const prsRemaining = Math.max( 0, diff --git a/lib/workers/repository/process/sort.ts b/lib/workers/repository/process/sort.ts index 396a1aa97cda73fe9b8009248c2caa4b3a51d771..ceaabb51646cbbda84cbf22752ba8637bde1a39c 100644 --- a/lib/workers/repository/process/sort.ts +++ b/lib/workers/repository/process/sort.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { logger } from '../../../logger'; import type { BranchConfig } from '../../types'; @@ -17,14 +18,14 @@ export function sortBranches(branches: Partial<BranchConfig>[]): void { return -1; } if (a.prPriority !== b.prPriority) { - return b.prPriority - a.prPriority; + return b.prPriority! - a.prPriority!; } const sortDiff = - sortOrder.indexOf(a.updateType) - sortOrder.indexOf(b.updateType); + sortOrder.indexOf(a.updateType!) - sortOrder.indexOf(b.updateType!); if (sortDiff !== 0) { return sortDiff; } // Sort by prTitle if updateType is the same - return a.prTitle < b.prTitle ? -1 : 1; + return a.prTitle! < b.prTitle! ? -1 : 1; }); } diff --git a/lib/workers/repository/process/vulnerabilities.ts b/lib/workers/repository/process/vulnerabilities.ts index f61447cfcc21466edac826090586d91a0593a0f3..f540b44cc64abffe559d5e4447c0f513ee16066a 100644 --- a/lib/workers/repository/process/vulnerabilities.ts +++ b/lib/workers/repository/process/vulnerabilities.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { Ecosystem, Osv, OsvOffline } from '@jamiemagee/osv-offline'; import pAll from 'p-all'; import { getManagerConfig, mergeChildConfig } from '../../../config'; @@ -104,16 +105,16 @@ export class Vulnerabilities { packageDependency: PackageDependency ): Promise<PackageRule[]> { const ecosystem = - Vulnerabilities.managerEcosystemMap[packageFileConfig.manager]; + Vulnerabilities.managerEcosystemMap[packageFileConfig.manager!]; const vulnerabilities = await this.osvOffline?.getVulnerabilities( - ecosystem, - packageDependency.depName + ecosystem!, + packageDependency.depName! ); return this.convertToPackageRule( vulnerabilities ?? [], - packageDependency.depName, - ecosystem + packageDependency.depName!, + ecosystem! ); } @@ -134,7 +135,7 @@ export class Vulnerabilities { matchPackageNames: [dependencyName], allowedVersions: affected?.ranges?.[0].events.find( (event) => event.fixed !== undefined - ).fixed, + )!.fixed, isVulnerabilityAlert: true, }) ); diff --git a/lib/workers/repository/update/branch/auto-replace.ts b/lib/workers/repository/update/branch/auto-replace.ts index 60c30a4bf0379f68cd6678cfe548bf160c4ce403..2395f4dc33114450e6a9a1028d1097e5685e755d 100644 --- a/lib/workers/repository/update/branch/auto-replace.ts +++ b/lib/workers/repository/update/branch/auto-replace.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { WORKER_FILE_UPDATE_FAILED } from '../../../../constants/error-messages'; import { logger } from '../../../../logger'; import { get } from '../../../../modules/manager'; @@ -24,7 +25,7 @@ export async function confirmIfDepUpdated( const extractPackageFile = get(manager, 'extractPackageFile'); let newUpgrade: PackageDependency; try { - const newExtract = await extractPackageFile( + const newExtract = await extractPackageFile!( newContent, packageFile, upgrade @@ -34,11 +35,11 @@ export async function confirmIfDepUpdated( logger.debug({ manager, packageFile }, 'Could not extract package file'); return false; } - newUpgrade = newExtract.deps[depIndex]; + newUpgrade = newExtract.deps[depIndex!]; } catch (err) /* istanbul ignore next */ { logger.debug({ manager, packageFile, err }, 'Failed to parse newContent'); } - if (!newUpgrade) { + if (!newUpgrade!) { logger.debug({ manager, packageFile }, 'No newUpgrade'); return false; } @@ -91,12 +92,9 @@ export async function checkBranchDepsMatchBaseDeps( const { baseDeps, manager, packageFile } = upgrade; const extractPackageFile = get(manager, 'extractPackageFile'); try { - const { deps: branchDeps } = await extractPackageFile( - branchContent, - packageFile, - upgrade - ); - return getDepsSignature(baseDeps) === getDepsSignature(branchDeps); + const res = await extractPackageFile!(branchContent, packageFile, upgrade)!; + const branchDeps = res!.deps; + return getDepsSignature(baseDeps!) === getDepsSignature(branchDeps); } catch (err) /* istanbul ignore next */ { logger.info( { manager, packageFile }, @@ -138,9 +136,9 @@ export async function doAutoReplace( logger.debug({ packageFile, depName }, 'Branch dep is already updated'); return existingContent; } - const replaceString = upgrade.replaceString || currentValue; + const replaceString = upgrade.replaceString ?? currentValue; logger.trace({ depName, replaceString }, 'autoReplace replaceString'); - let searchIndex = existingContent.indexOf(replaceString); + let searchIndex = existingContent.indexOf(replaceString!); if (searchIndex === -1) { logger.info( { packageFile, depName, existingContent, replaceString }, @@ -153,11 +151,11 @@ export async function doAutoReplace( if (autoReplaceStringTemplate) { newString = compile(autoReplaceStringTemplate, upgrade, false); } else { - newString = replaceString; + newString = replaceString!; if (currentValue) { newString = newString.replace( regEx(escapeRegExp(currentValue), 'g'), - newValue + newValue! ); } if (currentDigest && newDigest) { @@ -174,7 +172,7 @@ export async function doAutoReplace( // Iterate through the rest of the file for (; searchIndex < existingContent.length; searchIndex += 1) { // First check if we have a hit for the old version - if (matchAt(existingContent, searchIndex, replaceString)) { + if (matchAt(existingContent, searchIndex, replaceString!)) { logger.debug( { packageFile, depName }, `Found match at index ${searchIndex}` @@ -183,16 +181,16 @@ export async function doAutoReplace( const testContent = replaceAt( existingContent, searchIndex, - replaceString, + replaceString!, newString ); - await writeLocalFile(upgrade.packageFile, testContent); + await writeLocalFile(upgrade.packageFile!, testContent); if (await confirmIfDepUpdated(upgrade, testContent)) { return testContent; } // istanbul ignore next - await writeLocalFile(upgrade.packageFile, existingContent); + await writeLocalFile(upgrade.packageFile!, existingContent); } } } catch (err) /* istanbul ignore next */ { diff --git a/lib/workers/repository/update/branch/automerge.ts b/lib/workers/repository/update/branch/automerge.ts index 58770efd63be2a031fa26051849a7deb7e3779be..e634f8d7f5f75ebbe351db258bf583b695e880e5 100644 --- a/lib/workers/repository/update/branch/automerge.ts +++ b/lib/workers/repository/update/branch/automerge.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { GlobalConfig } from '../../../../config/global'; import type { RenovateConfig } from '../../../../config/types'; import { logger } from '../../../../logger'; @@ -27,12 +28,12 @@ export async function tryBranchAutomerge( if (!isScheduledNow(config, 'automergeSchedule')) { return 'off schedule'; } - const existingPr = await platform.getBranchPr(config.branchName); + const existingPr = await platform.getBranchPr(config.branchName!); if (existingPr) { return 'automerge aborted - PR exists'; } const branchStatus = await resolveBranchStatus( - config.branchName, + config.branchName!, config.ignoreTests ); if (branchStatus === BranchStatus.green) { @@ -41,7 +42,7 @@ export async function tryBranchAutomerge( if (GlobalConfig.get('dryRun')) { logger.info(`DRY-RUN: Would automerge branch ${config.branchName}`); } else { - await mergeBranch(config.branchName); + await mergeBranch(config.branchName!); } logger.info({ branch: config.branchName }, 'Branch automerged'); return 'automerged'; // Branch no longer exists diff --git a/lib/workers/repository/update/branch/check-existing.ts b/lib/workers/repository/update/branch/check-existing.ts index a16a56a778c4e4d037bce1c775a37243f83ce786..fcd39fc1efa8f4adbe77f2b6416bfbe6fd487a25 100644 --- a/lib/workers/repository/update/branch/check-existing.ts +++ b/lib/workers/repository/update/branch/check-existing.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { REPOSITORY_CHANGED } from '../../../../constants/error-messages'; import { logger } from '../../../../logger'; import { Pr, platform } from '../../../../modules/platform'; @@ -23,8 +24,8 @@ export async function prAlreadyExisted( if (!pr && config.branchPrefix !== config.branchPrefixOld) { pr = await platform.findPr({ branchName: config.branchName.replace( - config.branchPrefix, - config.branchPrefixOld + config.branchPrefix!, + config.branchPrefixOld! ), prTitle: config.prTitle, state: PrState.NotOpen, @@ -38,7 +39,7 @@ export async function prAlreadyExisted( logger.debug('Found closed PR with current title'); const prDetails = await platform.getPr(pr.number); // istanbul ignore if - if (prDetails.state === PrState.Open) { + if (prDetails!.state === PrState.Open) { logger.debug('PR reopened - aborting run'); throw new Error(REPOSITORY_CHANGED); } diff --git a/lib/workers/repository/update/branch/commit.ts b/lib/workers/repository/update/branch/commit.ts index 28f4347e8a69574bd65f4fd38ca8af9b05e3f5bf..e15ced2c2e33340c92a1e4b0ca887497559cda22 100644 --- a/lib/workers/repository/update/branch/commit.ts +++ b/lib/workers/repository/update/branch/commit.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import is from '@sindresorhus/is'; import minimatch from 'minimatch'; import { GlobalConfig } from '../../../../config/global'; @@ -10,11 +11,13 @@ import type { BranchConfig } from '../../../types'; export function commitFilesToBranch( config: BranchConfig ): Promise<string | null> { - let updatedFiles = config.updatedPackageFiles.concat(config.updatedArtifacts); + let updatedFiles = config.updatedPackageFiles!.concat( + config.updatedArtifacts! + ); // istanbul ignore if if (is.nonEmptyArray(config.excludeCommitPaths)) { updatedFiles = updatedFiles.filter(({ path: filePath }) => { - const matchesExcludePaths = config.excludeCommitPaths.some( + const matchesExcludePaths = config.excludeCommitPaths!.some( (excludedPath) => minimatch(filePath, excludedPath, { dot: true }) ); if (matchesExcludePaths) { @@ -26,14 +29,14 @@ export function commitFilesToBranch( } if (!is.nonEmptyArray(updatedFiles)) { logger.debug(`No files to commit`); - return null; + return Promise.resolve(null); } const fileLength = [...new Set(updatedFiles.map((file) => file.path))].length; logger.debug(`${fileLength} file(s) to commit`); // istanbul ignore if if (GlobalConfig.get('dryRun')) { logger.info('DRY-RUN: Would commit files to branch ' + config.branchName); - return null; + return Promise.resolve(null); } // istanbul ignore if if ( @@ -51,7 +54,7 @@ export function commitFilesToBranch( return commitAndPush({ branchName: config.branchName, files: updatedFiles, - message: config.commitMessage, + message: config.commitMessage!, force: !!config.forceCommit, platformCommit: !!config.platformCommit, }); diff --git a/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts b/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts index f79916b6a7b157fed7f1062cdecd8f351e94894e..f1a30887792b20bda83ff1eb2ae62d26602ce99b 100644 --- a/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts +++ b/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import is from '@sindresorhus/is'; import minimatch from 'minimatch'; import { GlobalConfig } from '../../../../config/global'; @@ -25,8 +26,8 @@ export async function postUpgradeCommandsExecutor( filteredUpgradeCommands: BranchUpgradeConfig[], config: BranchConfig ): Promise<PostUpgradeCommandsExecutionResult> { - let updatedArtifacts = [...(config.updatedArtifacts || [])]; - const artifactErrors = [...(config.artifactErrors || [])]; + let updatedArtifacts = [...(config.updatedArtifacts ?? [])]; + const artifactErrors = [...(config.artifactErrors ?? [])]; const { allowedPostUpgradeCommands, allowPostUpgradeCommandTemplating } = GlobalConfig.get(); @@ -39,11 +40,11 @@ export async function postUpgradeCommandsExecutor( }, `Checking for post-upgrade tasks` ); - const commands = upgrade.postUpgradeTasks?.commands || []; - const fileFilters = upgrade.postUpgradeTasks?.fileFilters || []; + const commands = upgrade.postUpgradeTasks?.commands ?? []; + const fileFilters = upgrade.postUpgradeTasks?.fileFilters ?? []; if (is.nonEmptyArray(commands)) { // Persist updated files in file system so any executed commands can see them - for (const file of config.updatedPackageFiles.concat(updatedArtifacts)) { + for (const file of config.updatedPackageFiles!.concat(updatedArtifacts)) { const canWriteFile = await localPathIsFile(file.path); if (file.type === 'addition' && canWriteFile) { let contents; @@ -58,7 +59,9 @@ export async function postUpgradeCommandsExecutor( for (const cmd of commands) { if ( - allowedPostUpgradeCommands.some((pattern) => regEx(pattern).test(cmd)) + allowedPostUpgradeCommands!.some((pattern) => + regEx(pattern).test(cmd) + ) ) { try { const compiledCmd = allowPostUpgradeCommandTemplating @@ -156,8 +159,8 @@ export default async function executePostUpgradeCommands( const { allowedPostUpgradeCommands } = GlobalConfig.get(); const hasChangedFiles = - config.updatedPackageFiles?.length > 0 || - config.updatedArtifacts?.length > 0; + (config.updatedPackageFiles && config.updatedPackageFiles.length > 0) || + (config.updatedArtifacts && config.updatedArtifacts.length > 0); if ( /* Only run post-upgrade tasks if there are changes to package files... */ @@ -173,7 +176,7 @@ export default async function executePostUpgradeCommands( depName: config.upgrades.map(({ depName }) => depName).join(' '), branchName: config.branchName, postUpgradeTasks: - config.postUpgradeTasks.executionMode === 'branch' + config.postUpgradeTasks!.executionMode === 'branch' ? config.postUpgradeTasks : undefined, fileFilters: config.fileFilters, diff --git a/lib/workers/repository/update/branch/get-updated.ts b/lib/workers/repository/update/branch/get-updated.ts index 669b87dbfc443b59fdd3a023aef4b07f7ac02038..c287fe0c7a8b2d37bae7fbf04d8a5352a0dad810 100644 --- a/lib/workers/repository/update/branch/get-updated.ts +++ b/lib/workers/repository/update/branch/get-updated.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import is from '@sindresorhus/is'; import { WORKER_FILE_UPDATE_FAILED } from '../../../../constants/error-messages'; import { logger } from '../../../../logger'; @@ -22,7 +23,7 @@ export async function getUpdatedPackageFiles( config: BranchConfig ): Promise<PackageFilesResult> { logger.trace({ config }); - const { reuseExistingBranch } = config; + const reuseExistingBranch = config.reuseExistingBranch!; logger.debug( `manager.getUpdatedPackageFiles() reuseExistinbranch=${reuseExistingBranch}` ); @@ -32,21 +33,24 @@ export async function getUpdatedPackageFiles( const packageFileUpdatedDeps: Record<string, PackageDependency[]> = {}; const lockFileMaintenanceFiles = []; for (const upgrade of config.upgrades) { - const { manager, packageFile, depName, newVersion } = upgrade; - const updateLockedDependency = get(manager, 'updateLockedDependency'); + const manager = upgrade.manager!; + const packageFile = upgrade.packageFile!; + const depName = upgrade.depName!; + const newVersion = upgrade.newVersion!; + const updateLockedDependency = get(manager, 'updateLockedDependency')!; packageFileManagers[packageFile] = manager; packageFileUpdatedDeps[packageFile] = packageFileUpdatedDeps[packageFile] || []; packageFileUpdatedDeps[packageFile].push({ ...upgrade }); - let packageFileContent = updatedFileContents[packageFile]; + let packageFileContent: string | null = updatedFileContents[packageFile]; if (!packageFileContent) { packageFileContent = await getFile( packageFile, reuseExistingBranch ? config.branchName : config.baseBranch ); } - let lockFileContent: string; - const lockFile = upgrade.lockFile || upgrade.lockFiles?.[0] || ''; + let lockFileContent: string | null = null; + const lockFile = upgrade.lockFile ?? upgrade.lockFiles?.[0] ?? ''; if (lockFile) { lockFileContent = updatedFileContents[lockFile]; if (!lockFileContent) { @@ -78,9 +82,9 @@ export async function getUpdatedPackageFiles( depName, newVersion, packageFile, - packageFileContent, + packageFileContent: packageFileContent!, lockFile, - lockFileContent, + lockFileContent: lockFileContent!, allowParentUpdates: true, allowHigherOrRemoved: true, }); @@ -107,14 +111,14 @@ export async function getUpdatedPackageFiles( depName, newVersion, packageFile, - packageFileContent, + packageFileContent: packageFileContent!, lockFile, - lockFileContent, + lockFileContent: lockFileContent!, allowParentUpdates: false, }); if (status === 'unsupported') { // incompatible lock file - nonUpdatedFileContents[packageFile] = packageFileContent; + nonUpdatedFileContents[packageFile] = packageFileContent!; } else if (status === 'already-updated') { logger.debug( `Upgrade of ${depName} to ${newVersion} is already done in existing branch` @@ -140,7 +144,7 @@ export async function getUpdatedPackageFiles( { manager }, 'isLockFileUpdate without updateLockedDependency' ); - nonUpdatedFileContents[packageFile] = packageFileContent; + nonUpdatedFileContents[packageFile] = packageFileContent!; } } else { const bumpPackageVersion = get(manager, 'bumpPackageVersion'); @@ -148,14 +152,14 @@ export async function getUpdatedPackageFiles( if (!updateDependency) { let res = await doAutoReplace( upgrade, - packageFileContent, + packageFileContent!, reuseExistingBranch ); if (res) { if (bumpPackageVersion && upgrade.bumpVersion) { const { bumpedContent } = await bumpPackageVersion( res, - upgrade.packageFileVersion, + upgrade.packageFileVersion!, upgrade.bumpVersion ); res = bumpedContent; @@ -164,7 +168,7 @@ export async function getUpdatedPackageFiles( logger.debug({ packageFile, depName }, 'No content changed'); } else { logger.debug({ packageFile, depName }, 'Contents updated'); - updatedFileContents[packageFile] = res; + updatedFileContents[packageFile] = res!; } continue; } else if (reuseExistingBranch) { @@ -177,13 +181,13 @@ export async function getUpdatedPackageFiles( throw new Error(WORKER_FILE_UPDATE_FAILED); } let newContent = await updateDependency({ - fileContent: packageFileContent, + fileContent: packageFileContent!, upgrade, }); if (bumpPackageVersion && upgrade.bumpVersion) { const { bumpedContent } = await bumpPackageVersion( - newContent, - upgrade.packageFileVersion, + newContent!, + upgrade.packageFileVersion!, upgrade.bumpVersion ); newContent = bumpedContent; @@ -306,7 +310,7 @@ export async function getUpdatedPackageFiles( const results = await updateArtifacts({ packageFileName: packageFile, updatedDeps: [], - newPackageFileContent: packageFileContents, + newPackageFileContent: packageFileContents!, config, }); if (is.nonEmptyArray(results)) { diff --git a/lib/workers/repository/update/branch/handle-existing.ts b/lib/workers/repository/update/branch/handle-existing.ts index 5f93efef05c0bae4ff1044403c98269ec5be26a9..e832bc1ffdd695b443208e4cb1843a809b90acca 100644 --- a/lib/workers/repository/update/branch/handle-existing.ts +++ b/lib/workers/repository/update/branch/handle-existing.ts @@ -10,16 +10,18 @@ import type { BranchConfig } from '../../../types'; export async function handlepr(config: BranchConfig, pr: Pr): Promise<void> { if (pr.state === PrState.Closed) { let content; + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + const userStrings = config.userStrings!; if (config.updateType === 'major') { - content = template.compile(config.userStrings.ignoreMajor, config); + content = template.compile(userStrings.ignoreMajor, config); } else if (config.updateType === 'digest') { - content = template.compile(config.userStrings.ignoreDigest, config); + content = template.compile(userStrings.ignoreDigest, config); } else { - content = template.compile(config.userStrings.ignoreOther, config); + content = template.compile(userStrings.ignoreOther, config); } content += '\n\nIf this PR was closed by mistake or you changed your mind, you can simply rename this PR and you will soon get a fresh replacement PR opened.'; - if (!config.suppressNotifications.includes('prIgnoreNotification')) { + if (!config.suppressNotifications!.includes('prIgnoreNotification')) { if (GlobalConfig.get('dryRun')) { logger.info( `DRY-RUN: Would ensure closed PR comment in PR #${pr.number}` @@ -27,7 +29,7 @@ export async function handlepr(config: BranchConfig, pr: Pr): Promise<void> { } else { await ensureComment({ number: pr.number, - topic: config.userStrings.ignoreTopic, + topic: userStrings.ignoreTopic, content, }); } diff --git a/lib/workers/repository/update/branch/index.ts b/lib/workers/repository/update/branch/index.ts index ffbeac01c0fbed5c94d152ae81f18d169522335c..6df732162e5ee97803778855afc370dcb8305ffa 100644 --- a/lib/workers/repository/update/branch/index.ts +++ b/lib/workers/repository/update/branch/index.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ +import is from '@sindresorhus/is'; import { DateTime } from 'luxon'; import { GlobalConfig } from '../../../../config/global'; import type { RenovateConfig } from '../../../../config/types'; @@ -56,7 +58,7 @@ import { setConfidence, setStability } from './status-checks'; function rebaseCheck(config: RenovateConfig, branchPr: Pr): boolean { const titleRebase = branchPr.title?.startsWith('rebase!'); - const labelRebase = branchPr.labels?.includes(config.rebaseLabel); + const labelRebase = !!branchPr.labels?.includes(config.rebaseLabel!); const prRebaseChecked = !!branchPr.bodyStruct?.rebaseRequested; return titleRebase || labelRebase || prRebaseChecked; @@ -82,13 +84,13 @@ export async function processBranch( ): Promise<ProcessBranchResult> { let config: BranchConfig = { ...branchConfig }; logger.trace({ config }, 'processBranch()'); - await checkoutBranch(config.baseBranch); + await checkoutBranch(config.baseBranch!); let branchExists = gitBranchExists(config.branchName); if (!branchExists && config.branchPrefix !== config.branchPrefixOld) { const branchName = config.branchName.replace( - config.branchPrefix, - config.branchPrefixOld + config.branchPrefix!, + config.branchPrefixOld! ); branchExists = gitBranchExists(branchName); if (branchExists) { @@ -101,7 +103,7 @@ export async function processBranch( logger.debug(`branchExists=${branchExists}`); const dependencyDashboardCheck = config.dependencyDashboardChecks?.[config.branchName]; - logger.debug(`dependencyDashboardCheck=${dependencyDashboardCheck}`); + logger.debug(`dependencyDashboardCheck=${dependencyDashboardCheck!}`); if (branchPr) { config.rebaseRequested = rebaseCheck(config, branchPr); logger.debug(`PR rebase requested=${config.rebaseRequested}`); @@ -223,7 +225,6 @@ export async function processBranch( logger.debug('Branch has been edited but found no PR - skipping'); return { branchExists, - prNo: branchPr?.number, result: BranchResult.PrEdited, }; } @@ -241,7 +242,6 @@ export async function processBranch( ); return { branchExists, - prNo: branchPr?.number, result: BranchResult.PrEdited, }; } @@ -272,7 +272,6 @@ export async function processBranch( logger.debug('Skipping PR creation out of schedule'); return { branchExists, - prNo: branchPr?.number, result: BranchResult.NotScheduled, }; } @@ -285,7 +284,7 @@ export async function processBranch( config.upgrades.some( (upgrade) => (upgrade.stabilityDays && upgrade.releaseTimestamp) || - isActiveConfidenceLevel(upgrade.minimumConfidence) + isActiveConfidenceLevel(upgrade.minimumConfidence!) ) ) { // Only set a stability status check if one or more of the updates contain @@ -293,7 +292,7 @@ export async function processBranch( config.stabilityStatus = BranchStatus.green; // Default to 'success' but set 'pending' if any update is pending for (const upgrade of config.upgrades) { - if (upgrade.stabilityDays && upgrade.releaseTimestamp) { + if (is.number(upgrade.stabilityDays) && upgrade.releaseTimestamp) { const daysElapsed = getElapsedDays(upgrade.releaseTimestamp); if (daysElapsed < upgrade.stabilityDays) { logger.debug( @@ -308,14 +307,12 @@ export async function processBranch( continue; } } - const { - datasource, - depName, - minimumConfidence, - updateType, - currentVersion, - newVersion, - } = upgrade; + const datasource = upgrade.datasource!; + const depName = upgrade.depName!; + const minimumConfidence = upgrade.minimumConfidence!; + const updateType = upgrade.updateType!; + const currentVersion = upgrade.currentVersion!; + const newVersion = upgrade.newVersion!; if (isActiveConfidenceLevel(minimumConfidence)) { const confidence = await getMergeConfidenceLevel( datasource, @@ -341,7 +338,7 @@ export async function processBranch( !dependencyDashboardCheck && !branchExists && config.stabilityStatus === BranchStatus.yellow && - ['not-pending', 'status-success'].includes(config.prCreation) + ['not-pending', 'status-success'].includes(config.prCreation!) ) { logger.debug( 'Skipping branch creation due to internal status checks not met' @@ -388,12 +385,12 @@ export async function processBranch( } const additionalFiles = await getAdditionalFiles( config, - branchConfig.packageFiles + branchConfig.packageFiles! ); - config.artifactErrors = (config.artifactErrors || []).concat( + config.artifactErrors = (config.artifactErrors ?? []).concat( additionalFiles.artifactErrors ); - config.updatedArtifacts = (config.updatedArtifacts || []).concat( + config.updatedArtifacts = (config.updatedArtifacts ?? []).concat( additionalFiles.updatedArtifacts ); if (config.updatedArtifacts?.length) { @@ -459,10 +456,10 @@ export async function processBranch( config.isConflicted ??= branchExists && - (await isBranchConflicted(config.baseBranch, config.branchName)); + (await isBranchConflicted(config.baseBranch!, config.branchName)); config.forceCommit = forcedManually || config.isConflicted; - config.stopUpdating = branchPr?.labels?.includes(config.stopUpdatingLabel); + config.stopUpdating = branchPr?.labels?.includes(config.stopUpdatingLabel!); const prRebaseChecked = !!branchPr?.bodyStruct?.rebaseRequested; @@ -537,7 +534,7 @@ export async function processBranch( } if ( mergeStatus === 'stale' && - ['conflicted', 'never'].includes(config.rebaseWhen) + ['conflicted', 'never'].includes(config.rebaseWhen!) ) { logger.warn( 'Branch cannot automerge because it is stale and rebaseWhen setting disallows rebasing - raising a PR instead' @@ -635,7 +632,9 @@ export async function processBranch( try { logger.debug('Ensuring PR'); logger.debug( - `There are ${config.errors.length} errors and ${config.warnings.length} warnings` + `There are ${config.errors!.length} errors and ${ + config.warnings!.length + } warnings` ); const ensurePrResult = await ensurePr(config); if (ensurePrResult.type === 'without-pr') { @@ -704,8 +703,8 @@ export async function processBranch( content = platform.massageMarkdown(content); if ( !( - config.suppressNotifications.includes('artifactErrors') || - config.suppressNotifications.includes('lockFileErrors') + config.suppressNotifications!.includes('artifactErrors') || + config.suppressNotifications!.includes('lockFileErrors') ) ) { if (GlobalConfig.get('dryRun')) { diff --git a/lib/workers/repository/update/branch/reuse.ts b/lib/workers/repository/update/branch/reuse.ts index 8a6447b036dbf1d842d746686ab0220906972d41..11a8e149d7df8aacb69b179c833e5031676d3117 100644 --- a/lib/workers/repository/update/branch/reuse.ts +++ b/lib/workers/repository/update/branch/reuse.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { GlobalConfig } from '../../../../config/global'; import { logger } from '../../../../logger'; import { platform } from '../../../../modules/platform'; @@ -40,15 +41,17 @@ export async function shouldReuseExistingBranch( logger.debug(`Manual rebase requested via PR checkbox for #${pr.number}`); return result; } - if (pr.labels?.includes(config.rebaseLabel)) { + if (pr.labels?.includes(config.rebaseLabel!)) { logger.debug(`Manual rebase requested via PR labels for #${pr.number}`); // istanbul ignore if if (GlobalConfig.get('dryRun')) { logger.info( - `DRY-RUN: Would delete label ${config.rebaseLabel} from #${pr.number}` + `DRY-RUN: Would delete label ${config.rebaseLabel!} from #${ + pr.number + }` ); } else { - await platform.deleteLabel(pr.number, config.rebaseLabel); + await platform.deleteLabel(pr.number, config.rebaseLabel!); } return result; } @@ -74,12 +77,12 @@ export async function shouldReuseExistingBranch( logger.debug('Branch is up-to-date'); } else { logger.debug( - `Skipping stale branch check due to rebaseWhen=${config.rebaseWhen}` + `Skipping stale branch check due to rebaseWhen=${config.rebaseWhen!}` ); } // Now check if PR is unmergeable. If so then we also rebase - result.isConflicted = await isBranchConflicted(baseBranch, branchName); + result.isConflicted = await isBranchConflicted(baseBranch!, branchName); if (result.isConflicted) { logger.debug('Branch is conflicted'); @@ -106,13 +109,13 @@ export async function shouldReuseExistingBranch( // This is why we are skipping branch reuse in this case (#10050) const groupedByPackageFile: Record<string, Set<RangeStrategy>> = {}; for (const upgrade of config.upgrades) { - groupedByPackageFile[upgrade.packageFile] = - groupedByPackageFile[upgrade.packageFile] || new Set(); - groupedByPackageFile[upgrade.packageFile].add(upgrade.rangeStrategy); + const packageFile = upgrade.packageFile!; + groupedByPackageFile[packageFile] ??= new Set(); + groupedByPackageFile[packageFile].add(upgrade.rangeStrategy!); if ( - groupedByPackageFile[upgrade.packageFile].size > 1 && - groupedByPackageFile[upgrade.packageFile].has('update-lockfile') + groupedByPackageFile[packageFile].size > 1 && + groupedByPackageFile[packageFile].has('update-lockfile') ) { logger.debug( `Detected multiple rangeStrategies along with update-lockfile` diff --git a/lib/workers/repository/update/pr/automerge.ts b/lib/workers/repository/update/pr/automerge.ts index 227f7f69b23f5c535d43a73bca5d5712ca8c61eb..2ec9b9546c32566c1a812464d86955298d2d13d7 100644 --- a/lib/workers/repository/update/pr/automerge.ts +++ b/lib/workers/repository/update/pr/automerge.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { GlobalConfig } from '../../../../config/global'; import { logger } from '../../../../logger'; import { Pr, platform } from '../../../../modules/platform'; @@ -56,7 +57,7 @@ export async function checkAutoMerge( } const isConflicted = config.isConflicted ?? - (await isBranchConflicted(config.baseBranch, config.branchName)); + (await isBranchConflicted(config.baseBranch!, config.branchName)); if (isConflicted) { logger.debug('PR is conflicted'); return { @@ -110,13 +111,13 @@ export async function checkAutoMerge( await ensureCommentRemoval({ type: 'by-content', number: pr.number, - content: automergeComment, + content: automergeComment!, }); } await ensureComment({ number: pr.number, topic: null, - content: automergeComment, + content: automergeComment!, }); return { automerged: true, branchRemoved: false }; } diff --git a/lib/workers/repository/update/pr/changelog/release-notes.ts b/lib/workers/repository/update/pr/changelog/release-notes.ts index 71c0a8aed6ee8a8b01fc150085ae3cc8ffc2a610..8a94dec41c3a8928a339b5daf35f69fe45c6a99b 100644 --- a/lib/workers/repository/update/pr/changelog/release-notes.ts +++ b/lib/workers/repository/update/pr/changelog/release-notes.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import URL from 'url'; import is from '@sindresorhus/is'; import { DateTime } from 'luxon'; @@ -70,7 +71,7 @@ export function massageBody( input: string | undefined | null, baseUrl: string ): string { - let body = input || ''; + let body = input ?? ''; // Convert line returns body = body.replace(regEx(/\r\n/g), '\n'); // semantic-release cleanup @@ -109,7 +110,7 @@ export async function getReleaseNotes( logger.trace({ releases }, 'Release list from getReleaseList'); let releaseNotes: ChangeLogNotes | null = null; - let matchedRelease = getExactReleaseMatch(depName, version, releases); + let matchedRelease = getExactReleaseMatch(depName!, version, releases); if (is.undefined(matchedRelease)) { // no exact match of a release then check other cases matchedRelease = releases.find( @@ -123,7 +124,8 @@ export async function getReleaseNotes( if (is.undefined(matchedRelease) && config.extractVersion) { const extractVersionRegEx = regEx(config.extractVersion); matchedRelease = releases.find((r) => { - const extractedVersion = extractVersionRegEx.exec(r.tag)?.groups?.version; + const extractedVersion = extractVersionRegEx.exec(r.tag!)?.groups + ?.version; return version === extractedVersion; }); } @@ -140,7 +142,7 @@ function getExactReleaseMatch( const exactReleaseReg = regEx(`${depName}[@_-]v?${version}`); const candidateReleases = releases.filter((r) => r.tag?.endsWith(version)); const matchedRelease = candidateReleases.find((r) => - exactReleaseReg.test(r.tag) + exactReleaseReg.test(r.tag!) ); return matchedRelease; } @@ -189,7 +191,7 @@ function sectionize(text: string, level: number): string[] { if (token.type === 'heading_open') { const lev = +token.tag.substr(1); if (lev <= level) { - sections.push([lev, token.map[0]]); + sections.push([lev, token.map![0]]); } } }); @@ -218,8 +220,10 @@ function isUrl(url: string): boolean { export async function getReleaseNotesMdFileInner( project: ChangeLogProject -): Promise<ChangeLogFile> | null { - const { apiBaseUrl, repository, sourceDirectory, type } = project; +): Promise<ChangeLogFile | null> { + const { repository, type } = project; + const apiBaseUrl = project.apiBaseUrl!; + const sourceDirectory = project.sourceDirectory!; try { switch (type) { case 'gitlab': @@ -355,7 +359,7 @@ export async function getReleaseNotesMd( export function releaseNotesCacheMinutes(releaseDate?: string | Date): number { const dt = is.date(releaseDate) ? DateTime.fromJSDate(releaseDate) - : DateTime.fromISO(releaseDate); + : DateTime.fromISO(releaseDate!); const now = DateTime.local(); @@ -387,7 +391,7 @@ export async function addReleaseNotes( }${version}`; } for (const v of input.versions) { - let releaseNotes: ChangeLogNotes; + let releaseNotes: ChangeLogNotes | null | undefined; const cacheKey = getCacheKey(v.version); releaseNotes = await packageCache.get(cacheNamespace, cacheKey); // istanbul ignore else: no cache tests @@ -409,11 +413,11 @@ export async function addReleaseNotes( cacheMinutes ); } - output.versions.push({ + output.versions!.push({ ...v, - releaseNotes, + releaseNotes: releaseNotes!, }); - output.hasReleaseNotes = output.hasReleaseNotes || !!releaseNotes; + output.hasReleaseNotes = !!output.hasReleaseNotes || !!releaseNotes; } return output; } diff --git a/lib/workers/repository/update/pr/changelog/releases.ts b/lib/workers/repository/update/pr/changelog/releases.ts index 9163fd5448ebdd738d796fbfa1825a6d86ee273c..a0298f48f83813b366ab0dd8af4e4ba0ff6c723a 100644 --- a/lib/workers/repository/update/pr/changelog/releases.ts +++ b/lib/workers/repository/update/pr/changelog/releases.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import { logger } from '../../../../../logger'; import { Release, @@ -26,14 +27,17 @@ function matchesUnstable( export async function getInRangeReleases( config: BranchUpgradeConfig ): Promise<Release[] | null> { - const { versioning, currentVersion, newVersion, depName, datasource } = - config; + const versioning = config.versioning!; + const currentVersion = config.currentVersion!; + const newVersion = config.newVersion!; + const depName = config.depName!; + const datasource = config.datasource!; // istanbul ignore if if (!isGetPkgReleasesConfig(config)) { return null; } try { - const pkgReleases = (await getPkgReleases(config)).releases; + const pkgReleases = (await getPkgReleases(config))!.releases; const version = get(versioning); const releases = pkgReleases diff --git a/lib/workers/repository/update/pr/changelog/source-github.ts b/lib/workers/repository/update/pr/changelog/source-github.ts index 2dbd02457d722c5937a745befc0345fa0b1f3571..c111c7a28b17566ab503ff34b898e57f4e7093db 100644 --- a/lib/workers/repository/update/pr/changelog/source-github.ts +++ b/lib/workers/repository/update/pr/changelog/source-github.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import URL from 'url'; import { GlobalConfig } from '../../../../../config/global'; import { PlatformId } from '../../../../../constants'; @@ -32,15 +33,13 @@ function getCachedTags( export async function getChangeLogJSON( config: BranchUpgradeConfig ): Promise<ChangeLogResult | null> { - const { - versioning, - currentVersion, - newVersion, - sourceUrl, - sourceDirectory, - depName, - manager, - } = config; + const versioning = config.versioning!; + const currentVersion = config.currentVersion!; + const newVersion = config.newVersion!; + const sourceUrl = config.sourceUrl!; + const sourceDirectory = config.sourceDirectory!; + const depName = config.depName!; + const manager = config.manager; if (sourceUrl === 'https://github.com/DefinitelyTyped/DefinitelyTyped') { logger.trace('No release notes for @types'); return null; @@ -57,7 +56,7 @@ export async function getChangeLogJSON( }); // istanbul ignore if if (!token) { - if (host.endsWith('github.com')) { + if (host!.endsWith('.github.com') || host === 'github.com') { if (!GlobalConfig.get().githubTokenWarn) { logger.debug( { manager, depName, sourceUrl }, @@ -80,7 +79,7 @@ export async function getChangeLogJSON( const apiBaseUrl = sourceUrl.startsWith('https://github.com/') ? 'https://api.github.com/' : baseUrl + 'api/v3/'; - const repository = pathname + const repository = pathname! .slice(1) .replace(regEx(/\/$/), '') .replace(regEx(/\.git$/), ''); @@ -88,7 +87,7 @@ export async function getChangeLogJSON( logger.debug({ sourceUrl }, 'Invalid github URL found'); return null; } - const releases = config.releases || (await getInRangeReleases(config)); + const releases = config.releases ?? (await getInRangeReleases(config)); if (!releases?.length) { logger.debug('No releases'); return null; diff --git a/lib/workers/repository/update/pr/changelog/source-gitlab.ts b/lib/workers/repository/update/pr/changelog/source-gitlab.ts index 1775f8e91ac79cb6b551b2df227806f88a1ae02b..964ced4a93acec85874e2936a44ace1ba7687590 100644 --- a/lib/workers/repository/update/pr/changelog/source-gitlab.ts +++ b/lib/workers/repository/update/pr/changelog/source-gitlab.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import URL from 'url'; import { logger } from '../../../../../logger'; import type { Release } from '../../../../../modules/datasource/types'; @@ -32,18 +33,22 @@ function getCachedTags( export async function getChangeLogJSON( config: BranchUpgradeConfig ): Promise<ChangeLogResult | null> { - const { - versioning, - currentVersion, - newVersion, - sourceUrl, - depName, - manager, - sourceDirectory, - } = config; + const versioning = config.versioning!; + const currentVersion = config.currentVersion!; + const newVersion = config.newVersion!; + const sourceUrl = config.sourceUrl!; + const depName = config.depName!; + const manager = config.manager; + const sourceDirectory = config.sourceDirectory!; + logger.trace('getChangeLogJSON for gitlab'); const version = allVersioning.get(versioning); - const { protocol, host, pathname } = URL.parse(sourceUrl); + + const parsedUrl = URL.parse(sourceUrl); + const protocol = parsedUrl.protocol!; + const host = parsedUrl.host!; + const pathname = parsedUrl.pathname!; + logger.trace({ protocol, host, pathname }, 'Protocol, host, pathname'); const baseUrl = protocol.concat('//', host, '/'); const apiBaseUrl = baseUrl.concat('api/v4/'); @@ -55,7 +60,7 @@ export async function getChangeLogJSON( logger.info({ sourceUrl }, 'Invalid gitlab URL found'); return null; } - const releases = config.releases || (await getInRangeReleases(config)); + const releases = config.releases ?? (await getInRangeReleases(config)); if (!releases?.length) { logger.debug('No releases'); return null; diff --git a/lib/workers/repository/updates/branch-name.ts b/lib/workers/repository/updates/branch-name.ts index 2e4b08e4ef33ee7598ff40445e0d5e3b9bf5e604..abcd703f5cbb9d0bc3b85973f21ad2d88dccfcc3 100644 --- a/lib/workers/repository/updates/branch-name.ts +++ b/lib/workers/repository/updates/branch-name.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import cleanGitRef from 'clean-git-ref'; import hasha from 'hasha'; import slugify from 'slugify'; @@ -51,12 +52,12 @@ export function generateBranchName(update: RenovateConfig): void { if (update.updateType === 'patch' && update.separateMinorPatch) { update.groupSlug = `patch-${update.groupSlug}`; } - update.branchTopic = update.group.branchTopic || update.branchTopic; - update.branchName = update.group.branchName || update.branchName; + update.branchTopic = update.group!.branchTopic || update.branchTopic; + update.branchName = update.group!.branchName || update.branchName; } if (update.hashedBranchLength) { - let hashLength = update.hashedBranchLength - update.branchPrefix.length; + let hashLength = update.hashedBranchLength - update.branchPrefix!.length; if (hashLength < MIN_HASH_LENGTH) { logger.warn( `\`hashedBranchLength\` must allow for at least ${MIN_HASH_LENGTH} characters hashing in addition to \`branchPrefix\`. Using ${MIN_HASH_LENGTH} character hash instead.` @@ -84,7 +85,7 @@ export function generateBranchName(update: RenovateConfig): void { update.branchName = update.branchPrefix + hash.slice(0, hashLength); } else { - update.branchName = template.compile(update.branchName, update); + update.branchName = template.compile(update.branchName!, update); // Compile extra times in case of nested templates update.branchName = template.compile(update.branchName, update); diff --git a/lib/workers/repository/updates/branchify.ts b/lib/workers/repository/updates/branchify.ts index 15e8f7b0d9be61dca2bcce44041a14f0563a9dd3..739cb1a79002989a3f8ac9a6011d218abd33d492 100644 --- a/lib/workers/repository/updates/branchify.ts +++ b/lib/workers/repository/updates/branchify.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import type { Merge } from 'type-fest'; import type { RenovateConfig, ValidationMessage } from '../../../config/types'; import { addMeta, logger, removeMeta } from '../../../logger'; @@ -45,7 +46,7 @@ export async function branchifyUpgrades( addMeta({ branch: branchName, }); - const seenUpdates = {}; + const seenUpdates: Record<string, string> = {}; // Filter out duplicates branchUpgrades[branchName] = branchUpgrades[branchName] .reverse() @@ -68,7 +69,7 @@ export async function branchifyUpgrades( ); return false; } - seenUpdates[upgradeKey] = newValue; + seenUpdates[upgradeKey] = newValue!; return true; }) .reverse(); @@ -93,7 +94,7 @@ export async function branchifyUpgrades( const key = `${sourceUrl}|${newVersion}`; branchUpdates[key] = branchUpdates[key] || {}; if (!branchUpdates[key][branchName]) { - branchUpdates[key][branchName] = depName; + branchUpdates[key][branchName] = depName!; } } } @@ -110,9 +111,9 @@ export async function branchifyUpgrades( logger.debug({ err }, 'Error checking branch duplicates'); } return { - errors: config.errors.concat(errors), - warnings: config.warnings.concat(warnings), + errors: config.errors!.concat(errors), + warnings: config.warnings!.concat(warnings), branches, - branchList, + branchList: branchList!, }; } diff --git a/lib/workers/repository/updates/flatten.ts b/lib/workers/repository/updates/flatten.ts index fc3b35736f2ce89fc0f1c68cd5384bac88b7460b..4c6fba0de806c0c724fab6670e577df613b34d51 100644 --- a/lib/workers/repository/updates/flatten.ts +++ b/lib/workers/repository/updates/flatten.ts @@ -101,7 +101,7 @@ export async function flattenUpdates( updateConfig[`is${upper(updateConfig.updateType)}`] = true; } if (updateConfig.updateTypes) { - updateConfig.updateTypes.forEach((updateType) => { + updateConfig.updateTypes.forEach((updateType: string) => { updateConfig[`is${upper(updateType)}`] = true; }); } @@ -157,7 +157,11 @@ export async function flattenUpdates( } if (get(manager, 'updateLockedDependency')) { for (const lockFile of packageFileConfig.lockFiles || []) { - const remediations = config.remediations?.[lockFile]; + const lockfileRemediations = config.remediations as Record< + string, + Record<string, any>[] + >; + const remediations = lockfileRemediations?.[lockFile]; if (remediations) { for (const remediation of remediations) { let updateConfig = mergeChildConfig( diff --git a/lib/workers/repository/updates/generate.ts b/lib/workers/repository/updates/generate.ts index f3df4f73124313e503d41289d04ef7ce885deff3..04af7f203a1bee9f7264b39ba6ead3da4130fd24 100644 --- a/lib/workers/repository/updates/generate.ts +++ b/lib/workers/repository/updates/generate.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ import is from '@sindresorhus/is'; import { DateTime } from 'luxon'; import mdTable from 'markdown-table'; @@ -22,7 +23,7 @@ function isTypesGroup(branchUpgrades: BranchUpgradeConfig[]): boolean { function sortTypesGroup(upgrades: BranchUpgradeConfig[]): void { const isTypesUpgrade = ({ depName }: BranchUpgradeConfig): boolean => - depName?.startsWith('@types/'); + !!depName?.startsWith('@types/'); const regularUpgrades = upgrades.filter( (upgrade) => !isTypesUpgrade(upgrade) ); @@ -31,15 +32,13 @@ function sortTypesGroup(upgrades: BranchUpgradeConfig[]): void { upgrades.push(...regularUpgrades, ...typesUpgrades); } -function getTableValues( - upgrade: BranchUpgradeConfig -): [string, string, string, string] | null { +function getTableValues(upgrade: BranchUpgradeConfig): string[] | null { if (!upgrade.commitBodyTable) { return null; } const { datasource, packageName, depName, currentVersion, newVersion } = upgrade; - const name = packageName || depName; + const name = packageName ?? depName; if (datasource && name && currentVersion && newVersion) { return [datasource, name, currentVersion, newVersion]; } @@ -76,13 +75,13 @@ export function generateBranchConfig( const toVersions: string[] = []; const toValues = new Set<string>(); branchUpgrades.forEach((upg) => { - if (!depNames.includes(upg.depName)) { - depNames.push(upg.depName); + if (!depNames.includes(upg.depName!)) { + depNames.push(upg.depName!); } - if (!toVersions.includes(upg.newVersion)) { - toVersions.push(upg.newVersion); + if (!toVersions.includes(upg.newVersion!)) { + toVersions.push(upg.newVersion!); } - toValues.add(upg.newValue); + toValues.add(upg.newValue!); if (upg.commitMessageExtra) { const extra = template.compile(upg.commitMessageExtra, upg); if (!newValue.includes(extra)) { @@ -107,7 +106,7 @@ export function generateBranchConfig( let upgrade: BranchUpgradeConfig = { ...branchUpgrade }; if (upgrade.currentDigest) { upgrade.currentDigestShort = - upgrade.currentDigestShort || + upgrade.currentDigestShort ?? upgrade.currentDigest.replace('sha256:', '').substring(0, 7); } if (upgrade.newDigest) { @@ -129,7 +128,9 @@ export function generateBranchConfig( upgrade.displayTo ??= ''; const pendingVersionsLength = upgrade.pendingVersions?.length; if (pendingVersionsLength) { - upgrade.displayPending = `\`${upgrade.pendingVersions.slice(-1).pop()}\``; + upgrade.displayPending = `\`${upgrade + .pendingVersions!.slice(-1) + .pop()}\``; if (pendingVersionsLength > 1) { upgrade.displayPending += ` (+${pendingVersionsLength - 1})`; } @@ -137,7 +138,7 @@ export function generateBranchConfig( upgrade.displayPending = ''; } upgrade.prettyDepType = - upgrade.prettyDepType || upgrade.depType || 'dependency'; + upgrade.prettyDepType ?? upgrade.depType ?? 'dependency'; if (useGroupSettings) { // Now overwrite original config with group config upgrade = mergeChildConfig(upgrade, upgrade.group); @@ -176,14 +177,14 @@ export function generateBranchConfig( upgrade )})`; } - upgrade.commitMessagePrefix = CommitMessage.formatPrefix(semanticPrefix); + upgrade.commitMessagePrefix = CommitMessage.formatPrefix(semanticPrefix!); upgrade.toLowerCase = - regEx(/[A-Z]/).exec(upgrade.semanticCommitType) === null && - !upgrade.semanticCommitType.startsWith(':'); + regEx(/[A-Z]/).exec(upgrade.semanticCommitType!) === null && + !upgrade.semanticCommitType!.startsWith(':'); } // Compile a few times in case there are nested templates upgrade.commitMessage = template.compile( - upgrade.commitMessage || '', + upgrade.commitMessage ?? '', upgrade ); upgrade.commitMessage = template.compile(upgrade.commitMessage, upgrade); @@ -256,7 +257,7 @@ export function generateBranchConfig( logger.trace(`prTitle: ` + JSON.stringify(upgrade.prTitle)); config.upgrades.push(upgrade); if (upgrade.releaseTimestamp) { - if (releaseTimestamp) { + if (releaseTimestamp!) { const existingStamp = DateTime.fromISO(releaseTimestamp); const upgradeStamp = DateTime.fromISO(upgrade.releaseTimestamp); if (upgradeStamp > existingStamp) { @@ -291,17 +292,21 @@ export function generateBranchConfig( return -1; } - if (a.depName < b.depName) { + if (a.depName! < b.depName!) { return -1; } - if (a.depName > b.depName) { + if (a.depName! > b.depName!) { return 1; } return 0; }); } // Now assign first upgrade's config as branch config - config = { ...config, ...config.upgrades[0], releaseTimestamp }; // TODO: fixme (#9666) + config = { + ...config, + ...config.upgrades[0], + releaseTimestamp: releaseTimestamp!, + }; // TODO: fixme (#9666) config.reuseLockFiles = config.upgrades.every( (upgrade) => upgrade.updateType !== 'lockFileMaintenance' ); @@ -314,7 +319,8 @@ export function generateBranchConfig( config.prBodyColumns = [ ...new Set( config.upgrades.reduce( - (existing, upgrade) => existing.concat(upgrade.prBodyColumns), + (existing: string[], upgrade) => + existing.concat(upgrade.prBodyColumns!), [] ) ), @@ -324,14 +330,14 @@ export function generateBranchConfig( config.labels = [ ...new Set( config.upgrades - .map((upgrade) => upgrade.labels || []) + .map((upgrade) => upgrade.labels ?? []) .reduce((a, b) => a.concat(b), []) ), ]; config.addLabels = [ ...new Set( config.upgrades - .map((upgrade) => upgrade.addLabels || []) + .map((upgrade) => upgrade.addLabels ?? []) .reduce((a, b) => a.concat(b), []) ), ]; @@ -344,13 +350,14 @@ export function generateBranchConfig( config.constraints = { ...config.constraints, ...upgrade.constraints }; } } + const tableRows = config.upgrades - .map((upgrade) => getTableValues(upgrade)) - .filter(Boolean); + .map(getTableValues) + .filter((x): x is string[] => is.array(x, is.string)); if (tableRows.length) { - let table = []; + let table: string[][] = []; table.push(['datasource', 'package', 'from', 'to']); - table = table.concat(tableRows); + table = table.concat(tableRows!); config.commitMessage += '\n\n' + mdTable(table) + '\n'; } return config; diff --git a/lib/workers/types.ts b/lib/workers/types.ts index 8e94d85a80d7ec7b1a53062ee5e27e6fa57d7bba..1ad103efc033791a1b989ead242823c1cf546b14 100644 --- a/lib/workers/types.ts +++ b/lib/workers/types.ts @@ -66,7 +66,7 @@ export interface BranchUpgradeConfig updatedPackageFiles?: FileChange[]; updatedArtifacts?: FileChange[]; - logJSON?: ChangeLogResult; + logJSON?: ChangeLogResult | null; hasReleaseNotes?: boolean; homepage?: string; diff --git a/tsconfig.strict.json b/tsconfig.strict.json index 6d4dc16e5ed380b2f3d3be5888e2bde4b2659ec2..f3e83a6a7d6a1455797a3b19c1d2d5db77cedc50 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -17,70 +17,6 @@ "lib/workers/**/*.spec.ts", "lib/modules/datasource/**/*.spec.ts", "lib/modules/manager/**/*.spec.ts", - "lib/renovate.ts", - "lib/renovate.spec.ts", - "lib/workers/global/autodiscover.ts", - "lib/workers/global/config/parse/cli.ts", - "lib/workers/global/config/parse/env.ts", - "lib/workers/global/config/parse/file.ts", - "lib/workers/global/config/parse/host-rules-from-env.ts", - "lib/workers/global/config/parse/index.ts", - "lib/workers/global/index.ts", - "lib/workers/global/initialize.ts", - "lib/workers/repository/changelog/index.ts", - "lib/workers/repository/error-config.ts", - "lib/workers/repository/error.ts", - "lib/workers/repository/finalise/index.ts", - "lib/workers/repository/finalise/prune.ts", - "lib/workers/repository/index.ts", - "lib/workers/repository/init/apis.ts", - "lib/workers/repository/init/config.ts", - "lib/workers/repository/init/index.ts", - "lib/workers/repository/init/semantic.ts", - "lib/workers/repository/init/vulnerability.ts", - "lib/workers/repository/onboarding/branch/check.ts", - "lib/workers/repository/onboarding/branch/config.ts", - "lib/workers/repository/onboarding/branch/create.ts", - "lib/workers/repository/onboarding/branch/index.ts", - "lib/workers/repository/onboarding/branch/rebase.ts", - "lib/workers/repository/onboarding/pr/base-branch.ts", - "lib/workers/repository/onboarding/pr/config-description.ts", - "lib/workers/repository/errors-warnings.ts", - "lib/workers/repository/onboarding/pr/index.ts", - "lib/workers/repository/onboarding/pr/pr-list.ts", - "lib/workers/repository/config-migration/pr/index.ts", - "lib/workers/repository/process/deprecated.ts", - "lib/workers/repository/process/extract-update.ts", - "lib/workers/repository/process/fetch.ts", - "lib/workers/repository/process/index.ts", - "lib/workers/repository/process/limits.ts", - "lib/workers/repository/process/sort.ts", - "lib/workers/repository/process/write.ts", - "lib/workers/repository/process/vulnerabilities.ts", - "lib/workers/repository/updates/branch-name.ts", - "lib/workers/repository/updates/branchify.ts", - "lib/workers/repository/updates/flatten.ts", - "lib/workers/repository/updates/generate.ts", - "lib/workers/repository/update/branch/artifacts.ts", - "lib/workers/repository/update/branch/auto-replace.ts", - "lib/workers/repository/update/branch/automerge.ts", - "lib/workers/repository/update/branch/check-existing.ts", - "lib/workers/repository/update/branch/commit.ts", - "lib/workers/repository/update/branch/execute-post-upgrade-commands.ts", - "lib/workers/repository/update/branch/get-updated.ts", - "lib/workers/repository/update/branch/handle-existing.ts", - "lib/workers/repository/update/branch/index.ts", - "lib/workers/repository/update/branch/reuse.ts", - "lib/workers/repository/update/branch/schedule.ts", - "lib/workers/repository/update/pr/automerge.ts", - "lib/workers/repository/update/pr/body/controls.ts", - "lib/workers/repository/update/pr/changelog/github/index.ts", - "lib/workers/repository/update/pr/changelog/gitlab/index.ts", - "lib/workers/repository/update/pr/changelog/index.ts", - "lib/workers/repository/update/pr/changelog/release-notes.ts", - "lib/workers/repository/update/pr/changelog/releases.ts", - "lib/workers/repository/update/pr/changelog/source-github.ts", - "lib/workers/repository/update/pr/changelog/source-gitlab.ts", - "lib/workers/repository/update/pr/code-owners.ts" + "lib/renovate.spec.ts" ] }