Skip to content

Commit

Permalink
chore(deps): update dependency eslint-config-prettier to v7 (#7940)
Browse files Browse the repository at this point in the history
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
  • Loading branch information
3 people committed Dec 11, 2020
1 parent db6b487 commit 6c414e7
Show file tree
Hide file tree
Showing 25 changed files with 113 additions and 162 deletions.
16 changes: 7 additions & 9 deletions lib/datasource/jenkins-plugins/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,13 @@ function updateJenkinsPluginVersionsCacheCallback(
const plugins = response.plugins;
for (const name of Object.keys(plugins || [])) {
// eslint-disable-next-line no-param-reassign
cache.cache[name] = Object.keys(plugins[name]).map((version) => {
return {
version,
downloadUrl: plugins[name][version]?.url,
releaseTimestamp: plugins[name][version]?.buildDate
? new Date(plugins[name][version].buildDate + ' UTC')
: null,
};
});
cache.cache[name] = Object.keys(plugins[name]).map((version) => ({
version,
downloadUrl: plugins[name][version]?.url,
releaseTimestamp: plugins[name][version]?.buildDate
? new Date(plugins[name][version].buildDate + ' UTC')
: null,
}));
}
}

Expand Down
4 changes: 1 addition & 3 deletions lib/datasource/rubygems/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const http = new Http(id);
const INFO_PATH = '/api/v1/gems';
const VERSIONS_PATH = '/api/v1/versions';

const getHeaders = (): OutgoingHttpHeaders => {
return { hostType: id };
};
const getHeaders = (): OutgoingHttpHeaders => ({ hostType: id });

export async function fetch(
dependency: string,
Expand Down
6 changes: 3 additions & 3 deletions lib/datasource/terraform-module/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ export async function getReleases({
dep.homepage = `https://registry.terraform.io/modules/${repository}`;
}
// set published date for latest release
const currentVersion = dep.releases.find((release) => {
return res.version === release.version;
});
const currentVersion = dep.releases.find(
(release) => res.version === release.version
);
if (currentVersion) {
currentVersion.releaseTimestamp = res.published_at;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/datasource/terraform-provider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ async function queryRegistry(
version,
}));
// set published date for latest release
const currentVersion = dep.releases.find((release) => {
return res.version === release.version;
});
const currentVersion = dep.releases.find(
(release) => res.version === release.version
);
// istanbul ignore else
if (currentVersion) {
currentVersion.releaseTimestamp = res.published_at;
Expand Down
27 changes: 14 additions & 13 deletions lib/logger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,20 @@ const bunyanLogger = bunyan.createLogger({
].map(withSanitizer),
});

const logFactory = (level: bunyan.LogLevelString): any => {
return (p1: any, p2: any): void => {
if (p2) {
// meta and msg provided
bunyanLogger[level]({ logContext, ...curMeta, ...p1 }, p2);
} else if (is.string(p1)) {
// only message provided
bunyanLogger[level]({ logContext, ...curMeta }, p1);
} else {
// only meta provided
bunyanLogger[level]({ logContext, ...curMeta, ...p1 });
}
};
const logFactory = (level: bunyan.LogLevelString): any => (
p1: any,
p2: any
): void => {
if (p2) {
// meta and msg provided
bunyanLogger[level]({ logContext, ...curMeta, ...p1 }, p2);
} else if (is.string(p1)) {
// only message provided
bunyanLogger[level]({ logContext, ...curMeta }, p1);
} else {
// only meta provided
bunyanLogger[level]({ logContext, ...curMeta, ...p1 });
}
};

const loggerLevels: bunyan.LogLevelString[] = [
Expand Down
10 changes: 7 additions & 3 deletions lib/manager/bundler/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,13 @@ export async function updateArtifacts(

const bundlerHostRulesVariables = findAllAuthenticatable({
hostType: 'bundler',
}).reduce((variables, hostRule) => {
return { ...variables, ...buildBundleHostVariable(hostRule) };
}, {} as Record<string, string>);
}).reduce(
(variables, hostRule) => ({
...variables,
...buildBundleHostVariable(hostRule),
}),
{} as Record<string, string>
);

const execOptions: ExecOptions = {
cwdFile: packageFileName,
Expand Down
47 changes: 21 additions & 26 deletions lib/manager/bundler/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,14 @@ describe('lib/manager/bundler/extract', () => {
// couple of dependency of ruby rails are not present in the lock file. Filter out those before processing
expect(
res.deps
.filter((dep) => {
return Object.prototype.hasOwnProperty.call(dep, 'lockedVersion');
})
.every((dep) => {
return (
.filter((dep) =>
Object.prototype.hasOwnProperty.call(dep, 'lockedVersion')
)
.every(
(dep) =>
Object.prototype.hasOwnProperty.call(dep, 'lockedVersion') &&
isValid(dep.lockedVersion)
);
})
)
).toBe(true);
validateGems(railsGemfile, res);
});
Expand All @@ -104,12 +103,11 @@ describe('lib/manager/bundler/extract', () => {
const res = await extractPackageFile(webPackerGemfile, 'Gemfile');
expect(res).toMatchSnapshot();
expect(
res.deps.every((dep) => {
return (
res.deps.every(
(dep) =>
Object.prototype.hasOwnProperty.call(dep, 'lockedVersion') &&
isValid(dep.lockedVersion)
);
})
)
).toBe(true);
validateGems(webPackerGemfile, res);
});
Expand All @@ -119,15 +117,14 @@ describe('lib/manager/bundler/extract', () => {
expect(res).toMatchSnapshot();
expect(
res.deps
.filter((dep) => {
return Object.prototype.hasOwnProperty.call(dep, 'lockedVersion');
})
.every((dep) => {
return (
.filter((dep) =>
Object.prototype.hasOwnProperty.call(dep, 'lockedVersion')
)
.every(
(dep) =>
Object.prototype.hasOwnProperty.call(dep, 'lockedVersion') &&
isValid(dep.lockedVersion)
);
})
)
).toBe(true);
validateGems(mastodonGemfile, res);
});
Expand All @@ -136,12 +133,11 @@ describe('lib/manager/bundler/extract', () => {
const res = await extractPackageFile(rubyCIGemfile, 'Gemfile');
expect(res).toMatchSnapshot();
expect(
res.deps.every((dep) => {
return (
res.deps.every(
(dep) =>
Object.prototype.hasOwnProperty.call(dep, 'lockedVersion') &&
isValid(dep.lockedVersion)
);
})
)
).toBe(true);
validateGems(rubyCIGemfile, res);
});
Expand All @@ -151,12 +147,11 @@ describe('lib/manager/bundler/extract', () => {
const res = await extractPackageFile(gitlabFossGemfile, 'Gemfile');
expect(res).toMatchSnapshot();
expect(
res.deps.every((dep) => {
return (
res.deps.every(
(dep) =>
Object.prototype.hasOwnProperty.call(dep, 'lockedVersion') &&
isValid(dep.lockedVersion)
);
})
)
).toBe(true);
validateGems(gitlabFossGemfile, res);
});
Expand Down
14 changes: 6 additions & 8 deletions lib/manager/gradle-wrapper/artifacts-real.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ describe(getName(__filename), () => {
'gradle/wrapper/gradle-wrapper.jar',
'gradlew',
'gradlew.bat',
].map((fileProjectPath) => {
return {
file: {
name: fileProjectPath,
contents: readBinSync(`./testFiles/${fileProjectPath}`),
},
};
})
].map((fileProjectPath) => ({
file: {
name: fileProjectPath,
contents: readBinSync(`./testFiles/${fileProjectPath}`),
},
}))
);

[
Expand Down
14 changes: 6 additions & 8 deletions lib/manager/gradle-wrapper/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,12 @@ describe(getName(__filename), () => {
'gradle/wrapper/gradle-wrapper.properties',
'gradlew',
'gradlew.bat',
].map((fileProjectPath) => {
return {
file: {
name: fileProjectPath,
contents: 'test',
},
};
})
].map((fileProjectPath) => ({
file: {
name: fileProjectPath,
contents: 'test',
},
}))
);
expect(execSnapshots).toMatchSnapshot();
});
Expand Down
5 changes: 2 additions & 3 deletions lib/manager/helmfile/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { ExtractConfig, PackageDependency, PackageFile } from '../common';

const isValidChartName = (name: string): boolean => {
return !/[!@#$%^&*(),.?":{}/|<>A-Z]/.test(name);
};
const isValidChartName = (name: string): boolean =>
!/[!@#$%^&*(),.?":{}/|<>A-Z]/.test(name);

export function extractPackageFile(
content: string,
Expand Down
36 changes: 9 additions & 27 deletions lib/manager/homebrew/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ import { isSpace, removeComments, skip } from './util';
function parseSha256(idx: number, content: string): string | null {
let i = idx;
i += 'sha256'.length;
i = skip(i, content, (c) => {
return isSpace(c);
});
i = skip(i, content, (c) => isSpace(c));
if (content[i] !== '"' && content[i] !== "'") {
return null;
}
i += 1;
const j = skip(i, content, (c) => {
return c !== '"' && c !== "'";
});
const j = skip(i, content, (c) => c !== '"' && c !== "'");
const sha256 = content.slice(i, j);
return sha256;
}
Expand All @@ -33,17 +29,13 @@ function extractSha256(content: string): string | null {
function parseUrl(idx: number, content: string): string | null {
let i = idx;
i += 'url'.length;
i = skip(i, content, (c) => {
return isSpace(c);
});
i = skip(i, content, (c) => isSpace(c));
const chr = content[i];
if (chr !== '"' && chr !== "'") {
return null;
}
i += 1;
const j = skip(i, content, (c) => {
return c !== '"' && c !== "'" && !isSpace(c);
});
const j = skip(i, content, (c) => c !== '"' && c !== "'" && !isSpace(c));
const url = content.slice(i, j);
return url;
}
Expand Down Expand Up @@ -108,31 +100,21 @@ export function parseUrlPath(urlStr: string): UrlPathParsedResult | null {
function parseClassHeader(idx: number, content: string): string | null {
let i = idx;
i += 'class'.length;
i = skip(i, content, (c) => {
return isSpace(c);
});
i = skip(i, content, (c) => isSpace(c));
// Skip all non space and non '<' characters
let j = skip(i, content, (c) => {
return !isSpace(c) && c !== '<';
});
let j = skip(i, content, (c) => !isSpace(c) && c !== '<');
const className = content.slice(i, j);
i = j;
// Skip spaces
i = skip(i, content, (c) => {
return isSpace(c);
});
i = skip(i, content, (c) => isSpace(c));
if (content[i] === '<') {
i += 1;
} else {
return null;
} // Skip spaces
i = skip(i, content, (c) => {
return isSpace(c);
});
i = skip(i, content, (c) => isSpace(c));
// Skip non-spaces
j = skip(i, content, (c) => {
return !isSpace(c);
});
j = skip(i, content, (c) => !isSpace(c));
if (content.slice(i, j) !== 'Formula') {
return null;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/manager/terraform/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ export function checkFileContainsDependency(
content: string,
checkList: string[]
): boolean {
return checkList.some((check) => {
return content.includes(check);
});
return checkList.some((check) => content.includes(check));
}

const pathStringRegex = /(.|..)?(\/[^/])+/;
Expand Down
4 changes: 1 addition & 3 deletions lib/manager/terragrunt/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,5 @@ export function checkFileContainsDependency(
content: string,
checkList: string[]
): boolean {
return checkList.some((check) => {
return content.includes(check);
});
return checkList.some((check) => content.includes(check));
}
6 changes: 3 additions & 3 deletions lib/platform/gitea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ function getLabelList(): Promise<helper.Label[]> {
return [];
});

config.labelList = Promise.all([repoLabels, orgLabels]).then((labels) => {
return [].concat(...labels);
});
config.labelList = Promise.all([repoLabels, orgLabels]).then((labels) =>
[].concat(...labels)
);
}

return config.labelList;
Expand Down
7 changes: 3 additions & 4 deletions lib/platform/github/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,15 +685,14 @@ export async function getPrList(): Promise<Pr[]> {
throw new ExternalHostError(err, PLATFORM_TYPE_GITHUB);
}
config.prList = prList
.filter((pr) => {
return (
.filter(
(pr) =>
config.forkMode ||
config.ignorePrAuthor ||
(pr?.user?.login && config?.renovateUsername
? pr.user.login === config.renovateUsername
: true)
);
})
)
.map(
(pr) =>
({
Expand Down

0 comments on commit 6c414e7

Please sign in to comment.