From 6ff2e6b44f6c668e5597ea0aa4a5dbe0e9153c4f Mon Sep 17 00:00:00 2001 From: chad Date: Fri, 3 Mar 2023 18:12:22 -0500 Subject: [PATCH] chore: lint identify (#1566) --- src/identify/index.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/identify/index.ts b/src/identify/index.ts index 6c01b23252..3e3754f2bd 100644 --- a/src/identify/index.ts +++ b/src/identify/index.ts @@ -4,7 +4,7 @@ import * as lp from 'it-length-prefixed' import { pipe } from 'it-pipe' import first from 'it-first' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { multiaddr, protocols } from '@multiformats/multiaddr' +import { Multiaddr, multiaddr, protocols } from '@multiformats/multiaddr' import { Identify } from './pb/message.js' import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record' import { @@ -112,7 +112,7 @@ export class IdentifyService implements Startable { const { peerId } = evt.detail if (this.components.peerId.equals(peerId)) { - void this.pushToPeerStore().catch(err => log.error(err)) + void this.pushToPeerStore().catch(err => { log.error(err) }) } }) @@ -121,16 +121,16 @@ export class IdentifyService implements Startable { const { peerId } = evt.detail if (this.components.peerId.equals(peerId)) { - void this.pushToPeerStore().catch(err => log.error(err)) + void this.pushToPeerStore().catch(err => { log.error(err) }) } }) } - isStarted () { + isStarted (): boolean { return this.started } - async start () { + async start (): Promise { if (this.started) { return } @@ -216,7 +216,7 @@ export class IdentifyService implements Startable { /** * Calls `push` on all peer connections */ - async pushToPeerStore () { + async pushToPeerStore (): Promise { // Do not try to push if we are not running if (!this.isStarted()) { return @@ -388,7 +388,7 @@ export class IdentifyService implements Startable { * Sends the `Identify` response with the Signed Peer Record * to the requesting peer over the given `connection` */ - async _handleIdentify (data: IncomingStreamData) { + async _handleIdentify (data: IncomingStreamData): Promise { const { connection, stream } = data const timeoutController = new TimeoutController(this.init.timeout) @@ -440,7 +440,7 @@ export class IdentifyService implements Startable { /** * Reads the Identify Push message from the given `connection` */ - async _handlePush (data: IncomingStreamData) { + async _handlePush (data: IncomingStreamData): Promise { const { connection, stream } = data const timeoutController = new TimeoutController(this.init.timeout) @@ -528,7 +528,7 @@ export class IdentifyService implements Startable { /** * Takes the `addr` and converts it to a Multiaddr if possible */ - static getCleanMultiaddr (addr: Uint8Array | string | null | undefined) { + static getCleanMultiaddr (addr: Uint8Array | string | null | undefined): Multiaddr | undefined { if (addr != null && addr.length > 0) { try { return multiaddr(addr)