Skip to content
This repository was archived by the owner on Aug 23, 2019. It is now read-only.

Commit 5ce0b36

Browse files
authored
chore: update deps and fix lint (#342)
* chore: update deps and fix lint * test: fix tests after webrtc-star upgrade
1 parent f64c73b commit 5ce0b36

File tree

14 files changed

+52
-38
lines changed

14 files changed

+52
-38
lines changed

.aegir.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ function pre (done) {
6464
}
6565

6666
parallel([
67-
(cb) => {
68-
sigS = sigServer.start(sigOptions, cb)
67+
async () => {
68+
sigS = await sigServer.start(sigOptions)
6969
},
7070
(cb) => createA(cb),
7171
(cb) => createB(cb)
@@ -76,7 +76,9 @@ function post (done) {
7676
parallel([
7777
(cb) => switchA.stop(cb),
7878
(cb) => switchB.stop(cb),
79-
(cb) => sigS.stop(cb)
79+
async () => {
80+
await sigS.stop()
81+
}
8082
], done)
8183
}
8284

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"npm": ">=3.0.0"
4141
},
4242
"devDependencies": {
43-
"aegir": "^18.2.1",
43+
"aegir": "^20.0.0",
4444
"chai": "^4.2.0",
4545
"chai-checkmark": "^1.0.1",
4646
"dirty-chai": "^2.0.1",
@@ -49,14 +49,14 @@
4949
"libp2p-secio": "~0.11.1",
5050
"libp2p-spdy": "~0.13.3",
5151
"libp2p-tcp": "~0.13.0",
52-
"libp2p-webrtc-star": "~0.15.8",
52+
"libp2p-webrtc-star": "~0.16.1",
5353
"libp2p-websockets": "~0.12.2",
5454
"peer-book": "~0.9.1",
5555
"portfinder": "^1.0.20",
56-
"pull-length-prefixed": "^1.3.2",
56+
"pull-length-prefixed": "^1.3.3",
5757
"pull-mplex": "~0.1.2",
5858
"pull-pair": "^1.1.0",
59-
"sinon": "^7.3.1",
59+
"sinon": "^7.3.2",
6060
"webrtcsupport": "^2.2.0"
6161
},
6262
"dependencies": {
@@ -71,12 +71,12 @@
7171
"libp2p-circuit": "~0.3.6",
7272
"libp2p-identify": "~0.7.6",
7373
"moving-average": "^1.0.0",
74-
"multiaddr": "^6.0.6",
75-
"multistream-select": "~0.14.4",
74+
"multiaddr": "^6.1.0",
75+
"multistream-select": "~0.14.6",
7676
"once": "^1.4.0",
7777
"peer-id": "~0.12.2",
7878
"peer-info": "~0.15.1",
79-
"pull-stream": "^3.6.9",
79+
"pull-stream": "^3.6.13",
8080
"retimer": "^2.0.0"
8181
},
8282
"contributors": [

src/connection/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class ConnectionFSM extends BaseConnection {
215215
}
216216

217217
const nextTransport = (key) => {
218-
let transport = key
218+
const transport = key
219219
if (!transport) {
220220
if (!circuitEnabled) {
221221
return this.close(
@@ -271,7 +271,7 @@ class ConnectionFSM extends BaseConnection {
271271

272272
delete this.switch.conns[this.theirB58Id]
273273

274-
let tasks = []
274+
const tasks = []
275275

276276
// Clean up stored connections
277277
if (this.muxer) {

src/dialer/queue.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class Queue {
7373
this.isRunning = false
7474
this.onStopped = onStopped
7575
}
76+
7677
get length () {
7778
return this._queue.length
7879
}
@@ -139,7 +140,7 @@ class Queue {
139140
*/
140141
abort () {
141142
while (this.length > 0) {
142-
let dial = this._queue.shift()
143+
const dial = this._queue.shift()
143144
dial.callback(DIAL_ABORTED())
144145
}
145146
this.stop()
@@ -223,8 +224,8 @@ class Queue {
223224
})
224225

225226
const peerInfo = this.switch._peerBook.get(this.id)
226-
let queuedDial = this._queue.shift()
227-
let { connectionFSM, didCreate } = this._getOrCreateConnection(peerInfo)
227+
const queuedDial = this._queue.shift()
228+
const { connectionFSM, didCreate } = this._getOrCreateConnection(peerInfo)
228229

229230
// If the dial expects a ConnectionFSM, we can provide that back now
230231
if (queuedDial.useFSM) {

src/dialer/queueManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class DialQueueManager {
171171
return
172172
}
173173

174-
let targetQueue = this._queues[nextQueue.value]
174+
const targetQueue = this._queues[nextQueue.value]
175175

176176
if (!targetQueue) {
177177
log('missing queue %s, maybe it was aborted?', nextQueue.value)

src/limit-dialer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class LimitDialer {
3838
// we use a token to track if we want to cancel following dials
3939
const token = { cancel: false }
4040

41-
let errors = []
41+
const errors = []
4242
const tasks = addrs.map((m) => {
4343
return (cb) => this.dialSingle(peer, transport, m, token, (err, result) => {
4444
if (err) {

src/stats/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ module.exports = (observer, _options) => {
124124

125125
globalStats.start()
126126

127-
for (let peerStat of peerStats.values()) {
127+
for (const peerStat of peerStats.values()) {
128128
peerStat.start()
129129
}
130-
for (let transportStat of transportStats.values()) {
130+
for (const transportStat of transportStats.values()) {
131131
transportStat.start()
132132
}
133133
}
@@ -136,10 +136,10 @@ module.exports = (observer, _options) => {
136136
observer.removeListener('message', onMessage)
137137
globalStats.stop()
138138

139-
for (let peerStat of peerStats.values()) {
139+
for (const peerStat of peerStats.values()) {
140140
peerStat.stop()
141141
}
142-
for (let transportStat of transportStats.values()) {
142+
for (const transportStat of transportStats.values()) {
143143
transportStat.stop()
144144
}
145145
}

src/stats/stat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class Stats extends EventEmitter {
222222

223223
let n
224224

225-
if (!this._stats.hasOwnProperty(key)) {
225+
if (!Object.prototype.hasOwnProperty.call(this._stats, key)) {
226226
n = this._stats[key] = Big(0)
227227
} else {
228228
n = this._stats[key]

test/dialSelf.spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ class MockTransport extends EventEmitter {
2020
super()
2121
this.conn = Duplex()
2222
}
23+
2324
dial (addr, cb) {
24-
let c = this.conn[0]
25+
const c = this.conn[0]
2526
this.emit('connection', this.conn[1])
2627
setImmediate(() => cb(null, c))
2728
return c
2829
}
30+
2931
listen (addr, cb) {
3032
return cb()
3133
}
34+
3235
filter (mas) {
3336
return Array.isArray(mas) ? mas : [mas]
3437
}

test/get-peer-info.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ describe('Get peer info', () => {
3333
})
3434

3535
it('should be able get peer info from multiaddr', () => {
36-
let _peerInfo = getPeerInfo(multiaddrA, peerBook)
36+
const _peerInfo = getPeerInfo(multiaddrA, peerBook)
3737
expect(peerBook.has(_peerInfo)).to.equal(true)
3838
expect(peerInfoA).to.deep.equal(_peerInfo)
3939
})
4040

4141
it('should return a new PeerInfo with a multiAddr not in the PeerBook', () => {
42-
let wrongMultiAddr = MultiAddr('/ipfs/QmckZzdVd72h9QUFuJJpQqhsZqGLwjhh81qSvZ9BhB2FQi')
43-
let _peerInfo = getPeerInfo(wrongMultiAddr, peerBook)
42+
const wrongMultiAddr = MultiAddr('/ipfs/QmckZzdVd72h9QUFuJJpQqhsZqGLwjhh81qSvZ9BhB2FQi')
43+
const _peerInfo = getPeerInfo(wrongMultiAddr, peerBook)
4444
expect(PeerInfo.isPeerInfo(_peerInfo)).to.equal(true)
4545
expect(peerBook.has(_peerInfo)).to.equal(false)
4646
})
4747

4848
it('should be able get peer info from peer id', () => {
49-
let _peerInfo = getPeerInfo(multiaddrA, peerBook)
49+
const _peerInfo = getPeerInfo(multiaddrA, peerBook)
5050
expect(peerBook.has(_peerInfo)).to.equal(true)
5151
expect(peerInfoA).to.deep.equal(_peerInfo)
5252
})
5353

5454
it('should not be able to get the peer info for a wrong peer id', (done) => {
5555
PeerId.createFromJSON(TestPeerInfos[1].id, (err, id) => {
56-
let func = () => {
56+
const func = () => {
5757
getPeerInfo(id, peerBook)
5858
}
5959

@@ -93,7 +93,7 @@ describe('Get peer info', () => {
9393
})
9494

9595
it('an invalid peer type should throw an error', () => {
96-
let func = () => {
96+
const func = () => {
9797
getPeerInfo('/ip4/127.0.0.1/tcp/1234', peerBook)
9898
}
9999

0 commit comments

Comments
 (0)