Skip to content

Commit

Permalink
chore: remove some usages of eslint disable (#610)
Browse files Browse the repository at this point in the history
Small cleanup 🧹
  • Loading branch information
miguel-nascimento authored Aug 5, 2024
1 parent ba85af9 commit e3afdb2
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 31 deletions.
1 change: 0 additions & 1 deletion packages/dlog/src/dlog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ const isDev = typeof process !== 'undefined' && process.env.NODE_ENV === 'develo

const makeDlog = (d: Debugger, opts?: DLogOpts): DLogger => {
if (opts?.printStack) {
// eslint-disable-next-line no-console
d.log = console.error.bind(console)
}

Expand Down
8 changes: 3 additions & 5 deletions packages/encryption/src/encryptionDevice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// todo: fix lint issues and remove exception see: https://linear.app/hnt-labs/issue/HNT-1721/address-linter-overrides-in-matrix-encryption-code-from-sdk
/* eslint-disable @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unused-vars, @typescript-eslint/no-unsafe-argument*/

import { CryptoStore } from './cryptoStore'
import {
Account,
Expand Down Expand Up @@ -124,9 +122,11 @@ export class EncryptionDevice {
account.free()
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
this.deviceCurve25519Key = e2eKeys.curve25519
// note jterzis 07/19/23: deprecating ed25519 key in favor of TDK
// see: https://linear.app/hnt-labs/issue/HNT-1796/tdk-signature-storage-curve25519-key
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
this.deviceDoNotUseKey = e2eKeys.ed25519
log(
`init: deviceCurve25519Key: ${this.deviceCurve25519Key}, fallbackKey ${JSON.stringify(
Expand Down Expand Up @@ -347,9 +347,7 @@ export class EncryptionDevice {
* @param func - Invoked with the unpickled session
* @returns result of func
*/
private unpickleInboundGroupSession<T>(
sessionData: InboundGroupSessionData,
): InboundGroupSession {
private unpickleInboundGroupSession(sessionData: InboundGroupSessionData): InboundGroupSession {
const session = this.delegate.createInboundGroupSession()
session.unpickle(this.pickleKey, sessionData.session)
return session
Expand Down
1 change: 0 additions & 1 deletion packages/encryption/src/tests/encryption-protocol.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ describe('Encryption Protocol', () => {
const bobFallbackKey = JSON.parse(bobAccount.unpublished_fallback_key()).curve25519
log('bobFallbackKeys', bobFallbackKey)

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const bobIdKey = JSON.parse(bobAccount?.identity_keys()).curve25519
const otkId = Object.keys(bobFallbackKey)[0]
// create outbound sessions using bob's fallback key
Expand Down
17 changes: 8 additions & 9 deletions packages/sdk/src/channelsWithEntitlements.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
/**
* @group with-entitilements
*/
Expand Down Expand Up @@ -163,10 +162,10 @@ async function expectUserCanJoinChannel(
).resolves.toBeTruthy()

// Stream node should allow the join
await expect(client.joinStream(channelId!)).toResolve()
await expect(client.joinStream(channelId)).toResolve()
const aliceUserStreamView = (await client.waitForStream(makeUserStreamId(client.userId))!).view
// Wait for alice's user stream to have the join
await waitFor(() => aliceUserStreamView.userContent.isMember(channelId!, MembershipOp.SO_JOIN))
await waitFor(() => aliceUserStreamView.userContent.isMember(channelId, MembershipOp.SO_JOIN))
}

async function expectUserCannotJoinChannel(
Expand Down Expand Up @@ -498,7 +497,7 @@ describe('channelsWithEntitlements', () => {
carolProvider,
spaceId,
channelId,
} = await setupChannelWithCustomRole([], getNftRuleData(testNft1Address as Address))
} = await setupChannelWithCustomRole([], getNftRuleData(testNft1Address))

// Link carol's wallet to alice's as root
await linkWallets(aliceSpaceDapp, aliceProvider.wallet, carolProvider.wallet)
Expand Down Expand Up @@ -535,7 +534,7 @@ describe('channelsWithEntitlements', () => {
carolProvider,
spaceId,
channelId,
} = await setupChannelWithCustomRole([], getNftRuleData(testNft1Address as Address))
} = await setupChannelWithCustomRole([], getNftRuleData(testNft1Address))

log("Joining alice's wallet as a linked wallet to carols root wallet")
await linkWallets(carolSpaceDapp, carolProvider.wallet, aliceProvider.wallet)
Expand Down Expand Up @@ -677,7 +676,7 @@ describe('channelsWithEntitlements', () => {
const testNft1Address = await getContractAddress('TestNFT1')
const { alice, aliceSpaceDapp, bob, spaceId, channelId } = await setupChannelWithCustomRole(
[],
getNftRuleData(testNft1Address as Address),
getNftRuleData(testNft1Address),
)

// Alice has no NFTs, so she should not be able to join the channel
Expand Down Expand Up @@ -793,15 +792,15 @@ describe('channelsWithEntitlements', () => {
opType: OperationType.CHECK,
checkType: CheckOperationType.ERC721,
chainId: 31337n,
contractAddress: testNft1Address as Address,
contractAddress: testNft1Address,
threshold: 1n,
}

const rightOperation: Operation = {
opType: OperationType.CHECK,
checkType: CheckOperationType.ERC721,
chainId: 31337n,
contractAddress: testNft2Address as Address,
contractAddress: testNft2Address,
threshold: 1n,
}
const two: Operation = {
Expand All @@ -819,7 +818,7 @@ describe('channelsWithEntitlements', () => {
opType: OperationType.CHECK,
checkType: CheckOperationType.ERC721,
chainId: 31337n,
contractAddress: testNft3Address as Address,
contractAddress: testNft3Address,
threshold: 1n,
},
}
Expand Down
2 changes: 0 additions & 2 deletions packages/sdk/src/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ import {
} from '@river-build/proto'
import { PartialMessage } from '@bufbuild/protobuf'
import { CallOptions } from '@connectrpc/connect'
// This is needed to get the jest itnerface for using in spyOn
// eslint-disable-next-line import/no-extraneous-dependencies
import { jest } from '@jest/globals'
import {
DecryptedTimelineEvent,
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/src/mediaWithEntitlements.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
/**
* @group with-entitilements
*/
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/src/membershipManagement.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
/**
* @group with-entitilements
*/
Expand Down
9 changes: 1 addition & 8 deletions packages/sdk/src/persistenceStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,43 +236,36 @@ export class PersistenceStore extends Dexie implements IPersistenceStore {
}

//Linting below is disable as this is a stub class which is used for testing and just follows the interface
/* eslint-disable @typescript-eslint/no-unused-vars */
export class StubPersistenceStore implements IPersistenceStore {
//eslint-disable-next-line @typescript-eslint/no-unused-vars
async saveCleartext(eventId: string, cleartext: string) {
return Promise.resolve()
}

//eslint-disable-next-line @typescript-eslint/no-unused-vars
async getCleartext(eventId: string) {
return Promise.resolve(undefined)
}

//eslint-disable-next-line @typescript-eslint/no-unused-vars
async getCleartexts(eventIds: string[]) {
return Promise.resolve(undefined)
}

//eslint-disable-next-line @typescript-eslint/no-unused-vars
async getSyncedStream(streamId: string) {
return Promise.resolve(undefined)
}

//eslint-disable-next-line @typescript-eslint/no-unused-vars
async saveSyncedStream(streamId: string, syncedStream: PersistedSyncedStream) {
return Promise.resolve()
}

//eslint-disable-next-line @typescript-eslint/no-unused-vars
async saveMiniblock(streamId: string, miniblock: ParsedMiniblock) {
return Promise.resolve()
}

//eslint-disable-next-line @typescript-eslint/no-unused-vars
async saveMiniblocks(streamId: string, miniblocks: ParsedMiniblock[]) {
return Promise.resolve()
}

/* eslint-disable @typescript-eslint/no-unused-vars */
async getMiniblock(
streamId: string,
miniblockNum: bigint,
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/src/spaceWithEntitlements.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
/**
* @group with-entitilements
*/
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/src/sync-agent/user/user.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
/**
* @group with-entitilements
*/
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/src/withEntitilements.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
/**
* @group with-entitilements
*/
Expand Down

0 comments on commit e3afdb2

Please sign in to comment.