From a1ef5df40404d5878a7fc4b464f69b2a29e081bf Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Tue, 5 Dec 2023 14:15:06 -0800 Subject: [PATCH] chore: run eslint fix --- packages/site/package.json | 2 +- packages/snap/src/authorizer.ts | 3 ++- packages/snap/src/handlers.ts | 17 +++++++---------- packages/snap/src/snapPersistence.ts | 1 + packages/snap/src/storage.ts | 2 +- packages/snap/src/testHelpers.ts | 3 ++- packages/snap/src/utils.ts | 15 +++++++++------ 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/packages/site/package.json b/packages/site/package.json index 8ecccbc..ce3eb78 100644 --- a/packages/site/package.json +++ b/packages/site/package.json @@ -8,7 +8,7 @@ "clean": "rimraf public", "lint": "npm run lint:eslint && npm run lint:misc --check", "lint:eslint": "eslint . --cache --ext js,ts", - "lint:fix": "npm run lint:eslint --fix && npm run lint:misc --write", + "lint:fix": "npm run lint:eslint -- --fix && npm run lint:misc -- --write", "lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path .gitignore", "start": "cross-env GATSBY_TELEMETRY_DISABLED=1 gatsby develop", "test": "echo TODO" diff --git a/packages/snap/src/authorizer.ts b/packages/snap/src/authorizer.ts index d33bb2b..a74d03a 100644 --- a/packages/snap/src/authorizer.ts +++ b/packages/snap/src/authorizer.ts @@ -1,5 +1,6 @@ /* eslint-disable jsdoc/require-jsdoc */ -import { XmtpEnv } from '@xmtp/xmtp-js'; +import type { XmtpEnv } from '@xmtp/xmtp-js'; + import { AUTHORIZATION_EXPIRY_MS } from './config'; import storage from './storage'; diff --git a/packages/snap/src/handlers.ts b/packages/snap/src/handlers.ts index a2c9061..7cb590f 100644 --- a/packages/snap/src/handlers.ts +++ b/packages/snap/src/handlers.ts @@ -1,22 +1,19 @@ /* eslint-disable jsdoc/require-jsdoc */ -import { - InMemoryKeystore, - Keystore, - PrivateKeyBundleV1, - keystoreApiDefs, -} from '@xmtp/xmtp-js'; import { fetcher, keystore as keystoreProto } from '@xmtp/proto'; -import { Reader, Writer } from 'protobufjs/minimal'; -import { +import type { InitKeystoreRequest as InitKeystoreRequestType, InitKeystoreResponse as InitKeystoreResponseType, GetKeystoreStatusRequest as GetKeystoreStatusRequestType, GetKeystoreStatusResponse as GetKeystoreStatusResponseType, // eslint-disable-next-line import/extensions } from '@xmtp/proto/ts/dist/types/keystore_api/v1/keystore.pb'; -import { getKeys, getPersistence, setKeys } from './utils'; +import type { InMemoryKeystore, Keystore } from '@xmtp/xmtp-js'; +import { PrivateKeyBundleV1, keystoreApiDefs } from '@xmtp/xmtp-js'; +import type { Reader, Writer } from 'protobufjs/minimal'; + +import type { SnapMeta } from '.'; import { KeyNotFoundError } from './errors'; -import { SnapMeta } from '.'; +import { getKeys, getPersistence, setKeys } from './utils'; const { GetKeystoreStatusResponse_KeystoreStatus: KeystoreStatus, diff --git a/packages/snap/src/snapPersistence.ts b/packages/snap/src/snapPersistence.ts index 7126e8f..db9226c 100644 --- a/packages/snap/src/snapPersistence.ts +++ b/packages/snap/src/snapPersistence.ts @@ -1,4 +1,5 @@ import type { Persistence } from '@xmtp/xmtp-js'; + import storage from './storage'; const ENCODING = 'binary'; diff --git a/packages/snap/src/storage.ts b/packages/snap/src/storage.ts index 8dc1e63..8db564a 100644 --- a/packages/snap/src/storage.ts +++ b/packages/snap/src/storage.ts @@ -1,4 +1,4 @@ -import { Json } from '@metamask/snaps-types'; +import type { Json } from '@metamask/snaps-types'; import { Mutex } from 'async-mutex'; export type StorageProvider = { diff --git a/packages/snap/src/testHelpers.ts b/packages/snap/src/testHelpers.ts index 455b1e9..23a1524 100644 --- a/packages/snap/src/testHelpers.ts +++ b/packages/snap/src/testHelpers.ts @@ -1,6 +1,7 @@ /* eslint-disable jsdoc/require-jsdoc */ import { Wallet } from 'ethers'; -import { SnapMeta } from '.'; + +import type { SnapMeta } from '.'; export function newWallet() { return Wallet.createRandom(); diff --git a/packages/snap/src/utils.ts b/packages/snap/src/utils.ts index 9650a1d..e4da115 100644 --- a/packages/snap/src/utils.ts +++ b/packages/snap/src/utils.ts @@ -1,15 +1,15 @@ /* eslint-disable jsdoc/require-jsdoc */ +import { privateKey, fetcher } from '@xmtp/proto'; import { InMemoryKeystore, - Persistence, PrefixedPersistence, PrivateKeyBundleV1, } from '@xmtp/xmtp-js'; -import { privateKey, fetcher } from '@xmtp/proto'; -import type { XmtpEnv } from '@xmtp/xmtp-js'; -import SnapPersistence from './snapPersistence'; -import { type SnapRequest, KeystoreHandler } from './handlers'; +import type { XmtpEnv, Persistence } from '@xmtp/xmtp-js'; + import { KeyNotFoundError } from './errors'; +import { type SnapRequest, KeystoreHandler } from './handlers'; +import SnapPersistence from './snapPersistence'; const { b64Encode } = fetcher; @@ -32,7 +32,10 @@ export async function getKeys(persistence: Persistence) { } // Store the keys in the provided persistence -export function setKeys(persistence: Persistence, keys: PrivateKeyBundleV1) { +export async function setKeys( + persistence: Persistence, + keys: PrivateKeyBundleV1, +) { return persistence.setItem(`keys`, keys.encode()); }