From f9235e2ff666457607f28f60d1d2aa47d646d8dc Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Wed, 7 Oct 2020 17:29:42 +0200 Subject: [PATCH] chore: lint issue fixed 0.30 --- src/circuit/auto-relay.js | 28 +++++++++++++++++----------- src/circuit/circuit/hop.js | 3 ++- src/identify/index.js | 1 + src/record/utils.js | 1 + src/transport-manager.js | 2 +- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/circuit/auto-relay.js b/src/circuit/auto-relay.js index bec8c3a8..c0dafc4b 100644 --- a/src/circuit/auto-relay.js +++ b/src/circuit/auto-relay.js @@ -19,10 +19,11 @@ const hopMetadataValue = 'true' class AutoRelay { /** * Creates an instance of AutoRelay. - * @constructor + * + * @class * @param {object} props * @param {Libp2p} props.libp2p - * @param {number} [props.maxListeners = 1] maximum number of relays to listen. + * @param {number} [props.maxListeners = 1] - maximum number of relays to listen. */ constructor ({ libp2p, maxListeners = 1 }) { this._libp2p = libp2p @@ -50,10 +51,11 @@ class AutoRelay { * If the protocol is not supported, check if it was supported before and remove it as a listen relay. * If the protocol is supported, check if the peer supports **HOP** and add it as a listener if * inside the threshold. + * * @param {Object} props * @param {PeerId} props.peerId * @param {Array} props.protocols - * @return {Promise} + * @returns {Promise} */ async _onProtocolChange ({ peerId, protocols }) { const id = peerId.toB58String() @@ -92,8 +94,9 @@ class AutoRelay { /** * Peer disconnects. - * @param {Connection} connection connection to the peer - * @return {void} + * + * @param {Connection} connection - connection to the peer + * @returns {void} */ _onPeerDisconnected (connection) { const peerId = connection.remotePeer @@ -109,10 +112,11 @@ class AutoRelay { /** * Attempt to listen on the given relay connection. + * * @private - * @param {Connection} connection connection to the peer - * @param {string} id peer identifier string - * @return {Promise} + * @param {Connection} connection - connection to the peer + * @param {string} id - peer identifier string + * @returns {Promise} */ async _addListenRelay (connection, id) { // Check if already listening on enough relays @@ -152,9 +156,10 @@ class AutoRelay { /** * Remove listen relay. + * * @private - * @param {string} id peer identifier string. - * @return {void} + * @param {string} id - peer identifier string. + * @returns {void} */ _removeListenRelay (id) { if (this._listenRelays.delete(id)) { @@ -169,8 +174,9 @@ class AutoRelay { * 1. Check the metadata store for known relays, try to listen on the ones we are already connected. * 2. Dial and try to listen on the peers we know that support hop but are not connected. * 3. Search the network. + * * @param {Array} [peersToIgnore] - * @return {Promise} + * @returns {Promise} */ async _listenOnAvailableHopRelays (peersToIgnore = []) { // TODO: The peer redial issue on disconnect should be handled by connection gating diff --git a/src/circuit/circuit/hop.js b/src/circuit/circuit/hop.js index 114e2768..c653a7c9 100644 --- a/src/circuit/circuit/hop.js +++ b/src/circuit/circuit/hop.js @@ -118,8 +118,9 @@ module.exports.hop = async function hop ({ /** * Performs a CAN_HOP request to a relay peer, in order to understand its capabilities. + * * @param {object} options - * @param {Connection} options.connection Connection to the relay + * @param {Connection} options.connection - Connection to the relay * @returns {Promise} */ module.exports.canHop = async function canHop ({ diff --git a/src/identify/index.js b/src/identify/index.js index 58ab2e95..289155e7 100644 --- a/src/identify/index.js +++ b/src/identify/index.js @@ -135,6 +135,7 @@ class IdentifyService { /** * Calls `push` for all peers in the `peerStore` that are connected + * * @returns {void} */ pushToPeerStore () { diff --git a/src/record/utils.js b/src/record/utils.js index 509fea7e..65696156 100644 --- a/src/record/utils.js +++ b/src/record/utils.js @@ -5,6 +5,7 @@ const PeerRecord = require('./peer-record') /** * Create (or update if existing) self peer record and store it in the AddressBook. + * * @param {libp2p} libp2p * @returns {Promise} */ diff --git a/src/transport-manager.js b/src/transport-manager.js index 654ae9d5..ab07f2ad 100644 --- a/src/transport-manager.js +++ b/src/transport-manager.js @@ -143,7 +143,7 @@ class TransportManager { * Starts listeners for each listen Multiaddr. * * @async - * @param {Array} addrs addresses to attempt to listen on + * @param {Array} addrs - addresses to attempt to listen on */ async listen (addrs) { if (!addrs || addrs.length === 0) {