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

Commit daf40cb

Browse files
committed
chore: fix linting
1 parent 3de94a5 commit daf40cb

28 files changed

+117
-91
lines changed

src/cli/commands/daemon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module.exports = {
8080
print('Daemon is ready')
8181

8282
const cleanup = async () => {
83-
print(`Received interrupt signal, shutting down...`)
83+
print('Received interrupt signal, shutting down...')
8484
await daemon.stop()
8585
process.exit(0)
8686
}

src/cli/commands/file/ls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
argv.resolve((async () => {
1212
const path = argv.key
1313
// `ipfs file ls` is deprecated. See https://ipfs.io/docs/commands/#ipfs-file-ls
14-
argv.print(`This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.`)
14+
argv.print('This functionality is deprecated, and will be removed in future versions. If possible, please use \'ipfs ls\' instead.')
1515

1616
const ipfs = await argv.getIpfs()
1717
let links = await ipfs.ls(path)

src/cli/commands/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = {
5757
})
5858
} catch (err) {
5959
if (err.code === 'EACCES') {
60-
err.message = `EACCES: permission denied, stat $IPFS_PATH/version`
60+
err.message = 'EACCES: permission denied, stat $IPFS_PATH/version'
6161
}
6262
throw err
6363
}

src/cli/commands/version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ module.exports = {
1717
commit: {
1818
type: 'boolean',
1919
default: false,
20-
describe: `Include the version's commit hash`
20+
describe: 'Include the version\'s commit hash'
2121
},
2222
repo: {
2323
type: 'boolean',
2424
default: false,
25-
describe: `Print only the repo's version number`
25+
describe: 'Print only the repo\'s version number'
2626
},
2727
all: {
2828
type: 'boolean',

src/core/components/pin/gc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function createMarkedSet (ipfs, callback) {
7777
(cb) => ipfs._repo.root.get(MFS_ROOT_KEY, (err, mh) => {
7878
if (err) {
7979
if (err.code === 'ERR_NOT_FOUND') {
80-
log(`No blocks in MFS`)
80+
log('No blocks in MFS')
8181
return cb(null, [])
8282
}
8383
return cb(expErr(err, 'Could not get MFS root from datastore'))

src/core/components/pin/pin-manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class PinManager {
274274
this.repo.datastore.get(PIN_DS_KEY, (err, mh) => {
275275
if (err) {
276276
if (err.code === 'ERR_NOT_FOUND') {
277-
this.log(`No pinned blocks`)
277+
this.log('No pinned blocks')
278278
return callback(null, [])
279279
}
280280
return callback(new Error(`Could not get pin sets root from datastore: ${err.message}`))

src/core/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const s = superstruct({
2121

2222
return true
2323
},
24-
'multiaddr-ipfs': v => mafmt.IPFS.matches(v) ? true : `multiaddr IPFS invalid`
24+
'multiaddr-ipfs': v => mafmt.IPFS.matches(v) ? true : 'multiaddr IPFS invalid'
2525
}
2626
})
2727

src/core/ipns/publisher.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class IpnsPublisher {
4848

4949
_putRecordToRouting (record, peerId, callback) {
5050
if (!(PeerId.isPeerId(peerId))) {
51-
const errMsg = `peerId received is not valid`
51+
const errMsg = 'peerId received is not valid'
5252

5353
log.error(errMsg)
5454
return callback(errcode(new Error(errMsg), 'ERR_INVALID_PEER_ID'))
@@ -87,7 +87,7 @@ class IpnsPublisher {
8787

8888
_publishEntry (key, entry, peerId, callback) {
8989
if (!(Key.isKey(key))) {
90-
const errMsg = `datastore key does not have a valid format`
90+
const errMsg = 'datastore key does not have a valid format'
9191

9292
log.error(errMsg)
9393
return callback(errcode(new Error(errMsg), 'ERR_INVALID_DATASTORE_KEY'))
@@ -118,14 +118,14 @@ class IpnsPublisher {
118118

119119
_publishPublicKey (key, publicKey, peerId, callback) {
120120
if ((!Key.isKey(key))) {
121-
const errMsg = `datastore key does not have a valid format`
121+
const errMsg = 'datastore key does not have a valid format'
122122

123123
log.error(errMsg)
124124
return callback(errcode(new Error(errMsg), 'ERR_INVALID_DATASTORE_KEY'))
125125
}
126126

127127
if (!publicKey || !publicKey.bytes) {
128-
const errMsg = `one or more of the provided parameters are not defined`
128+
const errMsg = 'one or more of the provided parameters are not defined'
129129

130130
log.error(errMsg)
131131
return callback(errcode(new Error(errMsg), 'ERR_UNDEFINED_PARAMETER'))
@@ -149,7 +149,7 @@ class IpnsPublisher {
149149
// If `checkRouting` is true and we have no existing record, this method will check the routing system for any existing records.
150150
_getPublished (peerId, options, callback) {
151151
if (!(PeerId.isPeerId(peerId))) {
152-
const errMsg = `peerId received is not valid`
152+
const errMsg = 'peerId received is not valid'
153153

154154
log.error(errMsg)
155155
return callback(errcode(new Error(errMsg), 'ERR_INVALID_PEER_ID'))
@@ -209,7 +209,7 @@ class IpnsPublisher {
209209

210210
_updateOrCreateRecord (privKey, value, validity, peerId, callback) {
211211
if (!(PeerId.isPeerId(peerId))) {
212-
const errMsg = `peerId received is not valid`
212+
const errMsg = 'peerId received is not valid'
213213

214214
log.error(errMsg)
215215
return callback(errcode(new Error(errMsg), 'ERR_INVALID_PEER_ID'))

src/core/ipns/republisher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class IpnsRepublisher {
167167
record = ipns.unmarshal(dsVal)
168168
} catch (err) {
169169
log.error(err)
170-
return callback(errcode(new Error(`found ipns record that we couldn't convert to a value`), 'ERR_INVALID_IPNS_RECORD'))
170+
return callback(errcode(new Error('found ipns record that we couldn\'t convert to a value'), 'ERR_INVALID_IPNS_RECORD'))
171171
}
172172

173173
callback(null, record.value)

src/core/ipns/resolver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class IpnsResolver {
108108
ipnsEntry = ipns.unmarshal(record)
109109
} catch (err) {
110110
log.error(err)
111-
return callback(errcode(new Error(`found ipns record that we couldn't convert to a value`), 'ERR_INVALID_RECORD_RECEIVED'))
111+
return callback(errcode(new Error('found ipns record that we couldn\'t convert to a value'), 'ERR_INVALID_RECORD_RECEIVED'))
112112
}
113113

114114
// if the record has a public key validate it
@@ -131,7 +131,7 @@ class IpnsResolver {
131131
peerId.pubKey = crypto.keys.unmarshalPublicKey(pubKey)
132132
} catch (err) {
133133
log.error(err)
134-
return callback(errcode(new Error(`found public key record that we couldn't convert to a value`), 'ERR_INVALID_PUB_KEY_RECEIVED'))
134+
return callback(errcode(new Error('found public key record that we couldn\'t convert to a value'), 'ERR_INVALID_PUB_KEY_RECEIVED'))
135135
}
136136

137137
this._validateRecord(peerId, ipnsEntry, callback)

test/cli/file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ describe('file ls', () => runOnAndOff((thing) => {
1818
it('prints a filename', () => {
1919
return ipfs(`file ls ${file}`)
2020
.then((out) => expect(out).to.eql(
21-
`This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.\n` +
21+
'This functionality is deprecated, and will be removed in future versions. If possible, please use \'ipfs ls\' instead.\n' +
2222
`${file}\n`
2323
))
2424
})
2525

2626
it('prints the filenames in a directory', () => {
2727
return ipfs(`file ls ${dir}`)
2828
.then((out) => expect(out).to.eql(
29-
`This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.\n` +
29+
'This functionality is deprecated, and will be removed in future versions. If possible, please use \'ipfs ls\' instead.\n' +
3030
'QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT\n' +
3131
'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN\n' +
3232
'QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv\n' +

test/cli/files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ describe('files', () => runOnAndOff((thing) => {
246246
it('add with cid-version=1 and raw-leaves=false < default max chunk size', function () {
247247
this.timeout(30 * 1000)
248248

249-
return ipfs(`add test/fixtures/less-than-default-max-chunk-size --cid-version=1 --raw-leaves=false`)
249+
return ipfs('add test/fixtures/less-than-default-max-chunk-size --cid-version=1 --raw-leaves=false')
250250
.then((out) => {
251251
expect(out)
252252
.to.eql('added bafybeiaoh5okvpnuhndsz4kgdhulnkm566rz7w7il6r2zm6wxu5f5uqlsu less-than-default-max-chunk-size\n')
@@ -256,7 +256,7 @@ describe('files', () => runOnAndOff((thing) => {
256256
it('add with cid-version=1 and raw-leaves=false > default max chunk size', function () {
257257
this.timeout(30 * 1000)
258258

259-
return ipfs(`add test/fixtures/greater-than-default-max-chunk-size --cid-version=1 --raw-leaves=false`)
259+
return ipfs('add test/fixtures/greater-than-default-max-chunk-size --cid-version=1 --raw-leaves=false')
260260
.then((out) => {
261261
expect(out)
262262
.to.eql('added bafybeiajpcrr2qglyeq3biilzt25ty6kpjs7huy2lfxopqfke6riaaxnim greater-than-default-max-chunk-size\n')

test/cli/gc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('gc', () => {
3434
const errMsg = 'some err'
3535
const printSpy = setupMocks(cids, errMsg)
3636

37-
await cli.parse(`repo gc`)
37+
await cli.parse('repo gc')
3838

3939
const exp = cids.map(c => 'removed ' + c).concat(errMsg)
4040
for (let i = 0; i < exp.length; i++) {
@@ -49,7 +49,7 @@ describe('gc', () => {
4949
]
5050
const printSpy = setupMocks(cids)
5151

52-
await cli.parse(`repo gc --quiet`)
52+
await cli.parse('repo gc --quiet')
5353

5454
const exp = cids.map(c => c.toString())
5555
for (let i = 0; i < exp.length; i++) {
@@ -60,7 +60,7 @@ describe('gc', () => {
6060
it('gc with --stream-errors=false does not print errors', async () => {
6161
const printSpy = setupMocks([], 'some err')
6262

63-
await cli.parse(`repo gc --stream-errors=false`)
63+
await cli.parse('repo gc --stream-errors=false')
6464
sinon.assert.notCalled(printSpy)
6565
})
6666
})

test/cli/name.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('name', () => {
3131
// Force the next require to not use require cache
3232
clearModule('../../src/cli/commands/name/resolve.js')
3333

34-
await cli.parse(`name resolve test`)
34+
await cli.parse('name resolve test')
3535
sinon.assert.calledWith(resolveFake, 'test', { nocache: false, recursive: true })
3636
})
3737

@@ -47,7 +47,7 @@ describe('name', () => {
4747
// Force the next require to not use require cache
4848
clearModule('../../src/cli/commands/name/publish.js')
4949

50-
await cli.parse(`name publish test --silent`)
50+
await cli.parse('name publish test --silent')
5151
sinon.assert.calledWith(printSpy, 'Published to name: value')
5252
sinon.assert.calledWith(publishFake, 'test', {
5353
resolve: true,

test/cli/swarm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ describe('swarm', () => {
128128
promise.then(({ data }) => {
129129
expect(data).to.eql([
130130
`${peerInfo.id.toB58String()} (2)`,
131-
`\t/ip4/127.0.0.1/tcp/4001`,
132-
`\t/ip4/127.0.0.1/tcp/4001/ws`
131+
'\t/ip4/127.0.0.1/tcp/4001',
132+
'\t/ip4/127.0.0.1/tcp/4001/ws'
133133
].join('\n'))
134134
done()
135135
})

test/core/bitswap.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function addNode (fDaemon, inProcNode, callback) {
7070
initOptions: { bits: 512 },
7171
config: {
7272
Addresses: {
73-
Swarm: [`/ip4/127.0.0.1/tcp/0/ws`]
73+
Swarm: ['/ip4/127.0.0.1/tcp/0/ws']
7474
},
7575
Discovery: {
7676
MDNS: {

test/core/circuit-relay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const wsAddr = (addrs) => addrs.map((a) => a.toString()).find((a) => a.includes(
5757
const tcpAddr = (addrs) => addrs.map((a) => a.toString()).find((a) => !a.includes('/ws'))
5858

5959
describe('circuit relay', () => {
60-
describe(`A <-> R <-> B`, function () {
60+
describe('A <-> R <-> B', function () {
6161
this.timeout(80 * 1000)
6262

6363
let nodeA

test/core/pin-set.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ describe('pinSet', function () {
183183
})
184184

185185
describe('walkItems', function () {
186-
it(`fails if node doesn't have a pin-set protobuf header`, function (done) {
186+
it('fails if node doesn\'t have a pin-set protobuf header', function (done) {
187187
createNode('datum', (err, node) => {
188188
expect(err).to.not.exist()
189189

0 commit comments

Comments
 (0)