Skip to content

Commit

Permalink
chore: fix more eslint warnings (#7001)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee authored Aug 17, 2020
1 parent d92e354 commit b45502c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
23 changes: 13 additions & 10 deletions lib/datasource/rubygems/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand All @@ -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;
Expand All @@ -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(
({
Expand All @@ -72,4 +75,4 @@ export const getDependency = async ({
sourceUrl: info.source_code_uri,
changelogUrl: info.changelog_uri,
};
};
}
2 changes: 1 addition & 1 deletion lib/datasource/rubygems/releases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion lib/logger/err-serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions lib/logger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
Expand Down
2 changes: 2 additions & 0 deletions lib/logger/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
7 changes: 3 additions & 4 deletions lib/platform/bitbucket-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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}`);
Expand Down

0 comments on commit b45502c

Please sign in to comment.