diff --git a/.eslintrc.js b/.eslintrc.js index 8fb34b3e6e17e2087f2f63fc25f406b7d86863a3..20d43c8b5fac46a54e15cfb0aa11d32140f502e2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -81,7 +81,7 @@ module.exports = { ignoreRestSiblings: false, }, ], - '@typescript-eslint/prefer-optional-chain': 1, + '@typescript-eslint/prefer-optional-chain': 2, '@typescript-eslint/prefer-nullish-coalescing': 2, curly: [2, 'all'], 'require-await': 2, @@ -97,12 +97,12 @@ module.exports = { 1, { allowNumber: true, allowBoolean: true }, ], - '@typescript-eslint/restrict-plus-operands': 1, + '@typescript-eslint/restrict-plus-operands': 2, - '@typescript-eslint/naming-convention': 1, + '@typescript-eslint/naming-convention': 2, - '@typescript-eslint/unbound-method': 1, - '@typescript-eslint/ban-types': 1, + '@typescript-eslint/unbound-method': 2, + '@typescript-eslint/ban-types': 2, }, settings: { 'import/parsers': { diff --git a/lib/versioning/hex/index.ts b/lib/versioning/hex/index.ts index 47ab7afa0b180b7babda2f12ce1434a858bfdfb6..c7f6f1432843fb2580e105026dd020486d0c1b58 100644 --- a/lib/versioning/hex/index.ts +++ b/lib/versioning/hex/index.ts @@ -72,7 +72,7 @@ const getNewValue = ({ if (/~>\s*(\d+\.\d+)$/.test(currentValue)) { newSemver = newSemver.replace( /\^\s*(\d+\.\d+(\.\d)?)/, - (_str, p1) => '~> ' + p1.slice(0, -2) + (_str, p1: string) => `~> ${p1.slice(0, -2)}` ); } else { newSemver = newSemver.replace(/~\s*(\d+\.\d+\.\d)/, '~> $1'); diff --git a/lib/versioning/npm/range.ts b/lib/versioning/npm/range.ts index 871cfe9a63137e391a31f07f56947c3eb03c6c1f..f454495ae6be8d4b13fb84c821c024254eefe9d4 100644 --- a/lib/versioning/npm/range.ts +++ b/lib/versioning/npm/range.ts @@ -40,7 +40,7 @@ export function getNewValue({ fromVersion, toVersion, }); - if (element.operator && element.operator.startsWith('<')) { + if (element.operator?.startsWith('<')) { // TODO fix this const splitCurrent = currentValue.split(element.operator); splitCurrent.pop(); @@ -53,7 +53,7 @@ export function getNewValue({ splitCurrent.pop(); return splitCurrent.join('-') + '- ' + newValue; } - if (element.operator && element.operator.startsWith('>')) { + if (element.operator?.startsWith('>')) { logger.warn(`Complex ranges ending in greater than are not supported`); return null; } @@ -82,11 +82,11 @@ export function getNewValue({ } if (split.length === 1) { // ^4 - return '^' + toVersionMajor; + return `^${toVersionMajor}`; } if (split.length === 2) { // ^4.1 - return '^' + toVersionMajor + '.' + toVersionMinor; + return `^${toVersionMajor}.${toVersionMinor}`; } return `^${toVersion}`; } @@ -97,11 +97,11 @@ export function getNewValue({ } if (split.length === 1) { // ~4 - return '~' + toVersionMajor; + return `~${toVersionMajor}`; } if (split.length === 2) { // ~4.1 - return '~' + toVersionMajor + '.' + toVersionMinor; + return `~${toVersionMajor}.${toVersionMinor}`; } return `~${toVersion}`; } diff --git a/lib/versioning/poetry/index.ts b/lib/versioning/poetry/index.ts index 19adea10d45a120d98283038558c033e74f9b22d..b433d8fb807dd3e3bbdb03f34e2c869817dbba3f 100644 --- a/lib/versioning/poetry/index.ts +++ b/lib/versioning/poetry/index.ts @@ -74,11 +74,11 @@ function handleShort( const split = currentValue.split('.'); if (split.length === 1) { // [^,~]4 - return operator + toVersionMajor; + return `${operator}${toVersionMajor}`; } if (split.length === 2) { // [^,~]4.1 - return operator + toVersionMajor + '.' + toVersionMinor; + return `${operator}${toVersionMajor}.${toVersionMinor}`; } return null; } diff --git a/lib/workers/branch/check-existing.ts b/lib/workers/branch/check-existing.ts index 731455b362285518da04d63d963380e4fb1aefaa..0a4519920770fd6e5c37742ee3982caac8f53a54 100644 --- a/lib/workers/branch/check-existing.ts +++ b/lib/workers/branch/check-existing.ts @@ -1,13 +1,12 @@ import { REPOSITORY_CHANGED } from '../../constants/error-messages'; import { logger } from '../../logger'; -import { platform } from '../../platform'; +import { Pr, platform } from '../../platform'; import { PrState } from '../../types'; import { BranchConfig } from '../common'; -/** TODO: Proper return type */ export async function prAlreadyExisted( config: BranchConfig -): Promise<any | null> { +): Promise<Pr | null> { logger.trace({ config }, 'prAlreadyExisted'); if (config.recreateClosed) { logger.debug('recreateClosed is true'); diff --git a/lib/workers/branch/index.spec.ts b/lib/workers/branch/index.spec.ts index 82888168005e210594d0da1ac16553a354a4c8bd..240d174eb8a20cd12ec2a7c15d947b8ea48ebde0 100644 --- a/lib/workers/branch/index.spec.ts +++ b/lib/workers/branch/index.spec.ts @@ -133,7 +133,7 @@ describe('workers/branch', () => { checkExisting.prAlreadyExisted.mockResolvedValueOnce({ number: 13, state: PrState.Closed, - }); + } as never); await branchWorker.processBranch(config); expect(reuse.shouldReuseExistingBranch).toHaveBeenCalledTimes(0); }); @@ -143,7 +143,7 @@ describe('workers/branch', () => { checkExisting.prAlreadyExisted.mockResolvedValueOnce({ number: 13, state: PrState.Closed, - }); + } as never); await branchWorker.processBranch(config); expect(reuse.shouldReuseExistingBranch).toHaveBeenCalledTimes(0); }); @@ -153,7 +153,7 @@ describe('workers/branch', () => { checkExisting.prAlreadyExisted.mockResolvedValueOnce({ number: 13, state: PrState.Merged, - }); + } as never); await branchWorker.processBranch(config); expect(reuse.shouldReuseExistingBranch).toHaveBeenCalledTimes(0); }); @@ -530,7 +530,7 @@ describe('workers/branch', () => { git.branchExists.mockReturnValueOnce(true); checkExisting.prAlreadyExisted.mockResolvedValueOnce({ state: PrState.Closed, - }); + } as never); expect( await branchWorker.processBranch({ ...config, dryRun: true }) ).toEqual('already-existed'); diff --git a/lib/workers/branch/index.ts b/lib/workers/branch/index.ts index cf95ac21bbd18193b418b674d591b6d051c8d2c7..d98a815af302d2604438b946ba4826fbc3e1b465 100644 --- a/lib/workers/branch/index.ts +++ b/lib/workers/branch/index.ts @@ -14,7 +14,7 @@ import { } from '../../constants/error-messages'; import { logger } from '../../logger'; import { getAdditionalFiles } from '../../manager/npm/post-update'; -import { platform } from '../../platform'; +import { Pr, platform } from '../../platform'; import { BranchStatus, PrState } from '../../types'; import { ExternalHostError } from '../../types/errors/external-host-error'; import { emojify } from '../../util/emoji'; @@ -38,13 +38,12 @@ import { shouldReuseExistingBranch } from './reuse'; import { isScheduledNow } from './schedule'; import { setStability, setUnpublishable } from './status-checks'; -// TODO: proper typings -function rebaseCheck(config: RenovateConfig, branchPr: any): boolean { - const titleRebase = branchPr.title && branchPr.title.startsWith('rebase!'); - const labelRebase = - branchPr.labels && branchPr.labels.includes(config.rebaseLabel); - const prRebaseChecked = - branchPr.body && branchPr.body.includes(`- [x] <!-- rebase-check -->`); +function rebaseCheck(config: RenovateConfig, branchPr: Pr): boolean { + const titleRebase = branchPr.title?.startsWith('rebase!'); + const labelRebase = branchPr.labels?.includes(config.rebaseLabel); + const prRebaseChecked = branchPr.body?.includes( + `- [x] <!-- rebase-check -->` + ); return titleRebase || labelRebase || prRebaseChecked; } @@ -109,8 +108,7 @@ export async function processBranch( if (!config.suppressNotifications.includes('prIgnoreNotification')) { if (config.dryRun) { logger.info( - 'DRY-RUN: Would ensure closed PR comment in PR #' + - existingPr.number + `DRY-RUN: Would ensure closed PR comment in PR #${existingPr.number}` ); } else { await platform.ensureComment({ @@ -318,7 +316,7 @@ export async function processBranch( logger.debug( { updatedArtifacts: config.updatedArtifacts.map((f) => - f.name === '|delete|' ? `${f.contents} (delete)` : f.name + f.name === '|delete|' ? `${String(f.contents)} (delete)` : f.name ), }, `Updated ${config.updatedArtifacts.length} lock files` @@ -501,16 +499,12 @@ export async function processBranch( logger.debug('Passing repository-changed error up'); throw err; } - if ( - err.message && - err.message.startsWith('remote: Invalid username or password') - ) { + if (err.message?.startsWith('remote: Invalid username or password')) { logger.debug('Throwing bad credentials'); throw new Error(PLATFORM_BAD_CREDENTIALS); } if ( - err.message && - err.message.startsWith( + err.message?.startsWith( 'ssh_exchange_identification: Connection closed by remote host' ) ) { @@ -529,7 +523,7 @@ export async function processBranch( logger.debug('Passing lockfile-error up'); throw err; } - if (err.message && err.message.includes('space left on device')) { + if (err.message?.includes('space left on device')) { throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE); } if (err.message === SYSTEM_INSUFFICIENT_DISK_SPACE) { @@ -551,7 +545,7 @@ export async function processBranch( ) { throw new Error(PLATFORM_AUTHENTICATION_ERROR); } else if (!(err instanceof ExternalHostError)) { - logger.error({ err }, `Error updating branch: ${err.message}`); + logger.error({ err }, `Error updating branch: ${String(err.message)}`); } // Don't throw here - we don't want to stop the other renovations return 'error'; @@ -611,8 +605,7 @@ export async function processBranch( ) { if (config.dryRun) { logger.info( - 'DRY-RUN: Would ensure lock file error comment in PR #' + - pr.number + `DRY-RUN: Would ensure lock file error comment in PR #${pr.number}` ); } else { await platform.ensureComment({ @@ -650,7 +643,7 @@ export async function processBranch( // istanbul ignore if if (config.dryRun) { logger.info( - 'DRY-RUN: Would ensure comment removal in PR #' + pr.number + `DRY-RUN: Would ensure comment removal in PR #${pr.number}` ); } else { // Remove artifacts error comment only if this run has successfully updated artifacts @@ -672,7 +665,7 @@ export async function processBranch( throw err; } // Otherwise don't throw here - we don't want to stop the other renovations - logger.error({ err }, `Error ensuring PR: ${err.message}`); + logger.error({ err }, `Error ensuring PR: ${String(err.message)}`); } if (!branchExists) { return 'pr-created'; diff --git a/lib/workers/branch/reuse.ts b/lib/workers/branch/reuse.ts index 0d2c0e4e70421476bf9c7d01ac048c666c711cdb..ffcb27c440fc72e4ebfe6f326cfbb873330cca09 100644 --- a/lib/workers/branch/reuse.ts +++ b/lib/workers/branch/reuse.ts @@ -23,16 +23,16 @@ export async function shouldReuseExistingBranch( const pr = await platform.getBranchPr(branchName); if (pr) { - if (pr.title && pr.title.startsWith('rebase!')) { - logger.debug('Manual rebase requested via PR title for #' + pr.number); + if (pr.title?.startsWith('rebase!')) { + logger.debug(`Manual rebase requested via PR title for #${pr.number}`); return { reuseExistingBranch: false }; } - if (pr.body && pr.body.includes(`- [x] <!-- rebase-check -->`)) { - logger.debug('Manual rebase requested via PR checkbox for #' + pr.number); + if (pr.body?.includes(`- [x] <!-- rebase-check -->`)) { + logger.debug(`Manual rebase requested via PR checkbox for #${pr.number}`); return { reuseExistingBranch: false }; } - if (pr.labels && pr.labels.includes(config.rebaseLabel)) { - logger.debug('Manual rebase requested via PR labels for #' + pr.number); + if (pr.labels?.includes(config.rebaseLabel)) { + logger.debug(`Manual rebase requested via PR labels for #${pr.number}`); // istanbul ignore if if (config.dryRun) { logger.info( diff --git a/lib/workers/branch/schedule.ts b/lib/workers/branch/schedule.ts index 56f4a5f4e5e6c5ade0ad6f5d05a4d5a5be818c92..52c694f2c93ec6a33056d87352019addfc252f40 100644 --- a/lib/workers/branch/schedule.ts +++ b/lib/workers/branch/schedule.ts @@ -68,7 +68,9 @@ export function hasValidSchedule( export function isScheduledNow(config: RenovateConfig): boolean { let configSchedule = config.schedule; - logger.debug(`Checking schedule(${configSchedule}, ${config.timezone})`); + logger.debug( + `Checking schedule(${String(configSchedule)}, ${config.timezone})` + ); if ( !configSchedule || configSchedule.length === 0 || @@ -125,7 +127,9 @@ export function isScheduledNow(config: RenovateConfig): boolean { const currentMonth = parseInt(now.format('M'), 10); if (!schedule.M.includes(currentMonth)) { logger.debug( - `Does not match schedule because ${currentMonth} is not in ${schedule.M}` + `Does not match schedule because ${currentMonth} is not in ${String( + schedule.M + )}` ); return false; } @@ -149,7 +153,9 @@ export function isScheduledNow(config: RenovateConfig): boolean { logger.trace({ scheduledDays }, `scheduledDays`); if (!scheduledDays.includes(currentDay)) { logger.debug( - `Does not match schedule because ${currentDay} is not in ${scheduledDays}` + `Does not match schedule because ${currentDay} is not in ${String( + scheduledDays + )}` ); return false; } diff --git a/lib/workers/common.ts b/lib/workers/common.ts index 5b65c79364c04dd990b43eddebb036926d8834a6..7fa6e61937f63b2b5f213254aa8150d636e1acbe 100644 --- a/lib/workers/common.ts +++ b/lib/workers/common.ts @@ -60,6 +60,10 @@ export interface BranchUpgradeConfig updatedArtifacts?: File[]; logJSON?: ChangeLogResult; + + homepage?: string; + changelogUrl?: string; + sourceUrl?: string; } export enum PrResult { diff --git a/lib/workers/global/index.ts b/lib/workers/global/index.ts index 81c618625ba4320f43056e875958a63189f2d4b4..2629360c9025e53933ce1c41cc77d1f700afc15e 100644 --- a/lib/workers/global/index.ts +++ b/lib/workers/global/index.ts @@ -70,7 +70,7 @@ export async function start(): Promise<0 | 1> { if (err.message.startsWith('Init: ')) { logger.fatal(err.message.substring(6)); } else { - logger.fatal({ err }, `Fatal error: ${err.message}`); + logger.fatal({ err }, `Fatal error: ${String(err.message)}`); } } finally { globalFinalize(config); diff --git a/lib/workers/pr/body/config-description.ts b/lib/workers/pr/body/config-description.ts index 37d7bf4a7d3974747553d9a047064252aa1e4fcc..be50574b32e609223241f9383df5bbfdc4579c30 100644 --- a/lib/workers/pr/body/config-description.ts +++ b/lib/workers/pr/body/config-description.ts @@ -13,7 +13,7 @@ export async function getPrConfigDescription( (config.schedule as never) !== 'at any time' && config.schedule[0] !== 'at any time' ) { - prBody += `"${config.schedule}"`; + prBody += `"${String(config.schedule)}"`; if (config.timezone) { prBody += ` in timezone ${config.timezone}.`; } else { diff --git a/lib/workers/pr/changelog/github/index.ts b/lib/workers/pr/changelog/github/index.ts index 6df23eb85f6ef8b7cbe7d4e9a8906244af1fb462..a59bb69e7e7517ce5c81df51dc33fa9a8d0f885f 100644 --- a/lib/workers/pr/changelog/github/index.ts +++ b/lib/workers/pr/changelog/github/index.ts @@ -32,7 +32,7 @@ export async function getTags( logger.debug({ sourceRepo: repository }, 'Failed to fetch Github tags'); logger.debug({ err }); // istanbul ignore if - if (err.message && err.message.includes('Bad credentials')) { + if (err.message?.includes('Bad credentials')) { logger.warn('Bad credentials triggering tag fail lookup in changelog'); throw err; } @@ -46,13 +46,13 @@ export async function getReleaseNotesMd( ): Promise<ChangeLogFile> | null { logger.trace('github.getReleaseNotesMd()'); const apiPrefix = `${ensureTrailingSlash(apiBaseUrl)}repos/${repository}`; - const { default_branch = 'master' } = ( + const { default_branch: defaultBranch = 'master' } = ( await http.getJson<{ default_branch: string }>(apiPrefix) ).body; // https://docs.github.com/en/rest/reference/git#get-a-tree const res = await http.getJson<GithubGitTree>( - `${apiPrefix}/git/trees/${default_branch}` + `${apiPrefix}/git/trees/${defaultBranch}` ); // istanbul ignore if diff --git a/lib/workers/pr/changelog/gitlab/index.ts b/lib/workers/pr/changelog/gitlab/index.ts index dd343e81d5994c200a5dc972ab5c083b5a3e5071..ff858d289c0f9b90a4fd9edfb7a2620d274efc31 100644 --- a/lib/workers/pr/changelog/gitlab/index.ts +++ b/lib/workers/pr/changelog/gitlab/index.ts @@ -34,7 +34,7 @@ export async function getTags( } catch (err) { logger.info({ sourceRepo: repository }, 'Failed to fetch Gitlab tags'); // istanbul ignore if - if (err.message && err.message.includes('Bad credentials')) { + if (err.message?.includes('Bad credentials')) { logger.warn('Bad credentials triggering tag fail lookup in changelog'); throw err; } diff --git a/lib/workers/pr/index.ts b/lib/workers/pr/index.ts index fe7771f971a45dfff5aa6d793c479d311de5c137..e6b59cfb5671ba5eae5547b1b885778f94a63dc8 100644 --- a/lib/workers/pr/index.ts +++ b/lib/workers/pr/index.ts @@ -50,7 +50,7 @@ export async function addAssigneesReviewers( } // istanbul ignore if if (config.dryRun) { - logger.info('DRY-RUN: Would add assignees to PR #' + pr.number); + logger.info(`DRY-RUN: Would add assignees to PR #${pr.number}`); } else { await platform.addAssignees(pr.number, assignees); logger.debug({ assignees }, 'Added assignees'); @@ -80,7 +80,7 @@ export async function addAssigneesReviewers( } // istanbul ignore if if (config.dryRun) { - logger.info('DRY-RUN: Would add reviewers to PR #' + pr.number); + logger.info(`DRY-RUN: Would add reviewers to PR #${pr.number}`); } else { await platform.addReviewers(pr.number, reviewers); logger.debug({ reviewers }, 'Added reviewers'); @@ -203,8 +203,9 @@ export async function ensurePr( ); return { prResult: PrResult.AwaitingNotPending }; } + const prNotPendingHours = String(config.prNotPendingHours); logger.debug( - `prNotPendingHours=${config.prNotPendingHours} threshold hit - creating PR` + `prNotPendingHours=${prNotPendingHours} threshold hit - creating PR` ); } logger.debug('Branch status success'); @@ -334,7 +335,7 @@ export async function ensurePr( } // istanbul ignore if if (config.dryRun) { - logger.info('DRY-RUN: Would update PR #' + existingPr.number); + logger.info(`DRY-RUN: Would update PR #${existingPr.number}`); } else { await platform.updatePr({ number: existingPr.number, prTitle, prBody }); logger.info({ pr: existingPr.number, prTitle }, `PR updated`); @@ -412,7 +413,7 @@ export async function ensurePr( logger.debug('Adding branch automerge failure message to PR'); // istanbul ignore if if (config.dryRun) { - logger.info('DRY-RUN: Would add comment to PR #' + pr.number); + logger.info(`DRY-RUN: Would add comment to PR #${pr.number}`); } else { await platform.ensureComment({ number: pr.number, @@ -503,7 +504,7 @@ export async function checkAutoMerge( // istanbul ignore if if (config.dryRun) { logger.info( - 'DRY-RUN: Would add PR automerge comment to PR #' + pr.number + `DRY-RUN: Would add PR automerge comment to PR #${pr.number}` ); return false; } @@ -523,7 +524,7 @@ export async function checkAutoMerge( logger.debug(`Automerging #${pr.number}`); // istanbul ignore if if (config.dryRun) { - logger.info('DRY-RUN: Would merge PR #' + pr.number); + logger.info(`DRY-RUN: Would merge PR #${pr.number}`); return false; } const res = await platform.mergePr(pr.number, branchName); diff --git a/lib/workers/repository/dependency-dashboard.ts b/lib/workers/repository/dependency-dashboard.ts index 68783b26a4cf9b53b8eefeda60c506694254debf..e31e5f8b4420b95e1e923cce8c6f58da7864cbfb 100644 --- a/lib/workers/repository/dependency-dashboard.ts +++ b/lib/workers/repository/dependency-dashboard.ts @@ -96,9 +96,7 @@ export async function ensureMasterIssue( } issueBody += '\n'; } - const errorList = branches.filter( - (branch) => branch.res && branch.res.endsWith('error') - ); + const errorList = branches.filter((branch) => branch.res?.endsWith('error')); if (errorList.length) { issueBody += '## Errored\n\n'; issueBody += @@ -171,8 +169,8 @@ export async function ensureMasterIssue( } issueBody += '\n'; } - const alreadyExisted = branches.filter( - (branch) => branch.res && branch.res.endsWith('already-existed') + const alreadyExisted = branches.filter((branch) => + branch.res?.endsWith('already-existed') ); if (alreadyExisted.length) { issueBody += '## Closed/Ignored\n\n'; diff --git a/lib/workers/repository/finalise/prune.ts b/lib/workers/repository/finalise/prune.ts index 207b99000a8d980dacf2c4ebae2d21b9198ea5f6..1434f1e8951a9f2c43141fa798649f371c186004 100644 --- a/lib/workers/repository/finalise/prune.ts +++ b/lib/workers/repository/finalise/prune.ts @@ -104,7 +104,7 @@ export async function pruneStaleBranches( const remainingBranches = renovateBranches.filter( (branch) => !branchList.includes(branch) ); - logger.debug(`remainingBranches=${remainingBranches}`); + logger.debug(`remainingBranches=${String(remainingBranches)}`); if (remainingBranches.length === 0) { logger.debug('No branches to clean up'); return; diff --git a/lib/workers/repository/init/config.ts b/lib/workers/repository/init/config.ts index 39b5448f4666eaa872a1fdf370f90039f45709b8..acfe65538602eea9b6c43836c5907479d2b697ab 100644 --- a/lib/workers/repository/init/config.ts +++ b/lib/workers/repository/init/config.ts @@ -66,7 +66,7 @@ export async function detectRepoFileConfig(): Promise<RepoConfig> { 'Error parsing renovate config renovate.json5' ); const validationError = 'Invalid JSON5 (parsing failed)'; - const validationMessage = `JSON5.parse error: ${err.message}`; + const validationMessage = `JSON5.parse error: ${String(err.message)}`; return { fileName, error: { validationError, validationMessage } }; } } else { @@ -98,7 +98,7 @@ export async function detectRepoFileConfig(): Promise<RepoConfig> { 'Error parsing renovate config' ); const validationError = 'Invalid JSON (parsing failed)'; - const validationMessage = `JSON.parse error: ${err.message}`; + const validationMessage = `JSON.parse error: ${String(err.message)}`; return { fileName, error: { validationError, validationMessage } }; } } diff --git a/lib/workers/repository/init/vulnerability.ts b/lib/workers/repository/init/vulnerability.ts index 4702587a236f071c9af3b4d7887a69360b6eb08e..8558b807a6d625cd0059ab30ade1cfa58779925c 100644 --- a/lib/workers/repository/init/vulnerability.ts +++ b/lib/workers/repository/init/vulnerability.ts @@ -132,7 +132,7 @@ export async function detectVulnerabilityAlerts( prBodyNotes = ['### GitHub Vulnerability Alerts'].concat( val.advisories.map((advisory) => { let content = '#### '; - let heading; + let heading: string; if (advisory.identifiers.some((id) => id.type === 'CVE')) { heading = advisory.identifiers .filter((id) => id.type === 'CVE') diff --git a/lib/workers/repository/onboarding/pr/config-description.ts b/lib/workers/repository/onboarding/pr/config-description.ts index 33de8d0bad3232218597a22e237bba457a61fcde..6812a9ec976b71de3e460c87fc52452db5732c81 100644 --- a/lib/workers/repository/onboarding/pr/config-description.ts +++ b/lib/workers/repository/onboarding/pr/config-description.ts @@ -18,7 +18,7 @@ export function getScheduleDesc(config: RenovateConfig): string[] { logger.debug('No schedule'); return []; } - const desc = `Run Renovate on following schedule: ${config.schedule}`; + const desc = `Run Renovate on following schedule: ${String(config.schedule)}`; return [desc]; } diff --git a/lib/workers/repository/onboarding/pr/index.ts b/lib/workers/repository/onboarding/pr/index.ts index f67c2df87dcaf6eac12b9ddb92f2b40610fe82b0..c5827181420ea21ab5b149eadf71cde2bae187f6 100644 --- a/lib/workers/repository/onboarding/pr/index.ts +++ b/lib/workers/repository/onboarding/pr/index.ts @@ -89,11 +89,13 @@ If you need any further assistance then you can also [request help here](${confi prBody = prBody.replace('{{PRLIST}}\n', getPrList(config, branches)); // istanbul ignore if if (config.prHeader) { - prBody = (config.prHeader || '') + '\n\n' + prBody; + const prHeader = String(config.prHeader || ''); + prBody = `${prHeader}\n\n${prBody}`; } // istanbul ignore if if (config.prFooter) { - prBody = prBody + '\n---\n\n' + config.prFooter + '\n'; + const prFooter = String(config.prFooter); + prBody = `${prBody}\n---\n\n${prFooter}\n`; } logger.trace('prBody:\n' + prBody); diff --git a/lib/workers/repository/process/deprecated.ts b/lib/workers/repository/process/deprecated.ts index 64e09338496f776cfb553b120704e102e379b07b..53e3a9d6f8e6509638d6910d9c4762ec01adfe6e 100644 --- a/lib/workers/repository/process/deprecated.ts +++ b/lib/workers/repository/process/deprecated.ts @@ -10,10 +10,7 @@ export async function raiseDeprecationWarnings( if (!config.repoIsOnboarded) { return; } - if ( - config.suppressNotifications && - config.suppressNotifications.includes('deprecationWarningIssues') - ) { + if (config.suppressNotifications?.includes('deprecationWarningIssues')) { return; } for (const [manager, files] of Object.entries(packageFiles)) { diff --git a/lib/workers/repository/process/fetch.ts b/lib/workers/repository/process/fetch.ts index 237759d6cdf96396e0fdb1cb6bcd96c057ebe425..60f7d316f461bcd8f6eac4157e7ac09171f538c3 100644 --- a/lib/workers/repository/process/fetch.ts +++ b/lib/workers/repository/process/fetch.ts @@ -48,11 +48,10 @@ async function fetchDepUpdates( dep.updates = dep.updates || []; // istanbul ignore if if (dep.updates.length) { + const results = String(dep.updates.map((upgrade) => upgrade.newValue)); logger.trace( { dependency: depName }, - `${dep.updates.length} result(s): ${dep.updates.map( - (upgrade) => upgrade.newValue - )}` + `${dep.updates.length} result(s): ${results}` ); } logger.trace({ diff --git a/lib/workers/repository/process/limits.ts b/lib/workers/repository/process/limits.ts index 0911eaaede1e48d31b0f963989acc6ca06e546aa..ee0066d6697bccc2851cafa0eb0808ca3d0aaf42 100644 --- a/lib/workers/repository/process/limits.ts +++ b/lib/workers/repository/process/limits.ts @@ -14,7 +14,7 @@ export async function getPrHourlyRemaining( const currentHourStart = moment({ hour: moment().hour(), }); - logger.debug('currentHourStart=' + currentHourStart); + logger.debug(`currentHourStart=${String(currentHourStart)}`); try { const soFarThisHour = prList.filter( (pr) => diff --git a/lib/workers/repository/stats.ts b/lib/workers/repository/stats.ts index 2cf727b43140423b562219b42f4779b92c469f5a..b60e422ca25eea846a4de6f901cfc7b26a54c944 100644 --- a/lib/workers/repository/stats.ts +++ b/lib/workers/repository/stats.ts @@ -2,8 +2,14 @@ import URL from 'url'; import { logger } from '../../logger'; import * as memCache from '../../util/cache/memory'; +interface RequestStats { + method: string; + url: string; + duration: number; +} + export function printRequestStats(): void { - const httpRequests = memCache.get('http-requests'); + const httpRequests = memCache.get<RequestStats[]>('http-requests'); if (!httpRequests) { return; } diff --git a/lib/workers/repository/updates/branch-name.ts b/lib/workers/repository/updates/branch-name.ts index fec7fb4be14320a0c7b17e4793fdfcdee64c4b9a..aa0269398646d665788adcd78569aeb69d974821 100644 --- a/lib/workers/repository/updates/branch-name.ts +++ b/lib/workers/repository/updates/branch-name.ts @@ -32,7 +32,8 @@ export function generateBranchName(update: RenovateConfig): void { }); if (update.updateType === 'major' && update.separateMajorMinor) { if (update.separateMultipleMajor) { - update.groupSlug = `major-${update.newMajor}-${update.groupSlug}`; + const newMajor = String(update.newMajor); + update.groupSlug = `major-${newMajor}-${update.groupSlug}`; } else { update.groupSlug = `major-${update.groupSlug}`; }