From b45502cd28dee7b583dd2f00da76a3807304d92f Mon Sep 17 00:00:00 2001
From: Jamie Magee <JamieMagee@users.noreply.github.com>
Date: Mon, 17 Aug 2020 12:32:23 +0200
Subject: [PATCH] chore: fix more eslint warnings (#7001)

---
 lib/datasource/rubygems/get.ts         | 23 +++++++++++++----------
 lib/datasource/rubygems/releases.ts    |  2 +-
 lib/logger/err-serializer.ts           |  2 +-
 lib/logger/index.ts                    |  2 ++
 lib/logger/utils.ts                    |  2 ++
 lib/platform/bitbucket-server/index.ts |  7 +++----
 6 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/lib/datasource/rubygems/get.ts b/lib/datasource/rubygems/get.ts
index 55e1d4d2f0..b99064fa05 100644
--- a/lib/datasource/rubygems/get.ts
+++ b/lib/datasource/rubygems/get.ts
@@ -14,7 +14,11 @@ const getHeaders = (): OutgoingHttpHeaders => {
   return { hostType: id };
 };
 
-const fetch = async ({ dependency, registry, path }): Promise<any> => {
+export async function fetch(
+  dependency: string,
+  registry: string,
+  path: string
+): Promise<any> {
   const headers = getHeaders();
 
   const name = `${path}/${dependency}.json`;
@@ -26,14 +30,14 @@ const fetch = async ({ dependency, registry, path }): Promise<any> => {
   };
 
   return response.body;
-};
+}
 
-export const getDependency = async ({
-  dependency,
-  registry,
-}): Promise<ReleaseResult | null> => {
+export async function getDependency(
+  dependency: string,
+  registry: string
+): Promise<ReleaseResult | null> {
   logger.debug({ dependency }, 'RubyGems lookup for dependency');
-  const info = await fetch({ dependency, registry, path: INFO_PATH });
+  const info = await fetch(dependency, registry, INFO_PATH);
   if (!info) {
     logger.debug({ dependency }, 'RubyGems package not found.');
     return null;
@@ -47,8 +51,7 @@ export const getDependency = async ({
     return null;
   }
 
-  const versions =
-    (await fetch({ dependency, registry, path: VERSIONS_PATH })) || [];
+  const versions = (await fetch(dependency, registry, VERSIONS_PATH)) || [];
 
   const releases = versions.map(
     ({
@@ -72,4 +75,4 @@ export const getDependency = async ({
     sourceUrl: info.source_code_uri,
     changelogUrl: info.changelog_uri,
   };
-};
+}
diff --git a/lib/datasource/rubygems/releases.ts b/lib/datasource/rubygems/releases.ts
index b010ccf347..837c1f6b9d 100644
--- a/lib/datasource/rubygems/releases.ts
+++ b/lib/datasource/rubygems/releases.ts
@@ -10,5 +10,5 @@ export function getReleases({
   if (registryUrl.endsWith('rubygems.org')) { // lgtm [js/incomplete-url-substring-sanitization]
       return getRubygemsOrgDependency(lookupName);
     }
-  return getDependency({ dependency: lookupName, registry: registryUrl });
+  return getDependency(lookupName, registryUrl);
 }
diff --git a/lib/logger/err-serializer.ts b/lib/logger/err-serializer.ts
index 1df9cd06b1..8bc0b266c1 100644
--- a/lib/logger/err-serializer.ts
+++ b/lib/logger/err-serializer.ts
@@ -2,7 +2,7 @@ import is from '@sindresorhus/is';
 
 Error.stackTraceLimit = 20;
 
-// TODO: remove any type
+// eslint-disable-next-lint @typescript-eslint/explicit-module-boundary-types
 export default function errSerializer(err: any): any {
   const response = {
     ...err,
diff --git a/lib/logger/index.ts b/lib/logger/index.ts
index ce69abc891..499a60ec2d 100644
--- a/lib/logger/index.ts
+++ b/lib/logger/index.ts
@@ -111,11 +111,13 @@ export function getContext(): any {
 }
 
 // setMeta overrides existing meta, may remove fields if no longer existing
+// eslint-disable-next-lint @typescript-eslint/explicit-module-boundary-types
 export function setMeta(obj: any): void {
   meta = { ...obj };
 }
 
 // addMeta overrides or adds fields but does not remove any
+// eslint-disable-next-lint @typescript-eslint/explicit-module-boundary-types
 export function addMeta(obj: any): void {
   meta = { ...meta, ...obj };
 }
diff --git a/lib/logger/utils.ts b/lib/logger/utils.ts
index a624e6eef2..944a362856 100644
--- a/lib/logger/utils.ts
+++ b/lib/logger/utils.ts
@@ -92,6 +92,8 @@ function sanitizeValue(value: any, seen = new WeakMap()): any {
   return valueType === 'string' ? sanitize(value) : value;
 }
 
+// TODO
+// eslint-disable-next-lint @typescript-eslint/explicit-module-boundary-types
 export function withSanitizer(streamConfig): bunyan.Stream {
   if (streamConfig.type === 'rotating-file') {
     throw new Error("Rotating files aren't supported");
diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts
index f86ff62d06..f2a7ab70d6 100644
--- a/lib/platform/bitbucket-server/index.ts
+++ b/lib/platform/bitbucket-server/index.ts
@@ -308,11 +308,10 @@ const isRelevantPr = (
   matchesState(p.state, state);
 
 // TODO: coverage
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-export async function getPrList(_args?: any): Promise<Pr[]> {
+export async function getPrList(refreshCache?: boolean): Promise<Pr[]> {
   logger.debug(`getPrList()`);
   // istanbul ignore next
-  if (!config.prList) {
+  if (!config.prList || refreshCache) {
     const query = new URLSearchParams({
       state: 'ALL',
       'role.1': 'AUTHOR',
@@ -339,7 +338,7 @@ export async function findPr({
   refreshCache,
 }: FindPRConfig): Promise<Pr | null> {
   logger.debug(`findPr(${branchName}, "${prTitle}", "${state}")`);
-  const prList = await getPrList({ refreshCache });
+  const prList = await getPrList(refreshCache);
   const pr = prList.find(isRelevantPr(branchName, prTitle, state));
   if (pr) {
     logger.debug(`Found PR #${pr.number}`);
-- 
GitLab