Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 68b099c

Browse files
committed
chore: fix linting
1 parent c2d362b commit 68b099c

File tree

25 files changed

+38
-38
lines changed

25 files changed

+38
-38
lines changed

examples/browser-webpack/src/components/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ class App extends React.Component {
4949
if (err) { throw err }
5050

5151
const hash = filesAdded[0].hash
52-
self.setState({added_file_hash: hash})
52+
self.setState({ added_file_hash: hash })
5353

5454
node.files.cat(hash, (err, data) => {
5555
if (err) { throw err }
56-
self.setState({added_file_contents: data.toString()})
56+
self.setState({ added_file_contents: data.toString() })
5757
})
5858
})
5959
}
6060
}
6161
render () {
6262
return (
63-
<div style={{textAlign: 'center'}}>
63+
<div style={{ textAlign: 'center' }}>
6464
<h1>Everything is working!</h1>
6565
<p>Your ID is <strong>{this.state.id}</strong></p>
6666
<p>Your IPFS version is <strong>{this.state.version}</strong></p>

examples/run-in-electron/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const url = require('url')
1111
let mainWindow
1212

1313
function createWindow () {
14-
mainWindow = new BrowserWindow({width: 800, height: 600})
14+
mainWindow = new BrowserWindow({ width: 800, height: 600 })
1515

1616
// and load the index.html of the app.
1717
mainWindow.loadURL(url.format({

src/cli/bin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const print = utils.print
1111
const mfs = require('ipfs-mfs/cli')
1212
const debug = require('debug')('ipfs:cli')
1313

14-
const pkg = readPkgUp.sync({cwd: __dirname}).pkg
14+
const pkg = readPkgUp.sync({ cwd: __dirname }).pkg
1515
updateNotifier({
1616
pkg,
1717
updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week

src/cli/commands/file/ls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020

2121
// Single file? Then print its hash
2222
if (links.length === 0) {
23-
links = [{hash: path}]
23+
links = [{ hash: path }]
2424
}
2525

2626
links.forEach((file) => print(file.hash))

src/cli/commands/files/add.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ module.exports = {
227227
if (argv.progress) {
228228
const bar = createProgressBar(totalBytes)
229229
options.progress = function (byteLength) {
230-
bar.update(byteLength / totalBytes, {progress: byteman(byteLength, 2, 'MB')})
230+
bar.update(byteLength / totalBytes, { progress: byteman(byteLength, 2, 'MB') })
231231
}
232232
}
233233

src/cli/commands/ls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = {
3939
}
4040

4141
if (argv.headers) {
42-
links = [{hash: 'Hash', size: 'Size', name: 'Name'}].concat(links)
42+
links = [{ hash: 'Hash', size: 'Size', name: 'Name' }].concat(links)
4343
}
4444

4545
const multihashWidth = Math.max.apply(null, links.map((file) => file.hash.length))

src/cli/commands/object/get.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
},
1616

1717
handler (argv) {
18-
argv.ipfs.object.get(argv.key, {enc: 'base58'}, (err, node) => {
18+
argv.ipfs.object.get(argv.key, { enc: 'base58' }, (err, node) => {
1919
if (err) {
2020
throw err
2121
}

src/cli/commands/object/put.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const fs = require('fs')
55
const print = require('../../utils').print
66

77
function putNode (buf, enc, ipfs) {
8-
ipfs.object.put(buf, {enc: enc}, (err, node) => {
8+
ipfs.object.put(buf, { enc: enc }, (err, node) => {
99
if (err) {
1010
throw err
1111
}

src/cli/commands/repo/stat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
},
1616

1717
handler (argv) {
18-
argv.ipfs.repo.stat({human: argv.human}, (err, stats) => {
18+
argv.ipfs.repo.stat({ human: argv.human }, (err, stats) => {
1919
if (err) {
2020
throw err
2121
}

src/cli/commands/stats/repo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
},
1616

1717
handler (argv) {
18-
argv.ipfs.stats.repo({human: argv.human}, (err, stats) => {
18+
argv.ipfs.stats.repo({ human: argv.human }, (err, stats) => {
1919
if (err) {
2020
throw err
2121
}

src/core/components/bootstrap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = function bootstrap (self) {
2323
if (err) {
2424
return callback(err)
2525
}
26-
callback(null, {Peers: config.Bootstrap})
26+
callback(null, { Peers: config.Bootstrap })
2727
})
2828
}),
2929
add: promisify((multiaddr, args, callback) => {
@@ -59,7 +59,7 @@ module.exports = function bootstrap (self) {
5959
rm: promisify((multiaddr, args, callback) => {
6060
if (typeof args === 'function') {
6161
callback = args
62-
args = {all: false}
62+
args = { all: false }
6363
}
6464
if (multiaddr && !isValidMultiaddr(multiaddr)) {
6565
return setImmediate(() => callback(invalidMultiaddrError(multiaddr)))
@@ -85,7 +85,7 @@ module.exports = function bootstrap (self) {
8585
res.push(multiaddr)
8686
}
8787

88-
callback(null, {Peers: res})
88+
callback(null, { Peers: res })
8989
})
9090
})
9191
})

src/core/components/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ module.exports = function init (self) {
9898
self.log('repo opened')
9999
if (opts.pass) {
100100
self.log('creating keychain')
101-
const keychainOptions = Object.assign({passPhrase: opts.pass}, config.Keychain)
101+
const keychainOptions = Object.assign({ passPhrase: opts.pass }, config.Keychain)
102102
self._keychain = new Keychain(self._repo.keys, keychainOptions)
103103
self._keychain.importPeer('self', { privKey: privateKey }, cb)
104104
} else {

src/core/components/pin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,17 @@ module.exports = (self) => {
333333
const { recursive, direct, all } = types
334334
// recursive
335335
if ((type === recursive || type === all) && recursivePins.has(key)) {
336-
return callback(null, {pinned: true, reason: recursive})
336+
return callback(null, { pinned: true, reason: recursive })
337337
}
338338
if ((type === recursive)) {
339-
return callback(null, {pinned: false})
339+
return callback(null, { pinned: false })
340340
}
341341
// direct
342342
if ((type === direct || type === all) && directPins.has(key)) {
343-
return callback(null, {pinned: true, reason: direct})
343+
return callback(null, { pinned: true, reason: direct })
344344
}
345345
if ((type === direct)) {
346-
return callback(null, {pinned: false})
346+
return callback(null, { pinned: false })
347347
}
348348

349349
// indirect (default)

src/core/components/pre-start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = function preStart (self) {
4848
if (self._keychain) {
4949
// most likely an init or upgrade has happened
5050
} else if (pass) {
51-
const keychainOptions = Object.assign({passPhrase: pass}, config.Keychain)
51+
const keychainOptions = Object.assign({ passPhrase: pass }, config.Keychain)
5252
self._keychain = new Keychain(self._repo.keys, keychainOptions)
5353
self.log('keychain constructed')
5454
} else {

src/core/runtime/dns-browser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global self */
12
'use strict'
23

34
module.exports = (domain, opts, callback) => {
@@ -8,7 +9,7 @@ module.exports = (domain, opts, callback) => {
89
url += `&${prop}=${opts[prop]}`
910
}
1011

11-
self.fetch(url, {mode: 'cors'})
12+
self.fetch(url, { mode: 'cors' })
1213
.then((response) => {
1314
return response.json()
1415
})

src/core/runtime/libp2p-browser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const defaultsDeep = require('@nodeutils/defaults-deep')
1111

1212
class Node extends libp2p {
1313
constructor (_options) {
14-
const wrtcstar = new WebRTCStar({id: _options.peerInfo.id})
15-
const wsstar = new WebSocketStar({id: _options.peerInfo.id})
14+
const wrtcstar = new WebRTCStar({ id: _options.peerInfo.id })
15+
const wsstar = new WebSocketStar({ id: _options.peerInfo.id })
1616

1717
const defaults = {
1818
modules: {

src/core/runtime/libp2p-nodejs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const defaultsDeep = require('@nodeutils/defaults-deep')
1313

1414
class Node extends libp2p {
1515
constructor (_options) {
16-
const wsstar = new WebSocketStar({id: _options.peerInfo.id})
16+
const wsstar = new WebSocketStar({ id: _options.peerInfo.id })
1717

1818
const defaults = {
1919
modules: {

src/http/api/resources/bootstrap.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ exports.add = {
3838
return applyError(reply, new Error('Not a valid multiaddr'))
3939
}
4040
} else {
41-
reply({default: def})
41+
reply({ default: def })
4242
}
4343
},
4444
handler (request, reply) {
4545
const ipfs = request.server.app.ipfs
4646
const addr = request.pre.args.addr
4747
const def = request.pre.args.default
4848

49-
ipfs.bootstrap.add(addr && addr.toString(), {default: def}, (err, list) => {
49+
ipfs.bootstrap.add(addr && addr.toString(), { default: def }, (err, list) => {
5050
if (err) {
5151
return applyError(reply, err)
5252
}
@@ -71,15 +71,15 @@ exports.rm = {
7171
return applyError(reply, new Error('Not a valid multiaddr'))
7272
}
7373
} else {
74-
reply({all: all})
74+
reply({ all: all })
7575
}
7676
},
7777
handler (request, reply) {
7878
const ipfs = request.server.app.ipfs
7979
const addr = request.pre.args.addr
8080
const all = request.pre.args.all
8181

82-
ipfs.bootstrap.rm(addr && addr.toString(), {all: all}, (err, list) => {
82+
ipfs.bootstrap.rm(addr && addr.toString(), { all: all }, (err, list) => {
8383
if (err) {
8484
return applyError(reply, err)
8585
}

src/http/api/resources/files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ exports.cat = {
8383
if (err) {
8484
log.error(err)
8585
if (err.message === 'No such file') {
86-
reply({Message: 'No such file', Code: 0, Type: 'error'}).code(500)
86+
reply({ Message: 'No such file', Code: 0, Type: 'error' }).code(500)
8787
} else {
88-
reply({Message: 'Failed to cat file: ' + err, Code: 0, Type: 'error'}).code(500)
88+
reply({ Message: 'Failed to cat file: ' + err, Code: 0, Type: 'error' }).code(500)
8989
}
9090
return
9191
}

src/http/api/resources/pin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ exports.ls = {
4848
return reply({
4949
Keys: _.mapValues(
5050
_.keyBy(result, obj => obj.hash),
51-
obj => ({Type: obj.type})
51+
obj => ({ Type: obj.type })
5252
)
5353
})
5454
})

src/http/api/resources/ping.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const Joi = require('joi')
44
const pull = require('pull-stream')
5-
const pullatch = require('pull-catch')
65
const toStream = require('pull-stream-to-stream')
76
const ndjson = require('pull-ndjson')
87
const PassThrough = require('readable-stream').PassThrough

src/http/api/resources/repo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ exports.stat = (request, reply) => {
3838
const ipfs = request.server.app.ipfs
3939
const human = request.query.human === 'true'
4040

41-
ipfs.repo.stat({human: human}, (err, stat) => {
41+
ipfs.repo.stat({ human: human }, (err, stat) => {
4242
if (err) {
4343
return reply({
4444
Message: err.toString(),

src/http/api/resources/swarm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ exports.peers = {
3939
const verbose = rawVerbose === 'true'
4040
const ipfs = request.server.app.ipfs
4141

42-
ipfs.swarm.peers({verbose: verbose}, (err, peers) => {
42+
ipfs.swarm.peers({ verbose: verbose }, (err, peers) => {
4343
if (err) {
4444
log.error(err)
4545
return reply({

test/core/libp2p.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('libp2p customization', function () {
7373
config: mockConfig,
7474
_options: {
7575
libp2p: (opts) => {
76-
const wsstar = new WebSocketStar({id: opts.peerInfo.id})
76+
const wsstar = new WebSocketStar({ id: opts.peerInfo.id })
7777

7878
return new Libp2p({
7979
peerInfo: opts.peerInfo,
@@ -147,7 +147,7 @@ describe('libp2p customization', function () {
147147
})
148148

149149
it('should allow for overriding via options', (done) => {
150-
const wsstar = new WebSocketStar({id: peerInfo.id})
150+
const wsstar = new WebSocketStar({ id: peerInfo.id })
151151

152152
const ipfs = {
153153
_peerInfo: peerInfo,

test/gateway/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe('HTTP Gateway', function () {
9393
(cb) => {
9494
const expectedMultihash = 'QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o'
9595

96-
http.api.node.files.add(Buffer.from('hello world' + '\n'), {cidVersion: 0}, (err, res) => {
96+
http.api.node.files.add(Buffer.from('hello world' + '\n'), { cidVersion: 0 }, (err, res) => {
9797
expect(err).to.not.exist()
9898
const file = res[0]
9999
expect(file.path).to.equal(expectedMultihash)

0 commit comments

Comments
 (0)