mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
chore: fix more eslint warnings (#7001)
This commit is contained in:
parent
d92e354763
commit
b45502cd28
6 changed files with 22 additions and 16 deletions
|
@ -14,7 +14,11 @@ const getHeaders = (): OutgoingHttpHeaders => {
|
||||||
return { hostType: id };
|
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 headers = getHeaders();
|
||||||
|
|
||||||
const name = `${path}/${dependency}.json`;
|
const name = `${path}/${dependency}.json`;
|
||||||
|
@ -26,14 +30,14 @@ const fetch = async ({ dependency, registry, path }): Promise<any> => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return response.body;
|
return response.body;
|
||||||
};
|
}
|
||||||
|
|
||||||
export const getDependency = async ({
|
export async function getDependency(
|
||||||
dependency,
|
dependency: string,
|
||||||
registry,
|
registry: string
|
||||||
}): Promise<ReleaseResult | null> => {
|
): Promise<ReleaseResult | null> {
|
||||||
logger.debug({ dependency }, 'RubyGems lookup for dependency');
|
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) {
|
if (!info) {
|
||||||
logger.debug({ dependency }, 'RubyGems package not found.');
|
logger.debug({ dependency }, 'RubyGems package not found.');
|
||||||
return null;
|
return null;
|
||||||
|
@ -47,8 +51,7 @@ export const getDependency = async ({
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const versions =
|
const versions = (await fetch(dependency, registry, VERSIONS_PATH)) || [];
|
||||||
(await fetch({ dependency, registry, path: VERSIONS_PATH })) || [];
|
|
||||||
|
|
||||||
const releases = versions.map(
|
const releases = versions.map(
|
||||||
({
|
({
|
||||||
|
@ -72,4 +75,4 @@ export const getDependency = async ({
|
||||||
sourceUrl: info.source_code_uri,
|
sourceUrl: info.source_code_uri,
|
||||||
changelogUrl: info.changelog_uri,
|
changelogUrl: info.changelog_uri,
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
|
@ -10,5 +10,5 @@ export function getReleases({
|
||||||
if (registryUrl.endsWith('rubygems.org')) { // lgtm [js/incomplete-url-substring-sanitization]
|
if (registryUrl.endsWith('rubygems.org')) { // lgtm [js/incomplete-url-substring-sanitization]
|
||||||
return getRubygemsOrgDependency(lookupName);
|
return getRubygemsOrgDependency(lookupName);
|
||||||
}
|
}
|
||||||
return getDependency({ dependency: lookupName, registry: registryUrl });
|
return getDependency(lookupName, registryUrl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import is from '@sindresorhus/is';
|
||||||
|
|
||||||
Error.stackTraceLimit = 20;
|
Error.stackTraceLimit = 20;
|
||||||
|
|
||||||
// TODO: remove any type
|
// eslint-disable-next-lint @typescript-eslint/explicit-module-boundary-types
|
||||||
export default function errSerializer(err: any): any {
|
export default function errSerializer(err: any): any {
|
||||||
const response = {
|
const response = {
|
||||||
...err,
|
...err,
|
||||||
|
|
|
@ -111,11 +111,13 @@ export function getContext(): any {
|
||||||
}
|
}
|
||||||
|
|
||||||
// setMeta overrides existing meta, may remove fields if no longer existing
|
// 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 {
|
export function setMeta(obj: any): void {
|
||||||
meta = { ...obj };
|
meta = { ...obj };
|
||||||
}
|
}
|
||||||
|
|
||||||
// addMeta overrides or adds fields but does not remove any
|
// 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 {
|
export function addMeta(obj: any): void {
|
||||||
meta = { ...meta, ...obj };
|
meta = { ...meta, ...obj };
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ function sanitizeValue(value: any, seen = new WeakMap()): any {
|
||||||
return valueType === 'string' ? sanitize(value) : value;
|
return valueType === 'string' ? sanitize(value) : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// eslint-disable-next-lint @typescript-eslint/explicit-module-boundary-types
|
||||||
export function withSanitizer(streamConfig): bunyan.Stream {
|
export function withSanitizer(streamConfig): bunyan.Stream {
|
||||||
if (streamConfig.type === 'rotating-file') {
|
if (streamConfig.type === 'rotating-file') {
|
||||||
throw new Error("Rotating files aren't supported");
|
throw new Error("Rotating files aren't supported");
|
||||||
|
|
|
@ -308,11 +308,10 @@ const isRelevantPr = (
|
||||||
matchesState(p.state, state);
|
matchesState(p.state, state);
|
||||||
|
|
||||||
// TODO: coverage
|
// TODO: coverage
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
export async function getPrList(refreshCache?: boolean): Promise<Pr[]> {
|
||||||
export async function getPrList(_args?: any): Promise<Pr[]> {
|
|
||||||
logger.debug(`getPrList()`);
|
logger.debug(`getPrList()`);
|
||||||
// istanbul ignore next
|
// istanbul ignore next
|
||||||
if (!config.prList) {
|
if (!config.prList || refreshCache) {
|
||||||
const query = new URLSearchParams({
|
const query = new URLSearchParams({
|
||||||
state: 'ALL',
|
state: 'ALL',
|
||||||
'role.1': 'AUTHOR',
|
'role.1': 'AUTHOR',
|
||||||
|
@ -339,7 +338,7 @@ export async function findPr({
|
||||||
refreshCache,
|
refreshCache,
|
||||||
}: FindPRConfig): Promise<Pr | null> {
|
}: FindPRConfig): Promise<Pr | null> {
|
||||||
logger.debug(`findPr(${branchName}, "${prTitle}", "${state}")`);
|
logger.debug(`findPr(${branchName}, "${prTitle}", "${state}")`);
|
||||||
const prList = await getPrList({ refreshCache });
|
const prList = await getPrList(refreshCache);
|
||||||
const pr = prList.find(isRelevantPr(branchName, prTitle, state));
|
const pr = prList.find(isRelevantPr(branchName, prTitle, state));
|
||||||
if (pr) {
|
if (pr) {
|
||||||
logger.debug(`Found PR #${pr.number}`);
|
logger.debug(`Found PR #${pr.number}`);
|
||||||
|
|
Loading…
Reference in a new issue