Skip to content

Commit

Permalink
refactor: set importsNotUsedAsValues to error (#14052)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee committed Feb 7, 2022
1 parent c1555ef commit 3b7e9a1
Show file tree
Hide file tree
Showing 76 changed files with 106 additions and 97 deletions.
2 changes: 1 addition & 1 deletion lib/config/presets/internal/compatibility.ts
@@ -1,4 +1,4 @@
import { Preset } from '../types';
import type { Preset } from '../types';

export const presets: Record<string, Preset> = {
additionalBranchPrefix: {
Expand Down
2 changes: 1 addition & 1 deletion lib/config/presets/npm/index.ts
@@ -1,5 +1,5 @@
import { resolvePackage } from '../../../datasource/npm/npmrc';
import { NpmResponse } from '../../../datasource/npm/types';
import type { NpmResponse } from '../../../datasource/npm/types';
import { logger } from '../../../logger';
import { Http } from '../../../util/http';
import type { Preset, PresetConfig } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion lib/config/secrets.ts
Expand Up @@ -6,7 +6,7 @@ import {
import { logger } from '../logger';
import { regEx } from '../util/regex';
import { addSecretForSanitizing } from '../util/sanitize';
import { AllConfig, RenovateConfig } from './types';
import type { AllConfig, RenovateConfig } from './types';

const secretNamePattern = '[A-Za-z][A-Za-z0-9_]*';

Expand Down
4 changes: 2 additions & 2 deletions lib/datasource/bitbucket-tags/index.ts
@@ -1,10 +1,10 @@
import * as utils from '../../platform/bitbucket/utils';
import type * as utils from '../../platform/bitbucket/utils';
import { cache } from '../../util/cache/package/decorator';
import { BitbucketHttp } from '../../util/http/bitbucket';
import { ensureTrailingSlash } from '../../util/url';
import { Datasource } from '../datasource';
import type { DigestConfig, GetReleasesConfig, ReleaseResult } from '../types';
import { BitbucketCommit, BitbucketTag } from './types';
import type { BitbucketCommit, BitbucketTag } from './types';

export class BitBucketTagsDatasource extends Datasource {
bitbucketHttp = new BitbucketHttp(BitBucketTagsDatasource.id);
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/dart/index.ts
@@ -1,4 +1,4 @@
import { HttpResponse } from '../../util/http';
import type { HttpResponse } from '../../util/http';
import { Datasource } from '../datasource';
import type { GetReleasesConfig, ReleaseResult } from '../types';
import type { DartResult } from './types';
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/galaxy/index.ts
@@ -1,6 +1,6 @@
import { logger } from '../../logger';
import { cache } from '../../util/cache/package/decorator';
import { HttpResponse } from '../../util/http';
import type { HttpResponse } from '../../util/http';
import { Datasource } from '../datasource';
import type { GetReleasesConfig, Release, ReleaseResult } from '../types';
import type { GalaxyResult } from './types';
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/github-releases/digest.spec.ts
Expand Up @@ -2,7 +2,7 @@ import hasha from 'hasha';
import * as httpMock from '../../../test/http-mock';
import { findDigestAsset, mapDigestAssetToRelease } from './digest';
import { GitHubReleaseMocker } from './test';
import { DigestAsset } from './types';
import type { DigestAsset } from './types';

describe('datasource/github-releases/digest', () => {
const lookupName = 'some/dep';
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/github-releases/test/index.ts
@@ -1,5 +1,5 @@
import * as httpMock from '../../../../test/http-mock';
import { GithubRelease } from '../types';
import type { GithubRelease } from '../types';

export class GitHubReleaseMocker {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/maven/index.ts
@@ -1,7 +1,7 @@
import is from '@sindresorhus/is';
import { DateTime } from 'luxon';
import pAll from 'p-all';
import { XmlDocument } from 'xmldoc';
import type { XmlDocument } from 'xmldoc';
import { logger } from '../../logger';
import * as packageCache from '../../util/cache/package';
import { newlineRegex, regEx } from '../../util/regex';
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/ruby-version/index.ts
@@ -1,7 +1,7 @@
import { ExternalHostError } from '../../types/errors/external-host-error';
import { cache } from '../../util/cache/package/decorator';
import { parse } from '../../util/html';
import { HttpError } from '../../util/http/types';
import type { HttpError } from '../../util/http/types';
import { isVersion, id as rubyVersioningId } from '../../versioning/ruby';
import { Datasource } from '../datasource';
import type { GetReleasesConfig, ReleaseResult } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/rubygems/index.ts
Expand Up @@ -2,7 +2,7 @@ import { cache } from '../../util/cache/package/decorator';
import { parseUrl } from '../../util/url';
import * as rubyVersioning from '../../versioning/ruby';
import { Datasource } from '../datasource';
import { GetReleasesConfig, ReleaseResult } from '../types';
import type { GetReleasesConfig, ReleaseResult } from '../types';
import { InternalRubyGemsDatasource } from './get';
import { RubyGemsOrgDatasource } from './get-rubygems-org';

Expand Down
2 changes: 1 addition & 1 deletion lib/manager/buildkite/extract.ts
@@ -1,6 +1,6 @@
import * as datasourceGithubTags from '../../datasource/github-tags';
import { logger } from '../../logger';
import { SkipReason } from '../../types';
import type { SkipReason } from '../../types';
import { newlineRegex, regEx } from '../../util/regex';
import { isVersion } from '../../versioning/semver';
import type { PackageDependency, PackageFile } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/bundler/artifacts.ts
Expand Up @@ -5,7 +5,7 @@ import {
TEMPORARY_ERROR,
} from '../../constants/error-messages';
import { logger } from '../../logger';
import { HostRule } from '../../types';
import type { HostRule } from '../../types';
import * as memCache from '../../util/cache/memory';
import { exec } from '../../util/exec';
import type { ExecOptions } from '../../util/exec/types';
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/bundler/host-rules.spec.ts
@@ -1,4 +1,4 @@
import { HostRule } from '../../types';
import type { HostRule } from '../../types';
import { add, clear } from '../../util/host-rules';

import {
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/bundler/host-rules.ts
@@ -1,4 +1,4 @@
import { HostRule } from '../../types';
import type { HostRule } from '../../types';
import { findAll } from '../../util/host-rules';

function isAuthenticatable(rule: HostRule): boolean {
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/cake/index.ts
Expand Up @@ -2,7 +2,7 @@ import moo from 'moo';
import { ProgrammingLanguage } from '../../constants';
import { id as datasource } from '../../datasource/nuget';
import { regEx } from '../../util/regex';
import { PackageDependency, PackageFile } from '../types';
import type { PackageDependency, PackageFile } from '../types';

export const language = ProgrammingLanguage.NET;

Expand Down
2 changes: 1 addition & 1 deletion lib/manager/cargo/extract.ts
@@ -1,7 +1,7 @@
import { parse } from '@iarna/toml';
import { CrateDatasource } from '../../datasource/crate';
import { logger } from '../../logger';
import { SkipReason } from '../../types';
import type { SkipReason } from '../../types';
import { findLocalSiblingOrParent, readLocalFile } from '../../util/fs';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
import type {
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/git-submodules/extract.ts
Expand Up @@ -8,7 +8,7 @@ import { simpleGitConfig } from '../../util/git/config';
import { getHttpUrl, getRemoteUrlWithToken } from '../../util/git/url';
import { regEx } from '../../util/regex';
import type { ExtractConfig, PackageFile } from '../types';
import { GitModule } from './types';
import type { GitModule } from './types';

async function getUrl(
git: SimpleGit,
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/gradle-wrapper/utils.ts
Expand Up @@ -7,7 +7,7 @@ import { chmod } from '../../util/fs';
import { newlineRegex, regEx } from '../../util/regex';
import gradleVersioning from '../../versioning/gradle';
import { id as npmVersioning } from '../../versioning/npm';
import { GradleVersionExtract } from './types';
import type { GradleVersionExtract } from './types';

export const extraEnv = {
GRADLE_OPTS:
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/helm-values/util.ts
@@ -1,6 +1,6 @@
import { hasKey } from '../../util/object';
import { regEx } from '../../util/regex';
import { HelmDockerImageDependency } from './types';
import type { HelmDockerImageDependency } from './types';

const parentKeyRe = regEx(/image$/i);

Expand Down
2 changes: 1 addition & 1 deletion lib/manager/homebrew/extract.ts
@@ -1,6 +1,6 @@
import * as datasourceGithubTags from '../../datasource/github-tags';
import { logger } from '../../logger';
import { SkipReason } from '../../types';
import type { SkipReason } from '../../types';
import { regEx } from '../../util/regex';
import type { PackageDependency, PackageFile } from '../types';
import type { UrlPathParsedResult } from './types';
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/npm/detect.ts
Expand Up @@ -3,7 +3,7 @@ import is from '@sindresorhus/is';
import upath from 'upath';
import { logger } from '../../logger';
import { readFile } from '../../util/fs';
import { GlobalManagerConfig } from '../types';
import type { GlobalManagerConfig } from '../types';

export async function detectGlobalConfig(): Promise<GlobalManagerConfig> {
const res: GlobalManagerConfig = {};
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/npm/post-update/yarn.ts
Expand Up @@ -16,7 +16,7 @@ import { exists, readFile, remove, writeFile } from '../../../util/fs';
import { newlineRegex, regEx } from '../../../util/regex';
import type { PostUpdateConfig, Upgrade } from '../../types';
import { getNodeConstraint } from './node-version';
import { GenerateLockFileResult } from './types';
import type { GenerateLockFileResult } from './types';

export async function checkYarnrc(
cwd: string
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/pipenv/extract.ts
Expand Up @@ -3,7 +3,7 @@ import { RANGE_PATTERN } from '@renovatebot/pep440';
import is from '@sindresorhus/is';
import { PypiDatasource } from '../../datasource/pypi';
import { logger } from '../../logger';
import { SkipReason } from '../../types';
import type { SkipReason } from '../../types';
import { localPathExists } from '../../util/fs';
import { regEx } from '../../util/regex';
import type { PackageDependency, PackageFile } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/poetry/extract.ts
Expand Up @@ -2,7 +2,7 @@ import { parse } from '@iarna/toml';
import is from '@sindresorhus/is';
import { PypiDatasource } from '../../datasource/pypi';
import { logger } from '../../logger';
import { SkipReason } from '../../types';
import type { SkipReason } from '../../types';
import {
getSiblingFileName,
localPathExists,
Expand Down
4 changes: 2 additions & 2 deletions lib/manager/pre-commit/extract.ts
Expand Up @@ -4,15 +4,15 @@ import { PlatformId } from '../../constants';
import { id as githubTagsId } from '../../datasource/github-tags';
import { id as gitlabTagsId } from '../../datasource/gitlab-tags';
import { logger } from '../../logger';
import { SkipReason } from '../../types';
import type { SkipReason } from '../../types';
import { find } from '../../util/host-rules';
import { regEx } from '../../util/regex';
import type { PackageDependency, PackageFile } from '../types';
import {
matchesPrecommitConfigHeuristic,
matchesPrecommitDependencyHeuristic,
} from './parsing';
import { PreCommitConfig } from './types';
import type { PreCommitConfig } from './types';

function isEmptyObject(obj: any): boolean {
return Object.keys(obj).length === 0 && obj.constructor === Object;
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/pre-commit/parsing.ts
@@ -1,5 +1,5 @@
import { hasKey } from '../../util/object';
import { PreCommitConfig, PreCommitDependency } from './types';
import type { PreCommitConfig, PreCommitDependency } from './types';

/**
* Type guard to determine whether the file matches pre-commit configuration format
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/terraform/lockfile/hash.spec.ts
Expand Up @@ -5,7 +5,7 @@ import * as httpMock from '../../../../test/http-mock';
import { getFixturePath, logger } from '../../../../test/util';
import { GlobalConfig } from '../../../config/global';
import { TerraformProviderDatasource } from '../../../datasource/terraform-provider';
import { Logger } from '../../../logger/types';
import type { Logger } from '../../../logger/types';
import { TerraformProviderHash } from './hash';

const releaseBackendUrl = TerraformProviderDatasource.defaultRegistryUrls[1];
Expand Down
2 changes: 1 addition & 1 deletion lib/platform/azure/azure-got-wrapper.spec.ts
@@ -1,5 +1,5 @@
import { PlatformId } from '../../constants';
import * as _hostRules from '../../util/host-rules';
import type * as _hostRules from '../../util/host-rules';

describe('platform/azure/azure-got-wrapper', () => {
let azure: typeof import('./azure-got-wrapper');
Expand Down
10 changes: 5 additions & 5 deletions lib/platform/azure/azure-got-wrapper.ts
@@ -1,11 +1,11 @@
import * as azure from 'azure-devops-node-api';
import { getBasicHandler, getHandlerFromToken } from 'azure-devops-node-api';
import { ICoreApi } from 'azure-devops-node-api/CoreApi';
import { IGitApi } from 'azure-devops-node-api/GitApi';
import { IPolicyApi } from 'azure-devops-node-api/PolicyApi';
import { IRequestHandler } from 'azure-devops-node-api/interfaces/common/VsoBaseInterfaces';
import type { ICoreApi } from 'azure-devops-node-api/CoreApi';
import type { IGitApi } from 'azure-devops-node-api/GitApi';
import type { IPolicyApi } from 'azure-devops-node-api/PolicyApi';
import type { IRequestHandler } from 'azure-devops-node-api/interfaces/common/VsoBaseInterfaces';
import { PlatformId } from '../../constants';
import { HostRule } from '../../types';
import type { HostRule } from '../../types';
import * as hostRules from '../../util/host-rules';

const hostType = PlatformId.Azure;
Expand Down
6 changes: 3 additions & 3 deletions lib/platform/azure/index.spec.ts
Expand Up @@ -6,10 +6,10 @@ import {
PullRequestStatus,
} from 'azure-devops-node-api/interfaces/GitInterfaces.js';
import { REPOSITORY_ARCHIVED } from '../../constants/error-messages';
import { logger as _logger } from '../../logger';
import type { logger as _logger } from '../../logger';
import { BranchStatus, PrState } from '../../types';
import * as _git from '../../util/git';
import * as _hostRules from '../../util/host-rules';
import type * as _git from '../../util/git';
import type * as _hostRules from '../../util/host-rules';
import type { Platform, RepoParams } from '../types';
import { AzurePrVote } from './types';

Expand Down
2 changes: 1 addition & 1 deletion lib/platform/azure/types.ts
@@ -1,4 +1,4 @@
import { Pr } from '../types';
import type { Pr } from '../types';

export interface AzurePr extends Pr {
sourceRefName?: string;
Expand Down
4 changes: 2 additions & 2 deletions lib/platform/azure/util.ts
Expand Up @@ -6,9 +6,9 @@ import {
} from 'azure-devops-node-api/interfaces/GitInterfaces.js';
import { logger } from '../../logger';
import { HostRule, PrState } from '../../types';
import { GitOptions } from '../../types/git';
import type { GitOptions } from '../../types/git';
import { addSecretForSanitizing } from '../../util/sanitize';
import { AzurePr } from './types';
import type { AzurePr } from './types';

export function getNewBranchName(branchName?: string): string {
if (branchName && !branchName.startsWith('refs/heads/')) {
Expand Down
2 changes: 1 addition & 1 deletion lib/platform/bitbucket-server/index.spec.ts
Expand Up @@ -5,7 +5,7 @@ import {
REPOSITORY_NOT_FOUND,
} from '../../constants/error-messages';
import { BranchStatus, PrState } from '../../types';
import * as _git from '../../util/git';
import type * as _git from '../../util/git';
import type { Platform } from '../types';

function sshLink(projectKey: string, repositorySlug: string): string {
Expand Down
4 changes: 2 additions & 2 deletions lib/platform/bitbucket-server/index.ts
Expand Up @@ -11,12 +11,12 @@ import {
} from '../../constants/error-messages';
import { logger } from '../../logger';
import { BranchStatus, PrState, VulnerabilityAlert } from '../../types';
import { GitProtocol } from '../../types/git';
import type { GitProtocol } from '../../types/git';
import type { FileData } from '../../types/platform/bitbucket-server';
import * as git from '../../util/git';
import { deleteBranch } from '../../util/git';
import * as hostRules from '../../util/host-rules';
import { HttpResponse } from '../../util/http';
import type { HttpResponse } from '../../util/http';
import {
BitbucketServerHttp,
setBaseUrl,
Expand Down
8 changes: 6 additions & 2 deletions lib/platform/bitbucket-server/utils.ts
@@ -1,8 +1,12 @@
// SEE for the reference https://github.com/renovatebot/renovate/blob/c3e9e572b225085448d94aa121c7ec81c14d3955/lib/platform/bitbucket/utils.js
import url from 'url';
import { HTTPError, Response } from 'got';
import type { HTTPError, Response } from 'got';
import { PrState } from '../../types';
import { HttpOptions, HttpPostOptions, HttpResponse } from '../../util/http';
import type {
HttpOptions,
HttpPostOptions,
HttpResponse,
} from '../../util/http';
import { BitbucketServerHttp } from '../../util/http/bitbucket-server';
import type { BbsPr, BbsRestPr } from './types';

Expand Down
4 changes: 2 additions & 2 deletions lib/platform/bitbucket/index.spec.ts
@@ -1,7 +1,7 @@
import * as httpMock from '../../../test/http-mock';
import { logger as _logger } from '../../logger';
import type { logger as _logger } from '../../logger';
import { BranchStatus, PrState } from '../../types';
import * as _git from '../../util/git';
import type * as _git from '../../util/git';
import { setBaseUrl } from '../../util/http/bitbucket';
import type { Platform, RepoParams } from '../types';

Expand Down
6 changes: 5 additions & 1 deletion lib/platform/bitbucket/utils.ts
@@ -1,7 +1,11 @@
import url from 'url';
import type { MergeStrategy } from '../../config/types';
import { BranchStatus, PrState } from '../../types';
import { HttpOptions, HttpPostOptions, HttpResponse } from '../../util/http';
import type {
HttpOptions,
HttpPostOptions,
HttpResponse,
} from '../../util/http';
import { BitbucketHttp } from '../../util/http/bitbucket';
import type { Pr } from '../types';
import type { BitbucketMergeStrategy, MergeRequestBody } from './types';
Expand Down
2 changes: 1 addition & 1 deletion lib/platform/gitea/gitea-helper.ts
@@ -1,7 +1,7 @@
import { BranchStatus, PrState } from '../../types';
import { GiteaHttp, GiteaHttpOptions } from '../../util/http/gitea';
import { getQueryString } from '../../util/url';
import { PrReviewersParams } from './types';
import type { PrReviewersParams } from './types';

const giteaHttp = new GiteaHttp();

Expand Down
10 changes: 5 additions & 5 deletions lib/platform/gitea/index.spec.ts
@@ -1,4 +1,4 @@
import {
import type {
BranchStatusConfig,
EnsureIssueConfig,
Platform,
Expand All @@ -14,12 +14,12 @@ import {
REPOSITORY_EMPTY,
REPOSITORY_MIRRORED,
} from '../../constants/error-messages';
import { logger as _logger } from '../../logger';
import type { logger as _logger } from '../../logger';
import { BranchStatus, PrState } from '../../types';
import * as _git from '../../util/git';
import type * as _git from '../../util/git';
import { setBaseUrl } from '../../util/http/gitea';
import { PlatformResult } from '../types';
import * as ght from './gitea-helper';
import type { PlatformResult } from '../types';
import type * as ght from './gitea-helper';

/**
* latest tested gitea version.
Expand Down

0 comments on commit 3b7e9a1

Please sign in to comment.