Skip to content

Commit 94c0e37

Browse files
committed
fix linter issues
1 parent 2316945 commit 94c0e37

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

packages/xrpl/src/models/transactions/common.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ import {
99
AuthorizeCredential,
1010
Currency,
1111
IssuedCurrencyAmount,
12+
MPTAmount,
1213
Memo,
1314
Signer,
1415
XChainBridge,
15-
MPTAmount,
1616
} from '../common'
17-
1817
import { onlyHasFields } from '../utils'
1918

2019
const MEMO_SIZE = 3
@@ -262,7 +261,7 @@ export function validateOptionalField(
262261
/* eslint-enable @typescript-eslint/restrict-template-expressions -- checked before */
263262

264263
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- no global flags right now, so this is fine
265-
export interface GlobalFlags { }
264+
export interface GlobalFlags {}
266265

267266
/**
268267
* Every transaction has the same set of common fields.
@@ -462,12 +461,12 @@ export function validateCredentialType(tx: Record<string, unknown>): void {
462461
* PermissionedDomainSet transaction uses 10, other transactions use 8.
463462
* @throws Validation Error if the formatting is incorrect
464463
*/
465-
// eslint-disable-next-line max-lines-per-function -- separating logic further will add unnecessary complexity
464+
// eslint-disable-next-line max-lines-per-function, max-params -- separating logic further will add unnecessary complexity
466465
export function validateCredentialsList(
467466
credentials: unknown,
468467
transactionType: string,
469468
isStringID: boolean,
470-
maxLengthCredentialsArray: number
469+
maxLengthCredentialsArray: number,
471470
): void {
472471
if (credentials == null) {
473472
return
@@ -526,15 +525,16 @@ export function containsDuplicates(
526525

527526
// Type guard to ensure we're working with AuthorizeCredential[]
528527
// Note: This is not a rigorous type-guard. A more thorough solution would be to iterate over the array and check each item.
529-
const isAuthorizeCredential = (
528+
function isAuthorizeCredentialArray(
530529
list: AuthorizeCredential[] | string[],
531-
): list is AuthorizeCredential[] => {
530+
): list is AuthorizeCredential[] {
532531
return typeof list[0] !== 'string'
533532
}
534533

535-
if (isAuthorizeCredential(objectList)) {
534+
if (isAuthorizeCredentialArray(objectList)) {
536535
for (const item of objectList) {
537536
const key = `${item.Credential.Issuer}-${item.Credential.CredentialType}`
537+
// eslint-disable-next-line max-depth -- necessary to check for type-guards
538538
if (seen.has(key)) {
539539
return true
540540
}

packages/xrpl/src/models/transactions/depositPreauth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
BaseTransaction,
66
validateBaseTransaction,
77
validateCredentialsList,
8-
MAX_CREDENTIALS_LIST_LENGTH
8+
MAX_CREDENTIALS_LIST_LENGTH,
99
} from './common'
1010

1111
/**

packages/xrpl/src/models/transactions/escrowFinish.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
validateBaseTransaction,
88
validateCredentialsList,
99
validateRequiredField,
10-
MAX_CREDENTIALS_LIST_LENGTH
10+
MAX_CREDENTIALS_LIST_LENGTH,
1111
} from './common'
1212

1313
/**

packages/xrpl/src/models/transactions/permissionedDomainSet.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ export function validatePermissionedDomainSet(
3030
validateBaseTransaction(tx)
3131

3232
validateOptionalField(tx, 'DomainID', isString)
33-
validateRequiredField(tx, 'AcceptedCredentials', () => tx.AcceptedCredentials instanceof Array)
33+
validateRequiredField(
34+
tx,
35+
'AcceptedCredentials',
36+
() => tx.AcceptedCredentials instanceof Array,
37+
)
3438

3539
validateCredentialsList(
3640
tx.AcceptedCredentials,

0 commit comments

Comments
 (0)