From fe739befbf6b914a322ab998283e0d1adb08097c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:07:49 +0000 Subject: [PATCH] chore(deps): update linters to v6 (major) (#23325) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de> --- lib/config/presets/util.ts | 2 +- lib/config/types.ts | 3 +- lib/config/validation.ts | 3 +- lib/logger/utils.spec.ts | 3 +- lib/modules/datasource/artifactory/index.ts | 1 - lib/modules/datasource/cdnjs/index.spec.ts | 2 - lib/modules/datasource/conan/index.ts | 1 - lib/modules/datasource/conda/index.ts | 1 - lib/modules/datasource/crate/index.ts | 1 - lib/modules/datasource/datasource.ts | 1 - lib/modules/datasource/deno/index.ts | 1 - lib/modules/datasource/docker/index.ts | 3 +- .../datasource/galaxy-collection/index.ts | 1 - lib/modules/datasource/galaxy/index.ts | 2 - .../datasource/gitlab-packages/index.ts | 1 - .../datasource/gitlab-releases/index.ts | 1 - lib/modules/datasource/go/base.ts | 1 - lib/modules/datasource/go/index.ts | 1 - lib/modules/datasource/go/releases-goproxy.ts | 1 - .../datasource/gradle-version/index.ts | 1 - lib/modules/datasource/maven/util.ts | 2 - lib/modules/datasource/node-version/index.ts | 1 - lib/modules/datasource/npm/npmrc.ts | 2 +- lib/modules/datasource/nuget/v2.ts | 1 - lib/modules/datasource/nuget/v3.ts | 1 - lib/modules/datasource/pod/index.ts | 1 - lib/modules/datasource/puppet-forge/index.ts | 1 - lib/modules/datasource/ruby-version/index.ts | 1 - .../datasource/terraform-provider/index.ts | 1 - lib/modules/manager/composer/range.ts | 2 +- lib/modules/manager/composer/utils.ts | 1 - lib/modules/manager/dockerfile/extract.ts | 6 +- .../manager/git-submodules/artifacts.ts | 1 - lib/modules/manager/gitlabci/utils.ts | 1 - lib/modules/manager/gomod/artifacts.ts | 6 +- lib/modules/manager/gomod/update.ts | 1 - lib/modules/manager/gradle/artifacts.ts | 2 +- lib/modules/manager/gradle/update.ts | 1 - lib/modules/manager/homebrew/extract.ts | 1 - lib/modules/manager/homebrew/update.ts | 1 - lib/modules/manager/kustomize/extract.ts | 1 - lib/modules/manager/npm/extract/index.ts | 8 +- .../manager/npm/extract/locked-versions.ts | 1 - lib/modules/manager/npm/post-update/index.ts | 1 - lib/modules/manager/npm/post-update/lerna.ts | 4 +- lib/modules/manager/npm/post-update/npm.ts | 5 +- lib/modules/manager/npm/post-update/rules.ts | 1 - .../manager/npm/update/dependency/index.ts | 4 - .../locked-dependency/package-lock/index.ts | 1 - lib/modules/manager/poetry/extract.ts | 2 +- lib/modules/platform/azure/index.ts | 7 +- .../platform/bitbucket-server/index.ts | 2 +- .../platform/bitbucket-server/utils.ts | 4 +- lib/modules/platform/bitbucket/index.ts | 9 +- lib/modules/platform/codecommit/index.ts | 7 +- lib/modules/platform/gitea/index.spec.ts | 4 - lib/modules/platform/gitea/index.ts | 2 +- lib/modules/platform/github/common.ts | 2 +- lib/modules/platform/github/index.ts | 4 +- lib/modules/platform/gitlab/index.ts | 4 +- lib/modules/platform/types.ts | 2 +- lib/modules/versioning/composer/index.ts | 6 +- lib/modules/versioning/conan/range.ts | 4 +- lib/modules/versioning/maven/compare.ts | 2 +- lib/modules/versioning/node/index.spec.ts | 2 +- lib/modules/versioning/npm/range.ts | 2 +- lib/modules/versioning/poetry/index.ts | 2 +- lib/modules/versioning/poetry/transform.ts | 2 +- lib/types/vulnerability-alert.ts | 2 + lib/util/git/auth.ts | 6 +- lib/util/host-rules.ts | 2 +- lib/util/http/auth.ts | 2 +- lib/util/http/host-rules.ts | 12 +- lib/util/http/index.ts | 4 +- lib/util/package-rules/dep-types.ts | 2 +- lib/util/url.ts | 2 + lib/workers/global/config/parse/env.spec.ts | 1 - lib/workers/global/limits.ts | 2 + .../repository/config-migration/pr/index.ts | 2 - .../repository/dependency-dashboard.ts | 9 +- lib/workers/repository/onboarding/pr/index.ts | 2 +- lib/workers/repository/process/fetch.ts | 2 +- .../repository/process/lookup/index.ts | 8 +- .../repository/process/vulnerabilities.ts | 1 - .../repository/update/branch/auto-replace.ts | 2 +- .../branch/execute-post-upgrade-commands.ts | 5 +- .../update/branch/handle-existing.ts | 2 +- lib/workers/repository/update/branch/index.ts | 4 +- lib/workers/repository/update/branch/reuse.ts | 2 +- .../update/pr/body/config-description.ts | 2 - lib/workers/types.ts | 2 + package.json | 4 +- test/graphql-snapshot.ts | 29 ++--- test/setup.ts | 3 +- test/to-migrate.ts | 2 - yarn.lock | 115 +++++++++++++----- 96 files changed, 197 insertions(+), 194 deletions(-) diff --git a/lib/config/presets/util.ts b/lib/config/presets/util.ts index 8d8382e3d5..12550cc26e 100644 --- a/lib/config/presets/util.ts +++ b/lib/config/presets/util.ts @@ -26,7 +26,7 @@ export async function fetchPreset({ const [fileName, presetName, subPresetName] = filePreset.split('/'); const pathPrefix = presetPath ? `${presetPath}/` : ''; const buildFilePath = (name: string): string => `${pathPrefix}${name}`; - let jsonContent: any | undefined; + let jsonContent: any; if (fileName === 'default') { try { jsonContent = await fetch( diff --git a/lib/config/types.ts b/lib/config/types.ts index 99cf44b617..96bf67fa9e 100644 --- a/lib/config/types.ts +++ b/lib/config/types.ts @@ -12,6 +12,7 @@ export type RenovateConfigStage = | 'pr'; export type RepositoryCacheConfig = 'disabled' | 'enabled' | 'reset'; +// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents export type RepositoryCacheType = 'local' | string; export type DryRunConfig = 'extract' | 'lookup' | 'full'; export type RequiredConfig = 'required' | 'optional' | 'ignored'; @@ -457,7 +458,7 @@ export interface RenovateStringOption extends RenovateOptionBase { } export interface RenovateObjectOption extends RenovateOptionBase { - default?: any | null; + default?: any; additionalProperties?: Record<string, unknown> | boolean; mergeable?: boolean; type: 'object'; diff --git a/lib/config/validation.ts b/lib/config/validation.ts index 1d6c437636..b14ce73fa0 100644 --- a/lib/config/validation.ts +++ b/lib/config/validation.ts @@ -189,7 +189,6 @@ export async function validateConfig( optionParents[key] !== parentName ) { // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions const message = `${key} should only be configured within a "${optionParents[key]}" object. Was found in ${parentName}`; warnings.push({ topic: `${parentPath ? `${parentPath}.` : ''}${key}`, @@ -535,7 +534,7 @@ export async function validateConfig( key === 'matchCurrentValue') && // TODO: can be undefined ? #7154 !rulesRe.test(parentPath!) && // Inside a packageRule - (parentPath || !isPreset) // top level in a preset + (is.string(parentPath) || !isPreset) // top level in a preset ) { errors.push({ topic: 'Configuration Error', diff --git a/lib/logger/utils.spec.ts b/lib/logger/utils.spec.ts index ac944c5ad2..898cd8cd05 100644 --- a/lib/logger/utils.spec.ts +++ b/lib/logger/utils.spec.ts @@ -29,7 +29,6 @@ describe('logger/utils', () => { const mockExit = jest.spyOn(process, 'exit'); mockExit.mockImplementationOnce((number) => { // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions throw new Error(`process.exit: ${number}`); }); expect(() => { @@ -70,7 +69,7 @@ describe('logger/utils', () => { function prepareIssues<T extends z.ZodType>( schema: T, input: unknown - ): unknown | null { + ): unknown { const error = getError(schema, input); return error ? prepareZodIssues(error.format()) : null; } diff --git a/lib/modules/datasource/artifactory/index.ts b/lib/modules/datasource/artifactory/index.ts index 9492924be1..d4d8168948 100644 --- a/lib/modules/datasource/artifactory/index.ts +++ b/lib/modules/datasource/artifactory/index.ts @@ -25,7 +25,6 @@ export class ArtifactoryDatasource extends Datasource { namespace: `datasource-${datasource}`, key: ({ registryUrl, packageName }: GetReleasesConfig) => // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${registryUrl}:${packageName}`, }) async getReleases({ diff --git a/lib/modules/datasource/cdnjs/index.spec.ts b/lib/modules/datasource/cdnjs/index.spec.ts index 67b1945a07..c5d0f85eaa 100644 --- a/lib/modules/datasource/cdnjs/index.spec.ts +++ b/lib/modules/datasource/cdnjs/index.spec.ts @@ -7,8 +7,6 @@ import { CdnJsDatasource } from '.'; const baseUrl = 'https://api.cdnjs.com/'; const pathFor = (s: string): string => - // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `/libraries/${s.split('/').shift()}?fields=homepage,repository,assets`; describe('modules/datasource/cdnjs/index', () => { diff --git a/lib/modules/datasource/conan/index.ts b/lib/modules/datasource/conan/index.ts index 44493c1b00..511c9495de 100644 --- a/lib/modules/datasource/conan/index.ts +++ b/lib/modules/datasource/conan/index.ts @@ -102,7 +102,6 @@ export class ConanDatasource extends Datasource { namespace: `datasource-${datasource}`, key: ({ registryUrl, packageName }: GetReleasesConfig) => // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${registryUrl}:${packageName}`, }) async getReleases({ diff --git a/lib/modules/datasource/conda/index.ts b/lib/modules/datasource/conda/index.ts index e428a645cf..4d3a34a92c 100644 --- a/lib/modules/datasource/conda/index.ts +++ b/lib/modules/datasource/conda/index.ts @@ -27,7 +27,6 @@ export class CondaDatasource extends Datasource { namespace: `datasource-${datasource}`, key: ({ registryUrl, packageName }: GetReleasesConfig) => // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${registryUrl}:${packageName}`, }) async getReleases({ diff --git a/lib/modules/datasource/crate/index.ts b/lib/modules/datasource/crate/index.ts index 7fdcf58781..196d19e9d9 100644 --- a/lib/modules/datasource/crate/index.ts +++ b/lib/modules/datasource/crate/index.ts @@ -39,7 +39,6 @@ export class CrateDatasource extends Datasource { namespace: `datasource-${CrateDatasource.id}`, key: ({ registryUrl, packageName }: GetReleasesConfig) => // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${registryUrl}/${packageName}`, cacheable: ({ registryUrl }: GetReleasesConfig) => CrateDatasource.areReleasesCacheable(registryUrl), diff --git a/lib/modules/datasource/datasource.ts b/lib/modules/datasource/datasource.ts index a035be994a..0a427cefc6 100644 --- a/lib/modules/datasource/datasource.ts +++ b/lib/modules/datasource/datasource.ts @@ -33,7 +33,6 @@ export abstract class Datasource implements DatasourceApi { getDigest?(config: DigestConfig, newValue?: string): Promise<string | null>; - // eslint-disable-next-line @typescript-eslint/no-empty-function handleHttpErrors(err: HttpError): void {} protected handleGenericErrors(err: Error): never { diff --git a/lib/modules/datasource/deno/index.ts b/lib/modules/datasource/deno/index.ts index c0b63417fe..007d5ce83a 100644 --- a/lib/modules/datasource/deno/index.ts +++ b/lib/modules/datasource/deno/index.ts @@ -30,7 +30,6 @@ export class DenoDatasource extends Datasource { namespace: `datasource-${DenoDatasource.id}`, key: ({ packageName, registryUrl }: GetReleasesConfig) => // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${registryUrl}:${packageName}`, }) async getReleases({ diff --git a/lib/modules/datasource/docker/index.ts b/lib/modules/datasource/docker/index.ts index f5082fd06e..7e11c05064 100644 --- a/lib/modules/datasource/docker/index.ts +++ b/lib/modules/datasource/docker/index.ts @@ -713,7 +713,6 @@ export class DockerDatasource extends Datasource { ); logger.debug( // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `getDigest(${registryHost}, ${dockerRepository}, ${newValue})` ); const newTag = newValue ?? 'latest'; @@ -748,7 +747,7 @@ export class DockerDatasource extends Datasource { } if ( - architecture || + is.string(architecture) || (manifestResponse && !hasKey('docker-content-digest', manifestResponse.headers)) ) { diff --git a/lib/modules/datasource/galaxy-collection/index.ts b/lib/modules/datasource/galaxy-collection/index.ts index 2e71f35433..a5d156af8c 100644 --- a/lib/modules/datasource/galaxy-collection/index.ts +++ b/lib/modules/datasource/galaxy-collection/index.ts @@ -36,7 +36,6 @@ export class GalaxyCollectionDatasource extends Datasource { const [namespace, projectName] = packageName.split('.'); // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions const baseUrl = `${registryUrl}api/v2/collections/${namespace}/${projectName}/`; let baseUrlResponse: HttpResponse<BaseProjectResult>; diff --git a/lib/modules/datasource/galaxy/index.ts b/lib/modules/datasource/galaxy/index.ts index 2040e95698..c7610403d3 100644 --- a/lib/modules/datasource/galaxy/index.ts +++ b/lib/modules/datasource/galaxy/index.ts @@ -33,9 +33,7 @@ export class GalaxyDatasource extends Datasource { const projectName = lookUp[1]; // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions const galaxyAPIUrl = `${registryUrl}api/v1/roles/?owner__username=${userName}&name=${projectName}`; - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions const galaxyProjectUrl = `${registryUrl}${userName}/${projectName}`; let raw: HttpResponse<GalaxyResult> | null = null; diff --git a/lib/modules/datasource/gitlab-packages/index.ts b/lib/modules/datasource/gitlab-packages/index.ts index dd862e437b..8dc3bda082 100644 --- a/lib/modules/datasource/gitlab-packages/index.ts +++ b/lib/modules/datasource/gitlab-packages/index.ts @@ -44,7 +44,6 @@ export class GitlabPackagesDatasource extends Datasource { namespace: `datasource-${datasource}`, key: ({ registryUrl, packageName }: GetReleasesConfig) => // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${registryUrl}-${packageName}`, }) async getReleases({ diff --git a/lib/modules/datasource/gitlab-releases/index.ts b/lib/modules/datasource/gitlab-releases/index.ts index 37182f47a3..c61aec4952 100644 --- a/lib/modules/datasource/gitlab-releases/index.ts +++ b/lib/modules/datasource/gitlab-releases/index.ts @@ -20,7 +20,6 @@ export class GitlabReleasesDatasource extends Datasource { namespace: `datasource-${GitlabReleasesDatasource.id}`, key: ({ registryUrl, packageName }: GetReleasesConfig) => // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${registryUrl}/${packageName}`, }) async getReleases({ diff --git a/lib/modules/datasource/go/base.ts b/lib/modules/datasource/go/base.ts index b1cf3948c7..98a51cdbe1 100644 --- a/lib/modules/datasource/go/base.ts +++ b/lib/modules/datasource/go/base.ts @@ -1,5 +1,4 @@ // TODO: types (#7154) -/* eslint-disable @typescript-eslint/restrict-template-expressions */ import URL from 'node:url'; import { logger } from '../../../logger'; import { detectPlatform } from '../../../util/common'; diff --git a/lib/modules/datasource/go/index.ts b/lib/modules/datasource/go/index.ts index 5723300aee..d326ed7085 100644 --- a/lib/modules/datasource/go/index.ts +++ b/lib/modules/datasource/go/index.ts @@ -39,7 +39,6 @@ export class GoDatasource extends Datasource { @cache({ namespace: `datasource-${GoDatasource.id}`, // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions key: ({ packageName }: Partial<DigestConfig>) => `${packageName}-digest`, }) getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> { diff --git a/lib/modules/datasource/go/releases-goproxy.ts b/lib/modules/datasource/go/releases-goproxy.ts index 74afa809d1..7439267c0c 100644 --- a/lib/modules/datasource/go/releases-goproxy.ts +++ b/lib/modules/datasource/go/releases-goproxy.ts @@ -311,7 +311,6 @@ export class GoProxyDatasource extends Datasource { const goproxy = process.env.GOPROXY; const noproxy = GoProxyDatasource.parseNoproxy(); // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions return `${packageName}@@${goproxy}@@${noproxy?.toString()}`; } } diff --git a/lib/modules/datasource/gradle-version/index.ts b/lib/modules/datasource/gradle-version/index.ts index c88dcc7b6f..eaa44bdc3d 100644 --- a/lib/modules/datasource/gradle-version/index.ts +++ b/lib/modules/datasource/gradle-version/index.ts @@ -27,7 +27,6 @@ export class GradleVersionDatasource extends Datasource { @cache({ namespace: `datasource-${GradleVersionDatasource.id}`, // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions key: ({ registryUrl }: GetReleasesConfig) => `${registryUrl}`, }) async getReleases({ diff --git a/lib/modules/datasource/maven/util.ts b/lib/modules/datasource/maven/util.ts index 65f6ed216d..51a4acd699 100644 --- a/lib/modules/datasource/maven/util.ts +++ b/lib/modules/datasource/maven/util.ts @@ -362,13 +362,11 @@ export async function createUrlForDependencyPom( // If we were able to resolve the version, use that, otherwise fall back to using -SNAPSHOT if (fullVersion !== null) { // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions return `${version}/${dependency.name}-${fullVersion}.pom`; } } // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions return `${version}/${dependency.name}-${version}.pom`; } diff --git a/lib/modules/datasource/node-version/index.ts b/lib/modules/datasource/node-version/index.ts index 34f0c1bbbb..f2b6e08e93 100644 --- a/lib/modules/datasource/node-version/index.ts +++ b/lib/modules/datasource/node-version/index.ts @@ -24,7 +24,6 @@ export class NodeVersionDatasource extends Datasource { @cache({ namespace: `datasource-${datasource}`, // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions key: ({ registryUrl }: GetReleasesConfig) => `${registryUrl}`, }) async getReleases({ diff --git a/lib/modules/datasource/npm/npmrc.ts b/lib/modules/datasource/npm/npmrc.ts index fe1ea34446..26bc58fbf9 100644 --- a/lib/modules/datasource/npm/npmrc.ts +++ b/lib/modules/datasource/npm/npmrc.ts @@ -136,7 +136,7 @@ export function setNpmrc(input?: string): void { if ( !exposeAllEnv && key.endsWith('registry') && - val && + is.string(val) && val.includes('localhost') ) { logger.debug( diff --git a/lib/modules/datasource/nuget/v2.ts b/lib/modules/datasource/nuget/v2.ts index a8000f9186..8201e18fc6 100644 --- a/lib/modules/datasource/nuget/v2.ts +++ b/lib/modules/datasource/nuget/v2.ts @@ -34,7 +34,6 @@ export async function getReleases( const releaseTimestamp = getPkgProp(pkgInfo, 'Published'); dep.releases.push({ // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions version: removeBuildMeta(`${version}`), releaseTimestamp, }); diff --git a/lib/modules/datasource/nuget/v3.ts b/lib/modules/datasource/nuget/v3.ts index 42b4b8e170..957177802a 100644 --- a/lib/modules/datasource/nuget/v3.ts +++ b/lib/modules/datasource/nuget/v3.ts @@ -169,7 +169,6 @@ export async function getReleases( packageBaseAddress )}${pkgName.toLowerCase()}/${ // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions latestStable }/${pkgName.toLowerCase()}.nuspec`; const metaresult = await http.get(nuspecUrl); diff --git a/lib/modules/datasource/pod/index.ts b/lib/modules/datasource/pod/index.ts index 189eb8c0bf..33e00a0baf 100644 --- a/lib/modules/datasource/pod/index.ts +++ b/lib/modules/datasource/pod/index.ts @@ -208,7 +208,6 @@ export class PodDatasource extends Datasource { namespace: `datasource-${PodDatasource.id}`, key: ({ packageName, registryUrl }: GetReleasesConfig) => // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${registryUrl}:${packageName}`, }) async getReleases({ diff --git a/lib/modules/datasource/puppet-forge/index.ts b/lib/modules/datasource/puppet-forge/index.ts index 8c2b4ad289..64a06296d4 100644 --- a/lib/modules/datasource/puppet-forge/index.ts +++ b/lib/modules/datasource/puppet-forge/index.ts @@ -19,7 +19,6 @@ export class PuppetForgeDatasource extends Datasource { // https://forgeapi.puppet.com const moduleSlug = packageName.replace('/', '-'); // TODO: types (#7154) - /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */ const url = `${registryUrl}/v3/modules/${moduleSlug}?exclude_fields=current_release`; let module: PuppetModule; diff --git a/lib/modules/datasource/ruby-version/index.ts b/lib/modules/datasource/ruby-version/index.ts index d403681cd9..7fea76ed8b 100644 --- a/lib/modules/datasource/ruby-version/index.ts +++ b/lib/modules/datasource/ruby-version/index.ts @@ -30,7 +30,6 @@ export class RubyVersionDatasource extends Datasource { releases: [], }; // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions const rubyVersionsUrl = `${registryUrl}en/downloads/releases/`; try { const response = await this.http.get(rubyVersionsUrl); diff --git a/lib/modules/datasource/terraform-provider/index.ts b/lib/modules/datasource/terraform-provider/index.ts index a9b784b7fe..24d1d30405 100644 --- a/lib/modules/datasource/terraform-provider/index.ts +++ b/lib/modules/datasource/terraform-provider/index.ts @@ -1,5 +1,4 @@ // TODO: types (#7154) -/* eslint-disable @typescript-eslint/restrict-template-expressions */ import is from '@sindresorhus/is'; import { logger } from '../../../logger'; import { ExternalHostError } from '../../../types/errors/external-host-error'; diff --git a/lib/modules/manager/composer/range.ts b/lib/modules/manager/composer/range.ts index a1faa3f6f1..98741ad621 100644 --- a/lib/modules/manager/composer/range.ts +++ b/lib/modules/manager/composer/range.ts @@ -6,7 +6,7 @@ import type { ComposerManagerData } from './types'; export function getRangeStrategy(config: RangeConfig): RangeStrategy { const { managerData = {}, currentValue, rangeStrategy } = config; const { composerJsonType } = managerData as ComposerManagerData; - const isComplexRange = currentValue?.includes(' || '); + const isComplexRange = currentValue?.includes(' || ') ?? false; if (rangeStrategy === 'bump' && isComplexRange) { logger.debug( { currentValue }, diff --git a/lib/modules/manager/composer/utils.ts b/lib/modules/manager/composer/utils.ts index 5a73be6c91..536bf472ae 100644 --- a/lib/modules/manager/composer/utils.ts +++ b/lib/modules/manager/composer/utils.ts @@ -1,5 +1,4 @@ // TODO: types (#7154) -/* eslint-disable @typescript-eslint/restrict-template-expressions */ import { quote } from 'shlex'; import { GlobalConfig } from '../../../config/global'; import { logger } from '../../../logger'; diff --git a/lib/modules/manager/dockerfile/extract.ts b/lib/modules/manager/dockerfile/extract.ts index 8475b8e1df..b6f0fe8a22 100644 --- a/lib/modules/manager/dockerfile/extract.ts +++ b/lib/modules/manager/dockerfile/extract.ts @@ -61,8 +61,10 @@ function processDepForAutoReplace( for (const lineNumberRange of lineNumberRanges) { for (const lineNumber of lineNumberRange) { if ( - (dep.currentValue && lines[lineNumber].includes(dep.currentValue)) || - (dep.currentDigest && lines[lineNumber].includes(dep.currentDigest)) + (is.string(dep.currentValue) && + lines[lineNumber].includes(dep.currentValue)) || + (is.string(dep.currentDigest) && + lines[lineNumber].includes(dep.currentDigest)) ) { lineNumberRangesToReplace.push(lineNumberRange); } diff --git a/lib/modules/manager/git-submodules/artifacts.ts b/lib/modules/manager/git-submodules/artifacts.ts index 4f960c128c..cbf2841415 100644 --- a/lib/modules/manager/git-submodules/artifacts.ts +++ b/lib/modules/manager/git-submodules/artifacts.ts @@ -7,7 +7,6 @@ export default function updateArtifacts({ const res: UpdateArtifactsResult[] = []; updatedDeps.forEach((dep) => { // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions logger.info(`Updating submodule ${dep.depName}`); res.push({ file: { type: 'addition', path: dep.depName!, contents: '' }, diff --git a/lib/modules/manager/gitlabci/utils.ts b/lib/modules/manager/gitlabci/utils.ts index 13904a8d32..9172b29fc9 100644 --- a/lib/modules/manager/gitlabci/utils.ts +++ b/lib/modules/manager/gitlabci/utils.ts @@ -32,7 +32,6 @@ export function getGitlabDep( if (match?.groups) { const dep = { ...getDep(match.groups.depName), replaceString: imageName }; // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions dep.autoReplaceStringTemplate = `${match.groups.prefix}${dep.autoReplaceStringTemplate}`; return dep; } diff --git a/lib/modules/manager/gomod/artifacts.ts b/lib/modules/manager/gomod/artifacts.ts index 72ecb0f158..2eb6a55cc7 100644 --- a/lib/modules/manager/gomod/artifacts.ts +++ b/lib/modules/manager/gomod/artifacts.ts @@ -264,9 +264,9 @@ export async function updateArtifacts({ const isGoModTidyRequired = !mustSkipGoModTidy && - (config.postUpdateOptions?.includes('gomodTidy') || - config.postUpdateOptions?.includes('gomodTidy1.17') || - config.postUpdateOptions?.includes('gomodTidyE') || + (config.postUpdateOptions?.includes('gomodTidy') === true || + config.postUpdateOptions?.includes('gomodTidy1.17') === true || + config.postUpdateOptions?.includes('gomodTidyE') === true || (config.updateType === 'major' && isImportPathUpdateRequired)); if (isGoModTidyRequired) { args = 'mod tidy' + tidyOpts; diff --git a/lib/modules/manager/gomod/update.ts b/lib/modules/manager/gomod/update.ts index d2839abce3..f4ef9d374d 100644 --- a/lib/modules/manager/gomod/update.ts +++ b/lib/modules/manager/gomod/update.ts @@ -1,5 +1,4 @@ // TODO: types (#7154) -/* eslint-disable @typescript-eslint/restrict-template-expressions */ import { logger } from '../../../logger'; import { newlineRegex, regEx } from '../../../util/regex'; import type { UpdateDependencyConfig } from '../types'; diff --git a/lib/modules/manager/gradle/artifacts.ts b/lib/modules/manager/gradle/artifacts.ts index e3db9b645b..6337800cd4 100644 --- a/lib/modules/manager/gradle/artifacts.ts +++ b/lib/modules/manager/gradle/artifacts.ts @@ -149,7 +149,7 @@ export async function updateArtifacts({ .join(' ')}`; if ( - config.isLockFileMaintenance || + config.isLockFileMaintenance === true || !updatedDeps.length || isGcvPropsFile(packageFileName) ) { diff --git a/lib/modules/manager/gradle/update.ts b/lib/modules/manager/gradle/update.ts index 36ab93dc6b..27736ce1c6 100644 --- a/lib/modules/manager/gradle/update.ts +++ b/lib/modules/manager/gradle/update.ts @@ -25,7 +25,6 @@ export function updateDependency({ } if (version === currentValue || upgrade.groupName) { // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions return `${leftPart}${newValue}${restPart}`; } logger.debug({ depName, version, currentValue, newValue }, 'Unknown value'); diff --git a/lib/modules/manager/homebrew/extract.ts b/lib/modules/manager/homebrew/extract.ts index 2487058913..fb93484ba7 100644 --- a/lib/modules/manager/homebrew/extract.ts +++ b/lib/modules/manager/homebrew/extract.ts @@ -167,7 +167,6 @@ export function extractPackageFile(content: string): PackageFileContent | null { } const dep: PackageDependency = { // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions depName: `${ownerName}/${repoName}`, managerData: { ownerName, repoName, sha256, url }, currentValue, diff --git a/lib/modules/manager/homebrew/update.ts b/lib/modules/manager/homebrew/update.ts index aa71dde557..a43dd4f845 100644 --- a/lib/modules/manager/homebrew/update.ts +++ b/lib/modules/manager/homebrew/update.ts @@ -1,5 +1,4 @@ // TODO: types (#7154) -/* eslint-disable @typescript-eslint/restrict-template-expressions */ import hasha from 'hasha'; import semver from 'semver'; import { logger } from '../../../logger'; diff --git a/lib/modules/manager/kustomize/extract.ts b/lib/modules/manager/kustomize/extract.ts index d1708873e2..079c748634 100644 --- a/lib/modules/manager/kustomize/extract.ts +++ b/lib/modules/manager/kustomize/extract.ts @@ -111,7 +111,6 @@ export function extractImage(image: Image): PackageDependency | null { } // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions const dep = splitImageParts(`${depName}:${newTag}`); return { ...dep, diff --git a/lib/modules/manager/npm/extract/index.ts b/lib/modules/manager/npm/extract/index.ts index bc873eb440..963a085d6d 100644 --- a/lib/modules/manager/npm/extract/index.ts +++ b/lib/modules/manager/npm/extract/index.ts @@ -465,10 +465,10 @@ export async function extractPackageFile( logger.debug('Package file has no deps'); if ( !( - packageJsonName || - packageFileVersion || - npmrc || - lernaJsonFile || + !!packageJsonName || + !!packageFileVersion || + !!npmrc || + !!lernaJsonFile || workspacesPackages ) ) { diff --git a/lib/modules/manager/npm/extract/locked-versions.ts b/lib/modules/manager/npm/extract/locked-versions.ts index 676dd13ea2..6d86c69fa3 100644 --- a/lib/modules/manager/npm/extract/locked-versions.ts +++ b/lib/modules/manager/npm/extract/locked-versions.ts @@ -46,7 +46,6 @@ export async function getLockedVersions( dep.lockedVersion = lockFileCache[yarnLock].lockedVersions?.[ // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${dep.depName}@${dep.currentValue}` ]; if ( diff --git a/lib/modules/manager/npm/post-update/index.ts b/lib/modules/manager/npm/post-update/index.ts index 5fa20722a8..3aeb61ed5d 100644 --- a/lib/modules/manager/npm/post-update/index.ts +++ b/lib/modules/manager/npm/post-update/index.ts @@ -1,5 +1,4 @@ // TODO: types (#7154) -/* eslint-disable @typescript-eslint/restrict-template-expressions */ import is from '@sindresorhus/is'; import deepmerge from 'deepmerge'; import detectIndent from 'detect-indent'; diff --git a/lib/modules/manager/npm/post-update/lerna.ts b/lib/modules/manager/npm/post-update/lerna.ts index 4d07a60421..8c9f6c364a 100644 --- a/lib/modules/manager/npm/post-update/lerna.ts +++ b/lib/modules/manager/npm/post-update/lerna.ts @@ -31,7 +31,6 @@ export function getLernaConstraint( if (!constraint || !semver.validRange(constraint)) { logger.warn( // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Could not detect lerna version in ${lernaPackageFile.packageFile}, using 'latest'` ); return null; @@ -120,7 +119,8 @@ export async function generateLockFiles( getLernaConstraint(lernaPackageFile, await lazyPgkJson.getValue()); if ( !is.string(lernaConstraint) || - (semver.valid(lernaConstraint) && semver.gte(lernaConstraint, '7.0.0')) || + (semver.valid(lernaConstraint) && + semver.gte(lernaConstraint, '7.0.0')) === true || (semver.validRange(lernaConstraint) && (semver.satisfies('7.0.0', lernaConstraint) || semver.satisfies('7.999.999', lernaConstraint))) diff --git a/lib/modules/manager/npm/post-update/npm.ts b/lib/modules/manager/npm/post-update/npm.ts index 0c19bb04a8..aff424ee92 100644 --- a/lib/modules/manager/npm/post-update/npm.ts +++ b/lib/modules/manager/npm/post-update/npm.ts @@ -51,7 +51,10 @@ export async function generateLockFile( }; const commands: string[] = []; let cmdOptions = ''; - if (postUpdateOptions?.includes('npmDedupe') || skipInstalls === false) { + if ( + postUpdateOptions?.includes('npmDedupe') === true || + skipInstalls === false + ) { logger.debug('Performing node_modules install'); cmdOptions += '--no-audit'; } else { diff --git a/lib/modules/manager/npm/post-update/rules.ts b/lib/modules/manager/npm/post-update/rules.ts index dd905086d2..dc01a820da 100644 --- a/lib/modules/manager/npm/post-update/rules.ts +++ b/lib/modules/manager/npm/post-update/rules.ts @@ -24,7 +24,6 @@ export function processHostRules(): HostRulesResult { is.string(uri) && validateUrl(uri) ? uri.replace(regEx(/^https?:/), '') : // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `//${uri}/`; if (hostRule.token) { const key = hostRule.authType === 'Basic' ? '_auth' : '_authToken'; diff --git a/lib/modules/manager/npm/update/dependency/index.ts b/lib/modules/manager/npm/update/dependency/index.ts index 72437a726e..01448995db 100644 --- a/lib/modules/manager/npm/update/dependency/index.ts +++ b/lib/modules/manager/npm/update/dependency/index.ts @@ -131,11 +131,9 @@ export function updateDependency({ } if (upgrade.npmPackageAlias) { // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions newValue = `npm:${upgrade.packageName}@${newValue}`; } // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions logger.debug(`npm.updateDependency(): ${depType}.${depName} = ${newValue}`); try { const parsedContents: NpmPackage = JSON.parse(fileContent); @@ -145,7 +143,6 @@ export function updateDependency({ if (depType === 'packageManager') { oldVersion = parsedContents[depType]; // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions newValue = `${depName}@${newValue}`; } else if (isOverrideObject(upgrade)) { overrideDepParents = managerData?.parents; @@ -255,7 +252,6 @@ export function updateDependency({ depName, depKey, // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${depName}@${newValue}` ); } diff --git a/lib/modules/manager/npm/update/locked-dependency/package-lock/index.ts b/lib/modules/manager/npm/update/locked-dependency/package-lock/index.ts index a658b618b2..9e5afe5a64 100644 --- a/lib/modules/manager/npm/update/locked-dependency/package-lock/index.ts +++ b/lib/modules/manager/npm/update/locked-dependency/package-lock/index.ts @@ -235,7 +235,6 @@ export async function updateLockedDependency( if (!parentUpdateResult.files) { logger.debug( // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Update of ${depName} to ${newVersion} impossible due to failed update of parent ${parentUpdate.depName} to ${parentUpdate.newVersion}` ); return { status: 'update-failed' }; diff --git a/lib/modules/manager/poetry/extract.ts b/lib/modules/manager/poetry/extract.ts index 06db8fc311..98fe897162 100644 --- a/lib/modules/manager/poetry/extract.ts +++ b/lib/modules/manager/poetry/extract.ts @@ -74,7 +74,7 @@ function extractFromSection( if (version) { currentValue = version; nestedVersion = true; - if (path || git) { + if (!!path || git) { skipReason = path ? 'path-dependency' : 'git-dependency'; } } else if (path) { diff --git a/lib/modules/platform/azure/index.ts b/lib/modules/platform/azure/index.ts index c4d3946c33..6080912f68 100644 --- a/lib/modules/platform/azure/index.ts +++ b/lib/modules/platform/azure/index.ts @@ -113,8 +113,6 @@ export async function getRepos(): Promise<string[]> { logger.debug('Autodiscovering Azure DevOps repositories'); const azureApiGit = await azureApi.gitApi(); const repos = await azureApiGit.getRepositories(); - // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions return repos.map((repo) => `${repo.project?.name}/${repo.name}`); } @@ -163,7 +161,7 @@ export async function getJsonFile( fileName: string, repoName?: string, branchOrTag?: string -): Promise<any | null> { +): Promise<any> { const raw = await getRawFile(fileName, repoName, branchOrTag); return raw ? JSON5.parse(raw) : null; } @@ -578,7 +576,7 @@ export async function ensureComment({ threads.forEach((thread) => { const firstCommentContent = thread.comments?.[0].content; if ( - (topic && firstCommentContent?.startsWith(header)) || + (topic && firstCommentContent?.startsWith(header)) === true || (!topic && firstCommentContent === body) ) { threadIdFound = thread.id; @@ -728,7 +726,6 @@ export async function mergePr({ PullRequestStatus[PullRequestStatus.Completed] }) with lastMergeSourceCommit ${ // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions pr.lastMergeSourceCommit?.commitId } using mergeStrategy ${mergeStrategy} (${ GitPullRequestMergeStrategy[mergeStrategy] diff --git a/lib/modules/platform/bitbucket-server/index.ts b/lib/modules/platform/bitbucket-server/index.ts index ce83003388..f82d891865 100644 --- a/lib/modules/platform/bitbucket-server/index.ts +++ b/lib/modules/platform/bitbucket-server/index.ts @@ -144,7 +144,7 @@ export async function getJsonFile( fileName: string, repoName?: string, branchOrTag?: string -): Promise<any | null> { +): Promise<any> { // TODO #7154 const raw = (await getRawFile(fileName, repoName, branchOrTag)) as string; return JSON5.parse(raw); diff --git a/lib/modules/platform/bitbucket-server/utils.ts b/lib/modules/platform/bitbucket-server/utils.ts index a54e573b54..8d793d93e2 100644 --- a/lib/modules/platform/bitbucket-server/utils.ts +++ b/lib/modules/platform/bitbucket-server/utils.ts @@ -158,11 +158,9 @@ function generateUrlFromEndpoint( const generatedUrl = git.getUrl({ protocol: url.protocol as GitProtocol, // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions auth: `${opts.username}:${opts.password}`, host: `${url.host}${url.pathname}${ - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - url.pathname!.endsWith('/') ? '' : /* istanbul ignore next */ '/' + url.pathname.endsWith('/') ? '' : /* istanbul ignore next */ '/' }scm`, repository, }); diff --git a/lib/modules/platform/bitbucket/index.ts b/lib/modules/platform/bitbucket/index.ts index 6d7271cda3..f57c625b02 100644 --- a/lib/modules/platform/bitbucket/index.ts +++ b/lib/modules/platform/bitbucket/index.ts @@ -156,7 +156,7 @@ export async function getJsonFile( fileName: string, repoName?: string, branchOrTag?: string -): Promise<any | null> { +): Promise<any> { // TODO #7154 const raw = (await getRawFile(fileName, repoName, branchOrTag)) as string; return JSON5.parse(raw); @@ -297,8 +297,6 @@ export async function findPr({ prTitle, state = 'all', }: FindPRConfig): Promise<Pr | null> { - // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions logger.debug(`findPr(${branchName}, ${prTitle}, ${state})`); const prList = await getPrList(); const pr = prList.find( @@ -491,8 +489,6 @@ export async function setBranchStatus({ }; await bitbucketHttp.postJson( - // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `/2.0/repositories/${config.repository}/commit/${sha}/statuses/build`, { body } ); @@ -827,7 +823,6 @@ async function isAccountMemberOfWorkspace( if (err.statusCode === 404) { logger.debug( { err }, - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `User ${reviewer.display_name} is not a member of the workspace ${workspace}. Will be removed from the PR` ); @@ -994,8 +989,6 @@ export async function mergePr({ id: prNo, strategy: mergeStrategy, }: MergePRConfig): Promise<boolean> { - // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions logger.debug(`mergePr(${prNo}, ${branchName}, ${mergeStrategy})`); // Bitbucket Cloud does not support a rebase-alike; https://jira.atlassian.com/browse/BCLOUD-16610 diff --git a/lib/modules/platform/codecommit/index.ts b/lib/modules/platform/codecommit/index.ts index 6ce173083c..dbc6b4109a 100644 --- a/lib/modules/platform/codecommit/index.ts +++ b/lib/modules/platform/codecommit/index.ts @@ -327,7 +327,7 @@ export async function getJsonFile( fileName: string, repoName?: string, branchOrTag?: string -): Promise<any | null> { +): Promise<any> { const raw = await getRawFile(fileName, repoName, branchOrTag); return raw ? JSON5.parse(raw) : null; } @@ -631,7 +631,7 @@ export async function ensureComment({ } const firstCommentContent = commentObj.comments[0].content; if ( - (topic && firstCommentContent?.startsWith(header)) || + (topic && firstCommentContent?.startsWith(header)) === true || (!topic && firstCommentContent === body) ) { commentId = commentObj.comments[0].commentId; @@ -711,7 +711,8 @@ export async function ensureCommentRemoval( for (const comment of commentObj.comments) { if ( (removeConfig.type === 'by-topic' && - comment.content?.startsWith(`### ${removeConfig.topic}\n\n`)) || + comment.content?.startsWith(`### ${removeConfig.topic}\n\n`)) === + true || (removeConfig.type === 'by-content' && removeConfig.content === comment.content?.trim()) ) { diff --git a/lib/modules/platform/gitea/index.spec.ts b/lib/modules/platform/gitea/index.spec.ts index cb010cd765..ce8604ed61 100644 --- a/lib/modules/platform/gitea/index.spec.ts +++ b/lib/modules/platform/gitea/index.spec.ts @@ -504,8 +504,6 @@ describe('modules/platform/gitea/index', () => { }; await gitea.initRepo(repoCfg); - // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions const url = new URL(`${mockRepo.clone_url}`); url.username = token; expect(gitvcs.initRepo).toHaveBeenCalledWith( @@ -531,8 +529,6 @@ describe('modules/platform/gitea/index', () => { }; await gitea.initRepo(repoCfg); - // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions const url = new URL(`${mockRepo.clone_url}`); url.username = token; expect(gitvcs.initRepo).toHaveBeenCalledWith( diff --git a/lib/modules/platform/gitea/index.ts b/lib/modules/platform/gitea/index.ts index 7bd40f4dca..a07fccbbed 100644 --- a/lib/modules/platform/gitea/index.ts +++ b/lib/modules/platform/gitea/index.ts @@ -254,7 +254,7 @@ const platform: Platform = { fileName: string, repoName?: string, branchOrTag?: string - ): Promise<any | null> { + ): Promise<any> { // TODO #7154 const raw = (await platform.getRawFile(fileName, repoName, branchOrTag))!; return JSON5.parse(raw); diff --git a/lib/modules/platform/github/common.ts b/lib/modules/platform/github/common.ts index 170cc74957..fc6a9d0f59 100644 --- a/lib/modules/platform/github/common.ts +++ b/lib/modules/platform/github/common.ts @@ -33,7 +33,7 @@ export function coerceRestPr(pr: GhRestPr): GhPr { result.labels = pr.labels.map(({ name }) => name); } - if (pr.assignee || is.nonEmptyArray(pr.assignees)) { + if (!!pr.assignee || is.nonEmptyArray(pr.assignees)) { result.hasAssignees = true; } diff --git a/lib/modules/platform/github/index.ts b/lib/modules/platform/github/index.ts index 4a6a13d89a..29db5631d9 100644 --- a/lib/modules/platform/github/index.ts +++ b/lib/modules/platform/github/index.ts @@ -1,5 +1,3 @@ -// TODO: types (#7154) -/* eslint-disable @typescript-eslint/restrict-template-expressions */ import URL from 'node:url'; import { setTimeout } from 'timers/promises'; import is from '@sindresorhus/is'; @@ -259,7 +257,7 @@ export async function getJsonFile( fileName: string, repoName?: string, branchOrTag?: string -): Promise<any | null> { +): Promise<any> { // TODO #7154 const raw = (await getRawFile(fileName, repoName, branchOrTag)) as string; return JSON5.parse(raw); diff --git a/lib/modules/platform/gitlab/index.ts b/lib/modules/platform/gitlab/index.ts index 58614913f7..ae5ffaab11 100644 --- a/lib/modules/platform/gitlab/index.ts +++ b/lib/modules/platform/gitlab/index.ts @@ -201,7 +201,7 @@ export async function getJsonFile( fileName: string, repoName?: string, branchOrTag?: string -): Promise<any | null> { +): Promise<any> { // TODO #7154 const raw = (await getRawFile(fileName, repoName, branchOrTag)) as string; return JSON5.parse(raw); @@ -227,7 +227,7 @@ function getRepoUrl( if ( gitUrl === 'endpoint' || - process.env.GITLAB_IGNORE_REPO_URL || + is.nonEmptyString(process.env.GITLAB_IGNORE_REPO_URL) || res.body.http_url_to_repo === null ) { if (res.body.http_url_to_repo === null) { diff --git a/lib/modules/platform/types.ts b/lib/modules/platform/types.ts index 0316f8ff03..47deb04e5f 100644 --- a/lib/modules/platform/types.ts +++ b/lib/modules/platform/types.ts @@ -184,7 +184,7 @@ export interface Platform { fileName: string, repoName?: string, branchOrTag?: string - ): Promise<any | null>; + ): Promise<any>; initRepo(config: RepoParams): Promise<RepoResult>; getPrList(): Promise<Pr[]>; ensureIssueClosing(title: string): Promise<void>; diff --git a/lib/modules/versioning/composer/index.ts b/lib/modules/versioning/composer/index.ts index 9a6a2ef905..c411c97b52 100644 --- a/lib/modules/versioning/composer/index.ts +++ b/lib/modules/versioning/composer/index.ts @@ -1,3 +1,4 @@ +import is from '@sindresorhus/is'; import semver from 'semver'; import { parseRange } from 'semver-utils'; import { logger } from '../../../logger'; @@ -232,7 +233,10 @@ function getNewValue({ const operator = currentValue.substring(0, 1); if (rangeStrategy === 'bump') { newValue = `${operator}${newVersion}`; - } else if ((currentMajor && toMajor > currentMajor) || !toMinor) { + } else if ( + (is.number(currentMajor) && toMajor > currentMajor) || + !toMinor + ) { // handle ~4.1 case newValue = `${operator}${toMajor}.0`; } else { diff --git a/lib/modules/versioning/conan/range.ts b/lib/modules/versioning/conan/range.ts index 4203fcc47a..f559c17936 100644 --- a/lib/modules/versioning/conan/range.ts +++ b/lib/modules/versioning/conan/range.ts @@ -1,5 +1,3 @@ -// TODO: types (#7154) -/* eslint-disable @typescript-eslint/restrict-template-expressions */ import * as semver from 'semver'; import { SemVer, parseRange } from 'semver-utils'; import { logger } from '../../../logger'; @@ -144,7 +142,7 @@ export function replaceRange({ } if (element.operator === '<=') { let res; - if (element.patch || suffix.length) { + if (!!element.patch || suffix.length) { res = `<=${newVersion}`; } else if (element.minor) { res = `<=${toVersionMajor}.${toVersionMinor}`; diff --git a/lib/modules/versioning/maven/compare.ts b/lib/modules/versioning/maven/compare.ts index f894c8e35c..9ede3007e1 100644 --- a/lib/modules/versioning/maven/compare.ts +++ b/lib/modules/versioning/maven/compare.ts @@ -430,7 +430,7 @@ function rangeToStr(fullRange: Range[] | null): string | null { return null; } - const valToStr = (val: string | null): string => (val === null ? '' : val); + const valToStr = (val: string | null): string => val ?? ''; if (fullRange.length === 1) { const { leftBracket, rightBracket, leftValue, rightValue } = fullRange[0]; diff --git a/lib/modules/versioning/node/index.spec.ts b/lib/modules/versioning/node/index.spec.ts index 74507fa954..c0f7040c6b 100644 --- a/lib/modules/versioning/node/index.spec.ts +++ b/lib/modules/versioning/node/index.spec.ts @@ -53,7 +53,7 @@ describe('modules/versioning/node/index', () => { ${'10.0.0a'} | ${t1} | ${false} ${'9.0.0'} | ${t1} | ${false} `('isStable("$version") === $expected', ({ version, time, expected }) => { - DateTime.local = (...args: (string | any)[]) => + DateTime.local = (...args: any[]) => args.length ? dtLocal.apply(DateTime, args) : time; expect(nodever.isStable(version as string)).toBe(expected); }); diff --git a/lib/modules/versioning/npm/range.ts b/lib/modules/versioning/npm/range.ts index f8c37b0157..ed6dd7cd0c 100644 --- a/lib/modules/versioning/npm/range.ts +++ b/lib/modules/versioning/npm/range.ts @@ -203,7 +203,7 @@ export function getNewValue({ } if (element.operator === '<=') { let res; - if (element.patch || suffix.length) { + if (!!element.patch || suffix.length) { res = `<=${newVersion}`; } else if (element.minor) { res = `<=${toVersionMajor}.${toVersionMinor}`; diff --git a/lib/modules/versioning/poetry/index.ts b/lib/modules/versioning/poetry/index.ts index a4f50f4210..b7e6d84175 100644 --- a/lib/modules/versioning/poetry/index.ts +++ b/lib/modules/versioning/poetry/index.ts @@ -190,7 +190,7 @@ function getNewValue({ // Explicitly check whether this is a fully-qualified version if ( - (VERSION_PATTERN.exec(newVersion)?.groups?.release || '').split('.') + (VERSION_PATTERN.exec(newVersion)?.groups?.release ?? '').split('.') .length !== 3 ) { logger.debug( diff --git a/lib/modules/versioning/poetry/transform.ts b/lib/modules/versioning/poetry/transform.ts index a411ffd8d7..0eb5098bda 100644 --- a/lib/modules/versioning/poetry/transform.ts +++ b/lib/modules/versioning/poetry/transform.ts @@ -20,7 +20,7 @@ function parseLetterTag(letter?: string, number?: string): LetterTag | null { }; return { letter: spellings[letter] || letter, - number: number === undefined ? '0' : number, + number: number ?? '0', }; } if (letter === undefined && number !== undefined) { diff --git a/lib/types/vulnerability-alert.ts b/lib/types/vulnerability-alert.ts index be512c37ae..727f818f87 100644 --- a/lib/types/vulnerability-alert.ts +++ b/lib/types/vulnerability-alert.ts @@ -1,4 +1,5 @@ export interface VulnerabilityPackage { + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents ecosystem: 'MAVEN' | 'NPM' | 'NUGET' | 'PIP' | 'RUBYGEMS' | string; name: string; } @@ -11,6 +12,7 @@ export interface SecurityAdvisory { description?: string; identifiers?: { type: string; value: string }[]; references: { url: string }[]; + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents severity: 'HIGH' | 'MODERATE' | string; } export interface VulnerabilityAlert { diff --git a/lib/util/git/auth.ts b/lib/util/git/auth.ts index cd0045901a..91b7fd44cf 100644 --- a/lib/util/git/auth.ts +++ b/lib/util/git/auth.ts @@ -195,11 +195,7 @@ function addAuthFromHostRule( let environmentVariables = env; const httpUrl = createURLFromHostOrURL(hostRule.matchHost!)?.toString(); if (validateUrl(httpUrl)) { - logger.trace( - // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - `Adding Git authentication for ${httpUrl} using token auth.` - ); + logger.trace(`Adding Git authentication for ${httpUrl} using token auth.`); environmentVariables = getGitAuthenticatedEnvironmentVariables( httpUrl!, hostRule, diff --git a/lib/util/host-rules.ts b/lib/util/host-rules.ts index 536f01ba51..501d32edeb 100644 --- a/lib/util/host-rules.ts +++ b/lib/util/host-rules.ts @@ -122,7 +122,7 @@ function prioritizeLongestMatchHost(rule1: HostRule, rule2: HostRule): number { } export function find(search: HostRuleSearch): HostRuleSearchResult { - if (!(search.hostType || search.url)) { + if (!(!!search.hostType || search.url)) { logger.warn({ search }, 'Invalid hostRules search'); return {}; } diff --git a/lib/util/http/auth.ts b/lib/util/http/auth.ts index 48b96ab55b..d2ba89b491 100644 --- a/lib/util/http/auth.ts +++ b/lib/util/http/auth.ts @@ -22,7 +22,7 @@ export function applyAuthorization<GotOptions extends AuthGotOptions>( ): GotOptions { const options: GotOptions = { ...inOptions }; - if (options.headers?.authorization || options.noAuth) { + if (is.nonEmptyString(options.headers?.authorization) || options.noAuth) { return options; } diff --git a/lib/util/http/host-rules.ts b/lib/util/http/host-rules.ts index d81d0a7af9..b112988f88 100644 --- a/lib/util/http/host-rules.ts +++ b/lib/util/http/host-rules.ts @@ -38,7 +38,11 @@ export function findMatchingRules<GotOptions extends HostRulesGotOptions>( const { hostType } = options; let res = hostRules.find({ hostType, url }); - if (res.token || res.username || res.password) { + if ( + is.nonEmptyString(res.token) || + is.nonEmptyString(res.username) || + is.nonEmptyString(res.password) + ) { // do not fallback if we already have auth infos return res; } @@ -102,9 +106,9 @@ export function applyHostRules<GotOptions extends HostRulesGotOptions>( if (options.noAuth) { logger.trace({ url }, `Authorization disabled`); } else if ( - options.headers?.authorization || - options.password || - options.token + is.nonEmptyString(options.headers?.authorization) || + is.nonEmptyString(options.password) || + is.nonEmptyString(options.token) ) { logger.trace({ url }, `Authorization already set`); } else if (password !== undefined) { diff --git a/lib/util/http/index.ts b/lib/util/http/index.ts index 1c0bdcc43b..741de3c774 100644 --- a/lib/util/http/index.ts +++ b/lib/util/http/index.ts @@ -47,7 +47,7 @@ type Task<T> = () => Promise<HttpResponse<T>>; // Copying will help to avoid circular structure // and mutation of the cached response. -function copyResponse<T extends Buffer | string | any>( +function copyResponse<T>( response: HttpResponse<T>, deep: boolean ): HttpResponse<T> { @@ -55,7 +55,7 @@ function copyResponse<T extends Buffer | string | any>( return deep ? { statusCode, - body: body instanceof Buffer ? (body.slice() as T) : clone<T>(body), + body: body instanceof Buffer ? (body.subarray() as T) : clone<T>(body), headers: clone(headers), } : { diff --git a/lib/util/package-rules/dep-types.ts b/lib/util/package-rules/dep-types.ts index b1e705c0af..046f0410e3 100644 --- a/lib/util/package-rules/dep-types.ts +++ b/lib/util/package-rules/dep-types.ts @@ -12,7 +12,7 @@ export class DepTypesMatcher extends Matcher { } const result = - (depType && matchDepTypes.includes(depType)) || + (is.string(depType) && matchDepTypes.includes(depType)) || depTypes?.some((dt) => matchDepTypes.includes(dt)); return result ?? false; } diff --git a/lib/util/url.ts b/lib/util/url.ts index a082ba8aeb..f024c6da5a 100644 --- a/lib/util/url.ts +++ b/lib/util/url.ts @@ -74,6 +74,8 @@ export function getQueryString(params: Record<string, any>): string { for (const [k, v] of Object.entries(params)) { if (is.array<object>(v)) { for (const item of v) { + // TODO: fix me? + // eslint-disable-next-line @typescript-eslint/no-base-to-string usp.append(k, item.toString()); } } else { diff --git a/lib/workers/global/config/parse/env.spec.ts b/lib/workers/global/config/parse/env.spec.ts index 672839f1c3..1631326e46 100644 --- a/lib/workers/global/config/parse/env.spec.ts +++ b/lib/workers/global/config/parse/env.spec.ts @@ -266,7 +266,6 @@ describe('workers/global/config/parse/env', () => { beforeAll(() => { processExit = jest .spyOn(process, 'exit') - // eslint-disable-next-line @typescript-eslint/no-empty-function .mockImplementation((() => {}) as never); }); diff --git a/lib/workers/global/limits.ts b/lib/workers/global/limits.ts index 456ff35e08..aa030b0595 100644 --- a/lib/workers/global/limits.ts +++ b/lib/workers/global/limits.ts @@ -29,6 +29,8 @@ export function incLimitedValue(key: Limit, incBy = 1): void { export function isLimitReached(key: Limit): boolean { const limit = limits.get(key); + // TODO: fix me? + // eslint-disable-next-line @typescript-eslint/prefer-optional-chain if (!limit || limit.max === null) { return false; } diff --git a/lib/workers/repository/config-migration/pr/index.ts b/lib/workers/repository/config-migration/pr/index.ts index c24a1dd1aa..3152227b8b 100644 --- a/lib/workers/repository/config-migration/pr/index.ts +++ b/lib/workers/repository/config-migration/pr/index.ts @@ -50,8 +50,6 @@ ${ :no_bell: **Ignore**: Close this PR and you won't be reminded about config migration again, but one day your current config may no longer be valid. :question: Got questions? Does something look wrong to you? Please don't hesitate to [request help here](${ - // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions config.productLinks?.help }).\n\n` ); diff --git a/lib/workers/repository/dependency-dashboard.ts b/lib/workers/repository/dependency-dashboard.ts index 54ff00693f..5d80ba35ca 100644 --- a/lib/workers/repository/dependency-dashboard.ts +++ b/lib/workers/repository/dependency-dashboard.ts @@ -107,7 +107,7 @@ export async function readDashboardBody( config.dependencyDashboardChecks = {}; const stringifiedConfig = JSON.stringify(config); if ( - config.dependencyDashboard || + config.dependencyDashboard === true || stringifiedConfig.includes('"dependencyDashboardApproval":true') || stringifiedConfig.includes('"prCreation":"approval"') ) { @@ -199,9 +199,10 @@ export async function ensureDependencyDashboard( ); if ( !( - config.dependencyDashboard || - config.dependencyDashboardApproval || - config.packageRules?.some((rule) => rule.dependencyDashboardApproval) || + config.dependencyDashboard === true || + config.dependencyDashboardApproval === true || + config.packageRules?.some((rule) => rule.dependencyDashboardApproval) === + true || branches.some( (branch) => !!branch.dependencyDashboardApproval || diff --git a/lib/workers/repository/onboarding/pr/index.ts b/lib/workers/repository/onboarding/pr/index.ts index f18aa839b2..6b478979c7 100644 --- a/lib/workers/repository/onboarding/pr/index.ts +++ b/lib/workers/repository/onboarding/pr/index.ts @@ -32,7 +32,7 @@ export async function ensureOnboardingPr( branches: BranchConfig[] ): Promise<void> { if ( - config.repoIsOnboarded || + config.repoIsOnboarded === true || OnboardingState.onboardingCacheValid || (config.onboardingRebaseCheckbox && !OnboardingState.prUpdateRequested) ) { diff --git a/lib/workers/repository/process/fetch.ts b/lib/workers/repository/process/fetch.ts index 4d11ec848f..b691482393 100644 --- a/lib/workers/repository/process/fetch.ts +++ b/lib/workers/repository/process/fetch.ts @@ -75,7 +75,7 @@ async function fetchDepUpdates( Object.assign(dep, updateResult); } catch (err) { if ( - packageFileConfig.repoIsOnboarded || + packageFileConfig.repoIsOnboarded === true || !(err instanceof ExternalHostError) ) { throw err; diff --git a/lib/workers/repository/process/lookup/index.ts b/lib/workers/repository/process/lookup/index.ts index b3c8298bd2..ade4a9ba29 100644 --- a/lib/workers/repository/process/lookup/index.ts +++ b/lib/workers/repository/process/lookup/index.ts @@ -390,7 +390,7 @@ export async function lookupUpdates( } // update digest for all for (const update of res.updates) { - if (pinDigests || currentDigest) { + if (pinDigests === true || currentDigest) { // TODO #7154 update.newDigest = update.newDigest ?? (await getDigest(config, update.newValue))!; @@ -438,10 +438,10 @@ export async function lookupUpdates( .filter((update) => update.newDigest !== null) .filter( (update) => - (update.newName && update.newName !== packageName) || - update.isReplacement || + (is.string(update.newName) && update.newName !== packageName) || + update.isReplacement === true || update.newValue !== currentValue || - update.isLockfileUpdate || + update.isLockfileUpdate === true || // TODO #7154 (update.newDigest && !update.newDigest.startsWith(currentDigest!)) ); diff --git a/lib/workers/repository/process/vulnerabilities.ts b/lib/workers/repository/process/vulnerabilities.ts index 15991b863f..fe177051e2 100644 --- a/lib/workers/repository/process/vulnerabilities.ts +++ b/lib/workers/repository/process/vulnerabilities.ts @@ -43,7 +43,6 @@ export class Vulnerabilities { rubygems: 'RubyGems', }; - // eslint-disable-next-line @typescript-eslint/no-empty-function private constructor() {} private async initialize(): Promise<void> { diff --git a/lib/workers/repository/update/branch/auto-replace.ts b/lib/workers/repository/update/branch/auto-replace.ts index dd227fc711..2d8138c609 100644 --- a/lib/workers/repository/update/branch/auto-replace.ts +++ b/lib/workers/repository/update/branch/auto-replace.ts @@ -83,7 +83,7 @@ export async function confirmIfDepUpdated( if ( upgrade.newDigest && - (upgrade.isPinDigest || upgrade.currentDigest) && + (upgrade.isPinDigest === true || upgrade.currentDigest) && upgrade.newDigest !== newUpgrade.currentDigest ) { logger.debug( diff --git a/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts b/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts index 4b4de4cc8b..ea12cee5d5 100644 --- a/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts +++ b/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts @@ -163,8 +163,9 @@ export default async function executePostUpgradeCommands( config: BranchConfig ): Promise<PostUpgradeCommandsExecutionResult | null> { const hasChangedFiles = - (config.updatedPackageFiles && config.updatedPackageFiles.length > 0) || - (config.updatedArtifacts && config.updatedArtifacts.length > 0); + (is.array(config.updatedPackageFiles) && + config.updatedPackageFiles.length > 0) || + (is.array(config.updatedArtifacts) && config.updatedArtifacts.length > 0); if ( /* Only run post-upgrade tasks if there are changes to package files... */ diff --git a/lib/workers/repository/update/branch/handle-existing.ts b/lib/workers/repository/update/branch/handle-existing.ts index bc7a79deb7..42865ecf7f 100644 --- a/lib/workers/repository/update/branch/handle-existing.ts +++ b/lib/workers/repository/update/branch/handle-existing.ts @@ -67,7 +67,7 @@ export async function handleModifiedPr( const dependencyDashboardCheck = config.dependencyDashboardChecks?.[config.branchName]; - if (dependencyDashboardCheck || config.rebaseRequested) { + if (!!dependencyDashboardCheck || config.rebaseRequested) { logger.debug('Manual rebase has been requested for PR'); if (GlobalConfig.get('dryRun')) { logger.info( diff --git a/lib/workers/repository/update/branch/index.ts b/lib/workers/repository/update/branch/index.ts index 6654edb2bb..f4e0d0088d 100644 --- a/lib/workers/repository/update/branch/index.ts +++ b/lib/workers/repository/update/branch/index.ts @@ -250,7 +250,7 @@ export async function processBranch( if (branchIsModified || userChangedTargetBranch(branchPr)) { logger.debug(`PR has been edited, PrNo:${branchPr.number}`); await handleModifiedPr(config, branchPr); - if (!(dependencyDashboardCheck || config.rebaseRequested)) { + if (!(!!dependencyDashboardCheck || config.rebaseRequested)) { return { branchExists, prNo: branchPr.number, @@ -326,7 +326,7 @@ export async function processBranch( config.upgrades.some( (upgrade) => (is.nonEmptyString(upgrade.minimumReleaseAge) && - upgrade.releaseTimestamp) || + is.nonEmptyString(upgrade.releaseTimestamp)) || isActiveConfidenceLevel(upgrade.minimumConfidence!) ) ) { diff --git a/lib/workers/repository/update/branch/reuse.ts b/lib/workers/repository/update/branch/reuse.ts index d21ca79897..d2b3a7b1ac 100644 --- a/lib/workers/repository/update/branch/reuse.ts +++ b/lib/workers/repository/update/branch/reuse.ts @@ -24,7 +24,7 @@ export async function shouldReuseExistingBranch( if ( config.rebaseWhen === 'behind-base-branch' || (config.rebaseWhen === 'auto' && - (config.automerge || (await platform.getRepoForceRebase()))) + (config.automerge === true || (await platform.getRepoForceRebase()))) ) { if (await scm.isBranchBehindBase(branchName, baseBranch)) { logger.debug(`Branch is behind base branch and needs rebasing`); diff --git a/lib/workers/repository/update/pr/body/config-description.ts b/lib/workers/repository/update/pr/body/config-description.ts index 11d1aeed01..dbbc3c0033 100644 --- a/lib/workers/repository/update/pr/body/config-description.ts +++ b/lib/workers/repository/update/pr/body/config-description.ts @@ -33,8 +33,6 @@ export function getPrConfigDescription(config: BranchConfig): string { prBody += `, or you tick the rebase/retry checkbox.\n\n`; if (config.recreateClosed) { prBody += emojify( - // TODO: types (#7154) - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `:ghost: **Immortal**: This PR will be recreated if closed unmerged. Get [config help](${config.productLinks?.help}) if that's undesired.\n\n` ); } else { diff --git a/lib/workers/types.ts b/lib/workers/types.ts index 3df5bb8579..f185b8bdcf 100644 --- a/lib/workers/types.ts +++ b/lib/workers/types.ts @@ -39,6 +39,8 @@ export interface BranchUpgradeConfig currentDigestShort?: string; currentValue?: string; depIndex?: number; + + displayPending?: string; excludeCommitPaths?: string[]; githubName?: string; group?: GroupConfig; diff --git a/package.json b/package.json index 1a8186b539..21876da34f 100644 --- a/package.json +++ b/package.json @@ -296,8 +296,8 @@ "@types/url-join": "4.0.1", "@types/validate-npm-package-name": "4.0.0", "@types/xmldoc": "1.1.6", - "@typescript-eslint/eslint-plugin": "5.62.0", - "@typescript-eslint/parser": "5.62.0", + "@typescript-eslint/eslint-plugin": "6.2.0", + "@typescript-eslint/parser": "6.2.0", "aws-sdk-client-mock": "3.0.0", "callsite": "1.0.0", "common-tags": "1.8.2", diff --git a/test/graphql-snapshot.ts b/test/graphql-snapshot.ts index 75478315b4..8f9474e083 100644 --- a/test/graphql-snapshot.ts +++ b/test/graphql-snapshot.ts @@ -4,6 +4,7 @@ import { DefinitionNode, DocumentNode, FieldNode, + Kind, OperationDefinitionNode, SelectionNode, SelectionSetNode, @@ -16,11 +17,11 @@ import { function isOperationDefinitionNode( def: DefinitionNode ): def is OperationDefinitionNode { - return def.kind === 'OperationDefinition'; + return def.kind === Kind.OPERATION_DEFINITION; } function isFieldNode(sel: SelectionNode): sel is FieldNode { - return sel.kind === 'Field'; + return sel.kind === Kind.FIELD; } interface Arguments { @@ -51,14 +52,14 @@ function getArguments(key: string, val: ValueNode): Arguments { const result: Arguments = {}; const kind = val.kind; if ( - val.kind === 'IntValue' || - val.kind === 'FloatValue' || - val.kind === 'StringValue' || - val.kind === 'BooleanValue' || - val.kind === 'EnumValue' + val.kind === Kind.INT || + val.kind === Kind.FLOAT || + val.kind === Kind.STRING || + val.kind === Kind.BOOLEAN || + val.kind === Kind.ENUM ) { result[key] = val.value; - } else if (val.kind === 'ObjectValue') { + } else if (val.kind === Kind.OBJECT) { let childResult: Arguments = {}; val.fields.forEach((fieldNode) => { const childKey = fieldNode.name.value; @@ -66,15 +67,15 @@ function getArguments(key: string, val: ValueNode): Arguments { childResult = { ...childResult, ...childVal }; }); result[key] = childResult; - } else if (val.kind === 'ListValue') { + } else if (val.kind === Kind.LIST) { const results: Arguments[] = []; val.values.forEach((fieldNode) => { results.push(getArguments(key, fieldNode)); }); result[key] = results.map(({ [key]: x }) => x).flat(); - } else if (val.kind === 'NullValue') { + } else if (val.kind === Kind.NULL) { result[key] = null; - } else if (val.kind === 'Variable') { + } else if (val.kind === Kind.VARIABLE) { result[key] = `$${val.name.value}`; } else { result[key] = `<<${kind}>>`; @@ -131,18 +132,18 @@ function simplifySelectionSet( function getTypeName(typeNode: TypeNode): string { const kind = typeNode.kind; - if (typeNode.kind === 'NamedType') { + if (typeNode.kind === Kind.NAMED_TYPE) { return typeNode.name.value; } const childTypeNode = typeNode.type; const childTypeName = getTypeName(childTypeNode); - if (kind === 'ListType') { + if (kind === Kind.LIST_TYPE) { return `[${childTypeName}]`; } - if (kind === 'NonNullType') { + if (kind === Kind.NON_NULL_TYPE) { return `${childTypeName}!`; } diff --git a/test/setup.ts b/test/setup.ts index 6de60ea931..a222a7b601 100644 --- a/test/setup.ts +++ b/test/setup.ts @@ -165,10 +165,9 @@ declare global { type SpyInstance<T, Y extends any[]> = JestSpyInstance<(...args: Y) => T>; // Extension point for jest matchers - // eslint-disable-next-line @typescript-eslint/no-empty-interface interface Expect {} // Extension point for jest matchers - // eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Matchers<R> {} } } diff --git a/test/to-migrate.ts b/test/to-migrate.ts index c2203d1503..4b18b0c3f4 100644 --- a/test/to-migrate.ts +++ b/test/to-migrate.ts @@ -24,8 +24,6 @@ expect.extend({ CustomMigration: MigrationConstructor, originalConfig: RenovateConfig, expectedConfig: RenovateConfig, - // not inferrable type https://github.com/typescript-eslint/typescript-eslint/issues/5199 - // eslint-disable-next-line @typescript-eslint/no-inferrable-types isMigrated: boolean = true ) { class CustomMigrationsService extends MigrationsService { diff --git a/yarn.lock b/yarn.lock index a5285bcfd5..ef3958f6f9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1193,14 +1193,14 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@eslint-community/eslint-utils@^4.2.0": +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.4.0": +"@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.5.1": version "4.6.2" resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.6.2.tgz#1816b5f6948029c5eaacb0703b850ee0cb37d8f8" integrity sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw== @@ -3258,7 +3258,7 @@ resolved "https://registry.yarnpkg.com/@types/json-dup-key-validator/-/json-dup-key-validator-1.0.0.tgz#3a666ab980e5e957960e9341e13eabd4fd9a24f3" integrity sha512-D/pvJeKintUSW4G+aBRSvReECxCHbMcE9IuSU7cfWQAtYStE/vH8OLXFw38JJ37dSEnpcOkEV7q4WmdvtV0zHg== -"@types/json-schema@*", "@types/json-schema@^7.0.9": +"@types/json-schema@*", "@types/json-schema@^7.0.12", "@types/json-schema@^7.0.9": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb" integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA== @@ -3403,7 +3403,7 @@ resolved "https://registry.yarnpkg.com/@types/semver-utils/-/semver-utils-1.1.1.tgz#4260b9ce13344725069a1ff86bd2f4d6c70a443e" integrity sha512-WLZZQdwo5P+H6R+bDDCFqFSlP5Jtk6gyXpE0R0KAVQbcMGmxpVsNX8dah640hY4+PpRG2+Ph3dcwDHzrOAOZ7A== -"@types/semver@7.5.0", "@types/semver@^7.1.0", "@types/semver@^7.3.12": +"@types/semver@7.5.0", "@types/semver@^7.1.0", "@types/semver@^7.3.12", "@types/semver@^7.5.0": version "7.5.0" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a" integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw== @@ -3492,21 +3492,23 @@ dependencies: "@types/node" "*" -"@typescript-eslint/eslint-plugin@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz#aeef0328d172b9e37d9bab6dbc13b87ed88977db" - integrity sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag== - dependencies: - "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.62.0" - "@typescript-eslint/type-utils" "5.62.0" - "@typescript-eslint/utils" "5.62.0" +"@typescript-eslint/eslint-plugin@6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.2.0.tgz#57047c400be0632d4797ac081af8d399db3ebc3b" + integrity sha512-rClGrMuyS/3j0ETa1Ui7s6GkLhfZGKZL3ZrChLeAiACBE/tRc1wq8SNZESUuluxhLj9FkUefRs2l6bCIArWBiQ== + dependencies: + "@eslint-community/regexpp" "^4.5.1" + "@typescript-eslint/scope-manager" "6.2.0" + "@typescript-eslint/type-utils" "6.2.0" + "@typescript-eslint/utils" "6.2.0" + "@typescript-eslint/visitor-keys" "6.2.0" debug "^4.3.4" graphemer "^1.4.0" - ignore "^5.2.0" + ignore "^5.2.4" + natural-compare "^1.4.0" natural-compare-lite "^1.4.0" - semver "^7.3.7" - tsutils "^3.21.0" + semver "^7.5.4" + ts-api-utils "^1.0.1" "@typescript-eslint/experimental-utils@^5.3.0": version "5.62.0" @@ -3515,14 +3517,15 @@ dependencies: "@typescript-eslint/utils" "5.62.0" -"@typescript-eslint/parser@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.62.0.tgz#1b63d082d849a2fcae8a569248fbe2ee1b8a56c7" - integrity sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA== +"@typescript-eslint/parser@6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.2.0.tgz#d37c30b0f459c6f39455335d8f4f085919a1c644" + integrity sha512-igVYOqtiK/UsvKAmmloQAruAdUHihsOCvplJpplPZ+3h4aDkC/UKZZNKgB6h93ayuYLuEymU3h8nF1xMRbh37g== dependencies: - "@typescript-eslint/scope-manager" "5.62.0" - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/typescript-estree" "5.62.0" + "@typescript-eslint/scope-manager" "6.2.0" + "@typescript-eslint/types" "6.2.0" + "@typescript-eslint/typescript-estree" "6.2.0" + "@typescript-eslint/visitor-keys" "6.2.0" debug "^4.3.4" "@typescript-eslint/scope-manager@5.62.0": @@ -3533,21 +3536,34 @@ "@typescript-eslint/types" "5.62.0" "@typescript-eslint/visitor-keys" "5.62.0" -"@typescript-eslint/type-utils@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz#286f0389c41681376cdad96b309cedd17d70346a" - integrity sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew== +"@typescript-eslint/scope-manager@6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.2.0.tgz#412a710d8fa20bc045533b3b19f423810b24f87a" + integrity sha512-1ZMNVgm5nnHURU8ZSJ3snsHzpFeNK84rdZjluEVBGNu7jDymfqceB3kdIZ6A4xCfEFFhRIB6rF8q/JIqJd2R0Q== dependencies: - "@typescript-eslint/typescript-estree" "5.62.0" - "@typescript-eslint/utils" "5.62.0" + "@typescript-eslint/types" "6.2.0" + "@typescript-eslint/visitor-keys" "6.2.0" + +"@typescript-eslint/type-utils@6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.2.0.tgz#02b27a3eeb41aa5460d6275d12cce5dd72e1c9fc" + integrity sha512-DnGZuNU2JN3AYwddYIqrVkYW0uUQdv0AY+kz2M25euVNlujcN2u+rJgfJsBFlUEzBB6OQkUqSZPyuTLf2bP5mw== + dependencies: + "@typescript-eslint/typescript-estree" "6.2.0" + "@typescript-eslint/utils" "6.2.0" debug "^4.3.4" - tsutils "^3.21.0" + ts-api-utils "^1.0.1" "@typescript-eslint/types@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== +"@typescript-eslint/types@6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.2.0.tgz#b341a4e6d5f609267306b07afc6f62bcf92b1495" + integrity sha512-1nRRaDlp/XYJQLvkQJG5F3uBTno5SHPT7XVcJ5n1/k2WfNI28nJsvLakxwZRNY5spuatEKO7d5nZWsQpkqXwBA== + "@typescript-eslint/typescript-estree@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" @@ -3561,6 +3577,19 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.2.0.tgz#4969944b831b481996aa4fbd73c7164ca683b8ef" + integrity sha512-Mts6+3HQMSM+LZCglsc2yMIny37IhUgp1Qe8yJUYVyO6rHP7/vN0vajKu3JvHCBIy8TSiKddJ/Zwu80jhnGj1w== + dependencies: + "@typescript-eslint/types" "6.2.0" + "@typescript-eslint/visitor-keys" "6.2.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.5.4" + ts-api-utils "^1.0.1" + "@typescript-eslint/utils@5.62.0", "@typescript-eslint/utils@^5.10.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" @@ -3575,6 +3604,19 @@ eslint-scope "^5.1.1" semver "^7.3.7" +"@typescript-eslint/utils@6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.2.0.tgz#606a20e5c13883c2d2bd0538ddc4b96b8d410979" + integrity sha512-RCFrC1lXiX1qEZN8LmLrxYRhOkElEsPKTVSNout8DMzf8PeWoQG7Rxz2SadpJa3VSh5oYKGwt7j7X/VRg+Y3OQ== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@types/json-schema" "^7.0.12" + "@types/semver" "^7.5.0" + "@typescript-eslint/scope-manager" "6.2.0" + "@typescript-eslint/types" "6.2.0" + "@typescript-eslint/typescript-estree" "6.2.0" + semver "^7.5.4" + "@typescript-eslint/visitor-keys@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" @@ -3583,6 +3625,14 @@ "@typescript-eslint/types" "5.62.0" eslint-visitor-keys "^3.3.0" +"@typescript-eslint/visitor-keys@6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.2.0.tgz#71943f42fdaa2ec86dc3222091f41761a49ae71a" + integrity sha512-QbaYUQVKKo9bgCzpjz45llCfwakyoxHetIy8CAvYCtd16Zu1KrpzNHofwF8kGkpPOxZB2o6kz+0nqH8ZkIzuoQ== + dependencies: + "@typescript-eslint/types" "6.2.0" + eslint-visitor-keys "^3.4.1" + "@yarnpkg/core@3.5.2": version "3.5.2" resolved "https://registry.yarnpkg.com/@yarnpkg/core/-/core-3.5.2.tgz#a387f3cae7766c9f6801ad356e2f9bd9548485e6" @@ -10270,6 +10320,11 @@ trough@^1.0.0: resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406" integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA== +ts-api-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.1.tgz#8144e811d44c749cd65b2da305a032510774452d" + integrity sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A== + ts-essentials@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-7.0.3.tgz#686fd155a02133eedcc5362dc8b5056cde3e5a38" -- GitLab