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

Commit 69bc339

Browse files
committed
Update to standard 6
1 parent 876ab2e commit 69bc339

31 files changed

+74
-73
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"main": "src/index.js",
99
"scripts": {
10-
"lint": "standard",
10+
"lint": "standard --verbose | snazzy",
1111
"coverage": "istanbul cover --print both -- _mocha tests/test-core/index.js",
1212
"coverage:http-api": "istanbul cover --print both -- _mocha tests/test-http-api/index.js",
1313
"test": "npm run test:node && npm run test:browser",
@@ -60,7 +60,8 @@
6060
"nexpect": "^0.5.0",
6161
"pre-commit": "^1.1.2",
6262
"rimraf": "^2.4.4",
63-
"standard": "^5.4.1",
63+
"snazzy": "^3.0.0",
64+
"standard": "^6.0.7",
6465
"transform-loader": "^0.2.3",
6566
"webpack": "^2.0.7-beta"
6667
},

src/cli/commands/add.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {
8+
run: (name) => {
99
}
1010
})

src/cli/commands/bootstrap/list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = Command.extend({
1515
var node = new IPFS()
1616
node.bootstrap.list((err, list) => {
1717
if (err) { return log.error(err) }
18-
list.forEach(node => {
18+
list.forEach((node) => {
1919
console.log(node)
2020
})
2121
})

src/cli/commands/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {
8+
run: (name) => {
99
}
1010
})

src/cli/commands/daemon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ log.error = debug('cli:daemon:error')
99
module.exports = Command.extend({
1010
desc: 'Start a long-running daemon process',
1111

12-
run: name => {
12+
run: (name) => {
1313
console.log('Initializing daemon...')
1414
httpAPI.start((err) => {
1515
if (err) {

src/cli/commands/dns.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {
8+
run: (name) => {
99
}
1010
})

src/cli/commands/get.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ const Command = require('ronin').Command
33
module.exports = Command.extend({
44
desc: '',
55

6-
run: name => {
6+
run: (name) => {
77
}
88
})

src/cli/commands/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ module.exports = Command.extend({
2424
}
2525
},
2626

27-
run: name => {
27+
run: (name) => {
2828
}
2929
})

src/cli/commands/ls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {
8+
run: (name) => {
99
}
1010
})

src/cli/commands/mount.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {
8+
run: (name) => {
99
}
1010
})

src/cli/commands/ping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {
8+
run: (name) => {
99
}
1010
})

src/cli/commands/refs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {
8+
run: (name) => {
99
}
1010
})

src/cli/commands/resolve.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {
8+
run: (name) => {
99
}
1010
})

src/cli/commands/update.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {
8+
run: (name) => {
99
}
1010
})

src/http-api/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ exports.start = (callback) => {
6161
})
6262
}
6363

64-
exports.stop = callback => {
64+
exports.stop = (callback) => {
6565
const repoPath = process.env.IPFS_PATH || os.homedir() + '/.ipfs'
6666
fs.unlinkSync(repoPath + '/api')
6767
exports.server.stop(callback)

src/ipfs-core/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function IPFS (repo) {
9595
repo.config.get((err, config) => {
9696
if (err) { return callback(err) }
9797
config.Bootstrap.push(multiaddr)
98-
repo.config.set(config, err => {
98+
repo.config.set(config, (err) => {
9999
if (err) { return callback(err) }
100100

101101
callback()
@@ -105,7 +105,7 @@ function IPFS (repo) {
105105
rm: (multiaddr, callback) => {
106106
repo.config.get((err, config) => {
107107
if (err) { return callback(err) }
108-
config.Bootstrap = config.Bootstrap.filter(mh => {
108+
config.Bootstrap = config.Bootstrap.filter((mh) => {
109109
if (mh === multiaddr) {
110110
return false
111111
} else { return true }
@@ -124,7 +124,7 @@ function IPFS (repo) {
124124
replace: (config, callback) => {
125125
repo.config.set(config, callback)
126126
},
127-
show: callback => {
127+
show: (callback) => {
128128
repo.config.get((err, config) => {
129129
if (err) { return callback(err) }
130130
callback(null, config)

tests/test-cli/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ describe('cli', () => {
99
const repoExample = process.cwd() + '/tests/repo-example'
1010
const repoTests = exports.repoTests = process.cwd() + '/tests/repo-tests-run'
1111

12-
before(done => {
13-
ncp(repoExample, repoTests, err => {
12+
before((done) => {
13+
ncp(repoExample, repoTests, (err) => {
1414
process.env.IPFS_PATH = repoTests
1515
expect(err).to.equal(null)
1616
done()
1717
})
1818
})
1919

20-
after(done => {
21-
rimraf(repoTests, err => {
20+
after((done) => {
21+
rimraf(repoTests, (err) => {
2222
expect(err).to.equal(null)
2323
done()
2424
})
2525
})
2626

2727
const tests = fs.readdirSync(__dirname)
28-
tests.filter(file => {
28+
tests.filter((file) => {
2929
if (file === 'index.js' || file === 'api.js') {
3030
return false
3131
} else {
3232
return true
3333
}
34-
}).forEach(file => {
34+
}).forEach((file) => {
3535
require('./' + file)
3636
})
3737
})

tests/test-cli/test-bootstrap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('id', () => {
3030
'/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT'
3131
]
3232

33-
it('list the bootstrap nodes', done => {
33+
it('list the bootstrap nodes', (done) => {
3434
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'bootstrap', 'list'])
3535
.run((err, stdout, exitcode) => {
3636
expect(stdout).to.deep.equal(defaultList)
@@ -40,7 +40,7 @@ describe('id', () => {
4040
})
4141
})
4242

43-
it('add another bootstrap node', done => {
43+
it('add another bootstrap node', (done) => {
4444
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'bootstrap', 'add', '/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT'])
4545
.run((err, stdout, exitcode) => {
4646
expect(err).to.not.exist
@@ -56,7 +56,7 @@ describe('id', () => {
5656
})
5757
})
5858

59-
it('rm a bootstrap node', done => {
59+
it('rm a bootstrap node', (done) => {
6060
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'bootstrap', 'rm', '/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT'])
6161
.run((err, stdout, exitcode) => {
6262
expect(err).to.not.exist

tests/test-cli/test-config.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('config', () => {
1111

1212
const updatedConfig = () => JSON.parse(fs.readFileSync(configPath, 'utf8'))
1313

14-
it('get a config key value', done => {
14+
it('get a config key value', (done) => {
1515
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'Identity.PeerID'])
1616
.run((err, stdout, exitcode) => {
1717
const expected = 'QmQ2zigjQikYnyYUSXZydNXrDRhBut2mubwJBaLXobMt3A'
@@ -22,7 +22,7 @@ describe('config', () => {
2222
})
2323
})
2424

25-
it('set a config key with a string value', done => {
25+
it('set a config key with a string value', (done) => {
2626
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'foo', 'bar'])
2727
.run((err, stdout, exitcode) => {
2828
expect(err).to.not.exist
@@ -32,7 +32,7 @@ describe('config', () => {
3232
})
3333
})
3434

35-
it('set a config key with true', done => {
35+
it('set a config key with true', (done) => {
3636
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'foo', true, '--bool'])
3737
.run((err, stdout, exitcode) => {
3838
expect(err).to.not.exist
@@ -42,7 +42,7 @@ describe('config', () => {
4242
})
4343
})
4444

45-
it('set a config key with false', done => {
45+
it('set a config key with false', (done) => {
4646
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'foo', false, '--bool'])
4747
.run((err, stdout, exitcode) => {
4848
expect(err).to.not.exist
@@ -52,7 +52,7 @@ describe('config', () => {
5252
})
5353
})
5454

55-
it('set a config key with json', done => {
55+
it('set a config key with json', (done) => {
5656
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'foo', '{"bar": 0}', '--json'])
5757
.run((err, stdout, exitcode) => {
5858
expect(err).to.not.exist
@@ -62,7 +62,7 @@ describe('config', () => {
6262
})
6363
})
6464

65-
it('set a config key with invalid json', done => {
65+
it('set a config key with invalid json', (done) => {
6666
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'foo', '{"bar: 0}', '--json'])
6767
.run((err, stdout, exitcode) => {
6868
const expected = 'error\tinvalid JSON provided'
@@ -73,7 +73,7 @@ describe('config', () => {
7373
})
7474
})
7575

76-
it('call config with no arguments', done => {
76+
it('call config with no arguments', (done) => {
7777
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config'])
7878
.run((err, stdout, exitcode) => {
7979
const expected = "error\targument 'key' is required"

tests/test-cli/test-id.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('id', () => {
4848
})
4949
})
5050

51-
it('get the id', done => {
51+
it('get the id', (done) => {
5252
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'id'])
5353
.run((err, stdout, exitcode) => {
5454
var expected = [ "{ ID: 'QmQ2zigjQikYnyYUSXZydNXrDRhBut2mubwJBaLXobMt3A',",

tests/test-cli/test-version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const nexpect = require('nexpect')
55

66
describe('version', () => {
77
describe('api offline', () => {
8-
it('get the version', done => {
8+
it('get the version', (done) => {
99
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'version'])
1010
.expect('0.4.0-dev')
1111
.run((err, stdout, exitcode) => {

tests/test-core/browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ describe('IPFS Repo Tests on the Browser', function () {
4646
const testsContext = require.context('.', true, /test-*/)
4747
testsContext
4848
.keys()
49-
.forEach(key => testsContext(key))
49+
.forEach((key) => testsContext(key))
5050
})

tests/test-core/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ describe('core', () => {
99
const repoExample = process.cwd() + '/tests/repo-example'
1010
const repoTests = process.cwd() + '/tests/repo-tests-run'
1111

12-
before(done => {
13-
ncp(repoExample, repoTests, err => {
12+
before((done) => {
13+
ncp(repoExample, repoTests, (err) => {
1414
process.env.IPFS_PATH = repoTests
1515
expect(err).to.equal(null)
1616
done()
1717
})
1818
})
1919

20-
after(done => {
21-
rimraf(repoTests, err => {
20+
after((done) => {
21+
rimraf(repoTests, (err) => {
2222
expect(err).to.equal(null)
2323
done()
2424
})
2525
})
2626

2727
const tests = fs.readdirSync(__dirname)
28-
tests.filter(file => {
28+
tests.filter((file) => {
2929
if (file === 'index.js' || file === 'browser.js') {
3030
return false
3131
} else {
3232
return true
3333
}
34-
}).forEach(file => {
34+
}).forEach((file) => {
3535
require('./' + file)
3636
})
3737
})

tests/test-core/test-block.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('block', function () {
2727
done()
2828
})
2929
})
30-
it('put', done => {
30+
it('put', (done) => {
3131
var b = new Block('random data')
3232
ipfs.block.put(b, function (err) {
3333
expect(err).to.not.exist
@@ -40,7 +40,7 @@ describe('block', function () {
4040
})
4141
})
4242

43-
it('rm', done => {
43+
it('rm', (done) => {
4444
var b = new Block('I will not last long enough')
4545
ipfs.block.put(b, function (err) {
4646
expect(err).to.not.exist

tests/test-core/test-bootstrap.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ describe('bootstrap', () => {
3333
'/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT'
3434
]
3535

36-
it('get bootstrap list', done => {
36+
it('get bootstrap list', (done) => {
3737
ipfs.bootstrap.list((err, list) => {
3838
expect(err).to.not.exist
3939
expect(list).to.deep.equal(defaultList)
4040
done()
4141
})
4242
})
4343

44-
it('add a peer to the bootstrap list', done => {
45-
ipfs.bootstrap.add('/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT', err => {
44+
it('add a peer to the bootstrap list', (done) => {
45+
ipfs.bootstrap.add('/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT', (err) => {
4646
expect(err).to.not.exist
4747
ipfs.bootstrap.list((err, list) => {
4848
expect(err).to.not.exist
@@ -52,8 +52,8 @@ describe('bootstrap', () => {
5252
})
5353
})
5454

55-
it('remove a peer from the bootstrap list', done => {
56-
ipfs.bootstrap.rm('/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT', err => {
55+
it('remove a peer from the bootstrap list', (done) => {
56+
ipfs.bootstrap.rm('/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT', (err) => {
5757
expect(err).to.not.exist
5858
ipfs.bootstrap.list((err, list) => {
5959
expect(err).to.not.exist

0 commit comments

Comments
 (0)