Skip to content

Commit

Permalink
chore(deps): update typescript-eslint monorepo to v8 (major) (renovat…
Browse files Browse the repository at this point in the history
…ebot#30750)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
  • Loading branch information
2 people authored and kosmoz committed Aug 16, 2024
1 parent 2566a97 commit e13dcf4
Show file tree
Hide file tree
Showing 95 changed files with 241 additions and 213 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ module.exports = {
],

'@typescript-eslint/unbound-method': [2, { ignoreStatic: true }],
'@typescript-eslint/ban-types': 2,
'@typescript-eslint/no-empty-object-type': [
2,
{ allowInterfaces: 'with-single-extends' },
],
'@renovate/jest-root-describe': 2,

'typescript-enum/no-const-enum': 2,
Expand Down
4 changes: 2 additions & 2 deletions lib/config-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ type PackageJson = {
);
}
}
} catch (err) {
} catch {
// ignore
}
try {
Expand All @@ -147,7 +147,7 @@ type PackageJson = {
returnVal = 1;
}
}
} catch (err) {
} catch {
// ignore
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/config/decrypt/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function tryDecryptPublicKeyPKCS1(
Buffer.from(encryptedStr, 'base64'),
)
.toString();
} catch (err) {
} catch {
logger.debug('Could not decrypt using PKCS1 padding');
}
return decryptedStr;
Expand All @@ -33,7 +33,7 @@ export function tryDecryptPublicKeyDefault(
.privateDecrypt(privateKey, Buffer.from(encryptedStr, 'base64'))
.toString();
logger.debug('Decrypted config using default padding');
} catch (err) {
} catch {
logger.debug('Could not decrypt using default padding');
}
return decryptedStr;
Expand Down
2 changes: 1 addition & 1 deletion lib/config/presets/npm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function getPreset({
const body = (await http.getJson<NpmResponse>(packageUrl)).body;
// TODO: check null #22198
dep = body.versions![body['dist-tags']!.latest];
} catch (err) {
} catch {
throw new Error(PRESET_DEP_NOT_FOUND);
}
if (!dep?.['renovate-config']) {
Expand Down
2 changes: 1 addition & 1 deletion lib/config/presets/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export async function fetchPreset({
export function parsePreset(content: string, fileName: string): Preset {
try {
return parseJson(content, fileName) as Preset;
} catch (err) {
} catch {
throw new Error(PRESET_INVALID_JSON);
}
}
6 changes: 3 additions & 3 deletions lib/config/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export async function validateConfig(
let res = template.compile((val as string).toString(), config, false);
res = template.compile(res, config, false);
template.compile(res, config, false);
} catch (err) {
} catch {
errors.push({
topic: 'Configuration Error',
message: `Invalid template in config path: ${currentPath}`,
Expand Down Expand Up @@ -600,7 +600,7 @@ export async function validateConfig(
try {
// regEx isn't aware of our !/ prefix but can handle the suffix
regEx(pattern.replace(startPattern, '/'));
} catch (e) {
} catch {
errors.push({
topic: 'Configuration Error',
message: `Invalid regExp for ${currentPath}: \`${pattern}\``,
Expand All @@ -613,7 +613,7 @@ export async function validateConfig(
for (const fileMatch of val as string[]) {
try {
regEx(fileMatch);
} catch (e) {
} catch {
errors.push({
topic: 'Configuration Error',
message: `Invalid regExp for ${currentPath}: \`${fileMatch}\``,
Expand Down
2 changes: 1 addition & 1 deletion lib/constants/category.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// istanbul ignore next
const Categories = [
export const Categories = [
'ansible',
'batect',
'bazel',
Expand Down
2 changes: 2 additions & 0 deletions lib/expose.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-require-imports */
// we need `require` for dynamic runtime imports
// https://stackoverflow.com/a/46745166/10109857

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/logger/once.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function getCallSite(omitFn: OmitFn): string | null {
if (callsite) {
result = callsite.toString();
}
} catch (_err) /* istanbul ignore next */ {
} catch /* istanbul ignore next */ {
// no-op
} finally {
Error.stackTraceLimit = stackTraceLimitOrig;
Expand Down
4 changes: 1 addition & 3 deletions lib/logger/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ export function prepareZodError(err: ZodError): Record<string, unknown> {
// istanbul ignore next
Object.defineProperty(err, 'message', {
get: () => 'Schema error',
set: (_) => {
_;
},
set: () => {},
});

return {
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/galaxy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class GalaxyDatasource extends Datasource {
const raw = await this.http.getJson(galaxyAPIUrl, GalaxyV1);
body = raw.body;
} catch (err) {
throw this.handleGenericErrors(err);
this.handleGenericErrors(err);
}

// istanbul ignore if
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/hermit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class HermitDatasource extends Datasource {

try {
return JSON.parse(indexContent) as HermitSearchResult[];
} catch (e) {
} catch {
logger.warn('error parsing hermit search manifest from remote respond');
}

Expand Down
8 changes: 4 additions & 4 deletions lib/modules/datasource/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,19 +750,19 @@ describe('modules/datasource/index', () => {
it('returns null if no releases are found', async () => {
const registries: RegistriesMock = {
'https://reg1.com': () => {
throw { statusCode: '404' };
throw Object.assign(new Error(), { statusCode: '404' });
},
'https://reg2.com': () => {
throw { statusCode: '401' };
throw Object.assign(new Error(), { statusCode: '401' });
},
'https://reg3.com': () => {
throw { statusCode: '403' };
throw Object.assign(new Error(), { statusCode: '403' });
},
'https://reg4.com': () => {
throw new Error('b');
},
'https://reg5.com': () => {
throw { code: '403' };
throw Object.assign(new Error(), { code: '403' });
},
};
const registryUrls = Object.keys(registries);
Expand Down
19 changes: 14 additions & 5 deletions lib/modules/datasource/maven/util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,48 @@ describe('modules/datasource/maven/util', () => {
describe('downloadHttpProtocol', () => {
it('returns empty for HOST_DISABLED error', async () => {
const http = partial<Http>({
get: () => Promise.reject({ message: HOST_DISABLED }),
get: () =>
Promise.reject(
Object.assign(new Error(), { message: HOST_DISABLED }),
),
});
const res = await downloadHttpProtocol(http, 'some://');
expect(res).toStrictEqual({});
});

it('returns empty for host error', async () => {
const http = partial<Http>({
get: () => Promise.reject({ code: 'ETIMEDOUT' }),
get: () =>
Promise.reject(Object.assign(new Error(), { code: 'ETIMEDOUT' })),
});
const res = await downloadHttpProtocol(http, 'some://');
expect(res).toStrictEqual({});
});

it('returns empty for temporal error', async () => {
const http = partial<Http>({
get: () => Promise.reject({ code: 'ECONNRESET' }),
get: () =>
Promise.reject(Object.assign(new Error(), { code: 'ECONNRESET' })),
});
const res = await downloadHttpProtocol(http, 'some://');
expect(res).toStrictEqual({});
});

it('returns empty for connection error', async () => {
const http = partial<Http>({
get: () => Promise.reject({ code: 'ECONNREFUSED' }),
get: () =>
Promise.reject(Object.assign(new Error(), { code: 'ECONNREFUSED' })),
});
const res = await downloadHttpProtocol(http, 'some://');
expect(res).toStrictEqual({});
});

it('returns empty for unsupported error', async () => {
const http = partial<Http>({
get: () => Promise.reject({ name: 'UnsupportedProtocolError' }),
get: () =>
Promise.reject(
Object.assign(new Error(), { name: 'UnsupportedProtocolError' }),
),
});
const res = await downloadHttpProtocol(http, 'some://');
expect(res).toStrictEqual({});
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export function addMetaData(
dep.sourceUrl = parsed.toString();
dep.sourceDirectory = parsed.filepath;
}
} catch (err) {
} catch {
// ignore invalid urls
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/bazel-module/fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const AttributeFragmentSchema = z.object({
value: ValueFragmentsSchema.optional(),
isComplete: z.boolean(),
});
const AllFragmentsSchema = z.discriminatedUnion('type', [
export const AllFragmentsSchema = z.discriminatedUnion('type', [
ArrayFragmentSchema,
AttributeFragmentSchema,
BooleanFragmentSchema,
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/bazel/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function getHashFromUrl(url: string): Promise<string | null> {
const cacheMinutes = 3 * 24 * 60; // 3 days
await packageCache.set(cacheNamespace, url, hash, cacheMinutes);
return hash;
} catch (err) /* istanbul ignore next */ {
} catch /* istanbul ignore next */ {
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/cake/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function parseDependencyLine(line: string): PackageDependency | null {
}

return result;
} catch (err) {
} catch {
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/cargo/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function bumpPackageVersion(
} else {
logger.debug('Bumped Cargo.toml version');
}
} catch (err) {
} catch {
logger.warn(
{
content,
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/manager/custom/regex/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function updateDependency(
try {
const url = new URL(value).toString();
dependency.registryUrls = [url];
} catch (err) {
} catch {
logger.warn({ value }, 'Invalid regex manager registryUrl');
}
break;
Expand Down Expand Up @@ -67,7 +67,7 @@ export function createDependency(
try {
const compiled = template.compile(tmpl, groups, false);
updateDependency(dependency, field, compiled);
} catch (err) {
} catch {
logger.warn(
{ template: tmpl },
'Error compiling template for custom manager',
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/gradle/parser/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export function handleCustomRegistryUrl(ctx: Ctx): Ctx {
scope: isPluginRegistry(ctx) ? 'plugin' : 'dep',
});
}
} catch (e) {
} catch {
// no-op
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/helm-requirements/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function extractPackageFile(
let doc: any;
try {
doc = parseSingleYaml(content, { json: true }); // TODO #9610
} catch (err) {
} catch {
logger.debug({ packageFile }, `Failed to parse helm requirements.yaml`);
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/helmv3/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function extractPackageFile(
);
return null;
}
} catch (err) {
} catch {
logger.debug({ packageFile }, `Failed to parse helm Chart.yaml`);
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/helmv3/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function bumpPackageVersion(
} else {
logger.debug('Bumped Chart.yaml version');
}
} catch (err) {
} catch {
logger.warn(
{
content,
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/homebrew/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function parseUrlPath(
return null;
}
return { currentValue, ownerName, repoName };
} catch (_) {
} catch {
return null;
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/manager/homebrew/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export async function updateDependency({
upgrade.newValue
}/${repoName}-${String(semver.coerce(upgrade.newValue))}.tar.gz`;
newSha256 = await hashStream(http.stream(newUrl), 'sha256');
} catch (errOuter) {
} catch {
logger.debug(
`Failed to download release download for ${upgrade.depName} - trying archive instead`,
);
Expand All @@ -173,7 +173,7 @@ export async function updateDependency({
const repoName = String(upgrade.managerData.repoName);
newUrl = `https://github.com/${ownerName}/${repoName}/archive/refs/tags/${upgrade.newValue}.tar.gz`;
newSha256 = await hashStream(http.stream(newUrl), 'sha256');
} catch (errInner) {
} catch {
logger.debug(
`Failed to download archive download for ${upgrade.depName} - update failed`,
);
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/jsonnet-bundler/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function extractPackageFile(
let jsonnetFile: JsonnetFile;
try {
jsonnetFile = JSON.parse(content) as JsonnetFile;
} catch (err) {
} catch {
logger.debug({ packageFile }, `Invalid JSON`);
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/kustomize/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export function parseKustomize(
try {
// TODO: use schema (#9610)
pkg = parseSingleYaml(content, { json: true });
} catch (e) /* istanbul ignore next */ {
} catch /* istanbul ignore next */ {
logger.debug({ packageFile }, 'Error parsing kustomize file');
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/manager/maven/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function parsePom(raw: string, packageFile: string): XmlDocument | null {
let project: XmlDocument;
try {
project = new XmlDocument(raw);
} catch (err) {
} catch {
logger.debug({ packageFile }, `Failed to parse as XML`);
return null;
}
Expand All @@ -49,7 +49,7 @@ function parseExtensions(raw: string, packageFile: string): XmlDocument | null {
let extensions: XmlDocument;
try {
extensions = new XmlDocument(raw);
} catch (err) {
} catch {
logger.debug({ packageFile }, `Failed to parse as XML`);
return null;
}
Expand Down Expand Up @@ -392,7 +392,7 @@ export function parseSettings(raw: string): XmlDocument | null {
let settings: XmlDocument;
try {
settings = new XmlDocument(raw);
} catch (e) {
} catch {
return null;
}
const { name, attr } = settings;
Expand Down
Loading

0 comments on commit e13dcf4

Please sign in to comment.