mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-10 14:06:30 +00:00
refactor(typescript): Refactor more files (#12696)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
This commit is contained in:
parent
e95fcb17d8
commit
a7792bc5b4
5 changed files with 12 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { EXTERNAL_HOST_ERROR } from '../../constants/error-messages';
|
import { EXTERNAL_HOST_ERROR } from '../../constants/error-messages';
|
||||||
|
|
||||||
export class ExternalHostError extends Error {
|
export class ExternalHostError extends Error {
|
||||||
hostType: string;
|
hostType: string | undefined;
|
||||||
|
|
||||||
err: Error;
|
err: Error;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { maskToken } from './mask';
|
||||||
|
|
||||||
describe('util/mask', () => {
|
describe('util/mask', () => {
|
||||||
describe('.maskToken', () => {
|
describe('.maskToken', () => {
|
||||||
it('returns value if passed value is falsy', () => {
|
it('returns empty string if passed value is falsy', () => {
|
||||||
|
expect(maskToken()).toBe('');
|
||||||
expect(maskToken('')).toBe('');
|
expect(maskToken('')).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -5,5 +5,5 @@ export function maskToken(str?: string): string {
|
||||||
new Array(str.length - 3).join('*'),
|
new Array(str.length - 3).join('*'),
|
||||||
str.slice(-2),
|
str.slice(-2),
|
||||||
].join('')
|
].join('')
|
||||||
: str;
|
: '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,13 @@ type Variables = Record<string, string>;
|
||||||
interface SelectionSet {
|
interface SelectionSet {
|
||||||
__vars?: Variables;
|
__vars?: Variables;
|
||||||
__args?: Arguments;
|
__args?: Arguments;
|
||||||
[key: string]: null | SelectionSet | Arguments;
|
[key: string]: undefined | null | SelectionSet | Arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GraphqlSnapshot {
|
interface GraphqlSnapshot {
|
||||||
query?: SelectionSet;
|
query?: SelectionSet;
|
||||||
|
mutation?: SelectionSet;
|
||||||
|
subscription?: SelectionSet;
|
||||||
variables?: Record<string, string>;
|
variables?: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ function getArguments(key: string, val: ValueNode): Arguments {
|
||||||
}
|
}
|
||||||
|
|
||||||
function simplifyArguments(
|
function simplifyArguments(
|
||||||
argNodes: ReadonlyArray<ArgumentNode>
|
argNodes?: ReadonlyArray<ArgumentNode>
|
||||||
): Arguments | null {
|
): Arguments | null {
|
||||||
if (argNodes) {
|
if (argNodes) {
|
||||||
let result: Arguments = {};
|
let result: Arguments = {};
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
"./lib/platform/utils/pr-body.ts",
|
"./lib/platform/utils/pr-body.ts",
|
||||||
"./lib/proxy.ts",
|
"./lib/proxy.ts",
|
||||||
"./lib/types/branch-status.ts",
|
"./lib/types/branch-status.ts",
|
||||||
|
"./lib/types/errors/external-host-error.ts",
|
||||||
"./lib/types/git.ts",
|
"./lib/types/git.ts",
|
||||||
"./lib/types/host-rules.ts",
|
"./lib/types/host-rules.ts",
|
||||||
"./lib/types/later.d.ts",
|
"./lib/types/later.d.ts",
|
||||||
|
@ -108,12 +109,15 @@
|
||||||
"./lib/util/http/types.ts",
|
"./lib/util/http/types.ts",
|
||||||
"./lib/util/index.ts",
|
"./lib/util/index.ts",
|
||||||
"./lib/util/json-writer/indentation-type.ts",
|
"./lib/util/json-writer/indentation-type.ts",
|
||||||
|
"./lib/util/mask.spec.ts",
|
||||||
|
"./lib/util/mask.ts",
|
||||||
"./lib/util/object.ts",
|
"./lib/util/object.ts",
|
||||||
"./lib/util/sanitize.ts",
|
"./lib/util/sanitize.ts",
|
||||||
"./lib/util/split.ts",
|
"./lib/util/split.ts",
|
||||||
"./lib/workers/pr/changelog/hbs-template.ts",
|
"./lib/workers/pr/changelog/hbs-template.ts",
|
||||||
"./lib/workers/pr/changelog/types.ts",
|
"./lib/workers/pr/changelog/types.ts",
|
||||||
"./lib/workers/repository/init/types.ts",
|
"./lib/workers/repository/init/types.ts",
|
||||||
|
"./test/graphql-snapshot.ts",
|
||||||
"./test/json-schema.ts",
|
"./test/json-schema.ts",
|
||||||
"./test/newline-snapshot-serializer.ts",
|
"./test/newline-snapshot-serializer.ts",
|
||||||
"./test/static-files.spec.ts",
|
"./test/static-files.spec.ts",
|
||||||
|
|
Loading…
Reference in a new issue