chore: upgrade eslint and prettier (#2376)

* chore: upgrade eslint and prettier

* chore: add restrict-template-expressions
This commit is contained in:
Mo
2023-07-27 14:36:05 -05:00
committed by GitHub
parent acc41edb02
commit 4a29e2a24c
1283 changed files with 4416 additions and 5131 deletions

View File

@@ -3,7 +3,10 @@ import { MutatorClientInterface } from '../../Mutator/MutatorClientInterface'
import { TrustedContactInterface, TrustedContactMutator } from '@standardnotes/models'
export class EditContact {
constructor(private mutator: MutatorClientInterface, private sync: SyncServiceInterface) {}
constructor(
private mutator: MutatorClientInterface,
private sync: SyncServiceInterface,
) {}
async execute(
contact: TrustedContactInterface,

View File

@@ -4,7 +4,10 @@ import { ReuploadAllInvites } from '../../VaultInvite/UseCase/ReuploadAllInvites
import { ResendAllMessages } from '../../AsymmetricMessage/UseCase/ResendAllMessages'
export class HandleKeyPairChange implements UseCaseInterface<void> {
constructor(private reuploadAllInvites: ReuploadAllInvites, private resendAllMessages: ResendAllMessages) {}
constructor(
private reuploadAllInvites: ReuploadAllInvites,
private resendAllMessages: ResendAllMessages,
) {}
async execute(dto: {
newKeys: {

View File

@@ -10,7 +10,10 @@ import { EncryptMessage } from '../../Encryption/UseCase/Asymmetric/EncryptMessa
import { Result, UseCaseInterface } from '@standardnotes/domain-core'
export class SendOwnContactChangeMessage implements UseCaseInterface<AsymmetricMessageServerHash> {
constructor(private encryptMessage: EncryptMessage, private sendMessage: SendMessage) {}
constructor(
private encryptMessage: EncryptMessage,
private sendMessage: SendMessage,
) {}
async execute(params: {
senderOldKeyPair: PkcKeyPair

View File

@@ -7,7 +7,10 @@ import { ContentTypesUsingRootKeyEncryption } from '@standardnotes/models'
* When the user root key changes, we must re-encrypt all relevant items with this new root key (by simply re-syncing).
*/
export class ReencryptTypeAItems implements UseCaseInterface<void> {
constructor(private items: ItemManagerInterface, private mutator: MutatorClientInterface) {}
constructor(
private items: ItemManagerInterface,
private mutator: MutatorClientInterface,
) {}
public async execute(): Promise<Result<void>> {
const items = this.items.getItems(ContentTypesUsingRootKeyEncryption())

View File

@@ -31,7 +31,7 @@ export class IntegrityService
const integrityCheckResponse = await this.integrityApi.checkIntegrity(this.payloadManager.integrityPayloads)
if (isErrorResponse(integrityCheckResponse)) {
this.log(`Could not obtain integrity check: ${integrityCheckResponse.data.error}`)
this.log(`Could not obtain integrity check: ${integrityCheckResponse.data.error?.message}`)
return
}
@@ -52,7 +52,7 @@ export class IntegrityService
) {
this.log(
`Could not obtain item for integrity adjustments: ${
isErrorResponse(serverItemResponse) ? serverItemResponse.data.error : ''
isErrorResponse(serverItemResponse) ? serverItemResponse.data.error?.message : ''
}`,
)

View File

@@ -129,7 +129,7 @@ export class RootKeyManager extends AbstractService<RootKeyManagerEvent> {
case KeyMode.RootKeyPlusWrapper:
return true
default:
throw Error(`Unhandled keyMode value '${this.keyMode}'.`)
throw Error('Unhandled keyMode value.')
}
}
@@ -369,7 +369,7 @@ export class RootKeyManager extends AbstractService<RootKeyManagerEvent> {
/** Root key is simply changing, mode stays the same */
/** this.keyMode = this.keyMode; */
} else {
throw Error(`Unhandled key mode for setNewRootKey ${this.keyMode}`)
throw Error('Unhandled key mode for setNewRootKey')
}
this.setRootKeyInstance(key)
@@ -396,7 +396,7 @@ export class RootKeyManager extends AbstractService<RootKeyManagerEvent> {
} else if (this.keyMode === KeyMode.RootKeyNone) {
return undefined
} else {
throw `Unhandled key mode for getRootKeyParams ${this.keyMode}`
throw 'Unhandled key mode for getRootKeyParams'
}
}

View File

@@ -20,7 +20,7 @@ export class ConvertToSharedVault {
const serverResult = await this.sharedVaultServer.createSharedVault()
if (isErrorResponse(serverResult)) {
return ClientDisplayableError.FromString(`Failed to create shared vault ${serverResult}`)
return ClientDisplayableError.FromString(`Failed to create shared vault ${JSON.stringify(serverResult)}`)
}
const serverVaultHash = serverResult.data.sharedVault

View File

@@ -17,7 +17,7 @@ export class DeleteSharedVault {
})
if (isErrorResponse(response)) {
return ClientDisplayableError.FromString(`Failed to delete vault ${response}`)
return ClientDisplayableError.FromString(`Failed to delete vault ${JSON.stringify(response)}`)
}
await this.deleteVault.execute(params.sharedVault)

View File

@@ -4,7 +4,10 @@ import { SharedVaultListingInterface } from '@standardnotes/models'
import { GetSharedVaults } from './GetSharedVaults'
export class GetOwnedSharedVaults implements SyncUseCaseInterface<SharedVaultListingInterface[]> {
constructor(private getSharedVaults: GetSharedVaults, private isVaultOwnwer: IsVaultOwner) {}
constructor(
private getSharedVaults: GetSharedVaults,
private isVaultOwnwer: IsVaultOwner,
) {}
execute(dto: { userUuid: string }): Result<SharedVaultListingInterface[]> {
const sharedVaults = this.getSharedVaults.execute().getValue()

View File

@@ -99,7 +99,7 @@ export class NotifyVaultUsersOfKeyRotation implements UseCaseInterface<void> {
})
if (isErrorResponse(response)) {
return Result.fail(`Failed to delete existing invites ${response}`)
return Result.fail(`Failed to delete existing invites ${JSON.stringify(response)}`)
}
return Result.ok()
@@ -109,7 +109,7 @@ export class NotifyVaultUsersOfKeyRotation implements UseCaseInterface<void> {
const response = await this.inviteServer.getOutboundUserInvites()
if (isErrorResponse(response)) {
return Result.fail(`Failed to get outbound user invites ${response}`)
return Result.fail(`Failed to get outbound user invites ${JSON.stringify(response)}`)
}
const invites = response.data.invites

View File

@@ -4,7 +4,10 @@ import { AnyItemInterface } from '@standardnotes/models'
import { Uuids } from '@standardnotes/utils'
export class DiscardItemsLocally {
constructor(private readonly items: ItemManagerInterface, private readonly storage: StorageServiceInterface) {}
constructor(
private readonly items: ItemManagerInterface,
private readonly storage: StorageServiceInterface,
) {}
async execute(items: AnyItemInterface[]): Promise<void> {
this.items.removeItemsFromMemory(items)

View File

@@ -66,7 +66,7 @@ export class ReuploadAllInvites implements UseCaseInterface<void> {
const response = await this.inviteServer.getOutboundUserInvites()
if (isErrorResponse(response)) {
return Result.fail(`Failed to get outbound user invites ${response}`)
return Result.fail(`Failed to get outbound user invites ${JSON.stringify(response)}`)
}
const invites = response.data.invites
@@ -78,7 +78,7 @@ export class ReuploadAllInvites implements UseCaseInterface<void> {
const response = await this.inviteServer.deleteAllOutboundInvites()
if (isErrorResponse(response)) {
return Result.fail(`Failed to delete existing invites ${response}`)
return Result.fail(`Failed to delete existing invites ${JSON.stringify(response)}`)
}
return Result.ok()

View File

@@ -64,7 +64,7 @@ export class ReuploadVaultInvites implements UseCaseInterface<void> {
const response = await this.inviteServer.getOutboundUserInvites()
if (isErrorResponse(response)) {
return Result.fail(`Failed to get outbound user invites ${response}`)
return Result.fail(`Failed to get outbound user invites ${JSON.stringify(response)}`)
}
const invites = response.data.invites
@@ -78,7 +78,7 @@ export class ReuploadVaultInvites implements UseCaseInterface<void> {
})
if (isErrorResponse(response)) {
return Result.fail(`Failed to delete existing invites ${response}`)
return Result.fail(`Failed to delete existing invites ${JSON.stringify(response)}`)
}
return Result.ok()

View File

@@ -109,7 +109,7 @@ export class VaultInviteService
const response = await this.invitesServer.getInboundUserInvites()
if (isErrorResponse(response)) {
return ClientDisplayableError.FromString(`Failed to get inbound user invites ${response}`)
return ClientDisplayableError.FromString(`Failed to get inbound user invites ${JSON.stringify(response)}`)
}
this.pendingInvites = {}
@@ -125,7 +125,7 @@ export class VaultInviteService
const response = await this.invitesServer.getOutboundUserInvites()
if (isErrorResponse(response)) {
return ClientDisplayableError.FromString(`Failed to get outbound user invites ${response}`)
return ClientDisplayableError.FromString(`Failed to get outbound user invites ${JSON.stringify(response)}`)
}
if (sharedVault) {
@@ -220,7 +220,7 @@ export class VaultInviteService
})
if (isErrorResponse(response)) {
return ClientDisplayableError.FromString(`Failed to delete invite ${response}`)
return ClientDisplayableError.FromString(`Failed to delete invite ${JSON.stringify(response)}`)
}
delete this.pendingInvites[invite.uuid]

View File

@@ -5,7 +5,10 @@ import { FindContact } from '../../Contacts/UseCase/FindContact'
import { Result, UseCaseInterface } from '@standardnotes/domain-core'
export class GetVaultContacts implements UseCaseInterface<TrustedContactInterface[]> {
constructor(private findContact: FindContact, private getVaultUsers: GetVaultUsers) {}
constructor(
private findContact: FindContact,
private getVaultUsers: GetVaultUsers,
) {}
async execute(dto: { sharedVaultUuid: string; readFromCache: boolean }): Promise<Result<TrustedContactInterface[]>> {
const users = await this.getVaultUsers.execute({

View File

@@ -4,7 +4,10 @@ import { SharedVaultUsersServerInterface } from '@standardnotes/api'
import { Result, UseCaseInterface } from '@standardnotes/domain-core'
export class GetVaultUsers implements UseCaseInterface<SharedVaultUserServerHash[]> {
constructor(private vaultUsersServer: SharedVaultUsersServerInterface, private cache: VaultUserCache) {}
constructor(
private vaultUsersServer: SharedVaultUsersServerInterface,
private cache: VaultUserCache,
) {}
async execute(params: {
sharedVaultUuid: string