Skip to content

Commit 9d0410a

Browse files
authored
fix: lint & fix some errors (mikeal#5)
1 parent 28eb5ef commit 9d0410a

File tree

8 files changed

+11
-18
lines changed

8 files changed

+11
-18
lines changed

cli.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ commands.serve = async args => {
4949
commands.seed = async args => seed(await _argv(args))
5050
*/
5151

52-
const _argv = argv({})
53-
5452
commands.build = async args => build({ ...await argv(build.schema)(args), ...nodeEnv })
5553

5654
commands.publish = async args => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ipjs": "cli.js"
99
},
1010
"scripts": {
11-
"test": "estest test/test-*.js"
11+
"test": "standard && estest test/test-*.js"
1212
},
1313
"repository": {
1414
"type": "git",

src/demo/pkg/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { readFileSync } from 'fs'
22
import Block from '@ipld/block/defaults.js'
33

4-
const schema = JSON.parse(readFileSync(new URL('./schema.json', import.meta.url)))
5-
64
const encode = obj => Block.encoder(obj, 'dag-cbor')
75

86
const createPackage = async function * (seedFile) {

src/demo/seed-lite.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import pkg from './pkg/index.js'
22
import ipfs from '@textile/ipfs-lite'
3-
import setup from '@textile/ipfs-lite/dist/setup/index.js'
43
import storage from 'interface-datastore'
54
const { Peer, BlockStore, Block } = ipfs
6-
const { setupLibP2PHost } = setup
75
const { MemoryDatastore } = storage
86

97
const store = new BlockStore(new MemoryDatastore())

src/package/dynamicImports.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const walk = (node, imports = new Set()) => {
33
if (node.type === 'ImportExpression') {
44
if (node.source.value) imports.add(node.source.value)
55
}
6-
for (const [key, value] of Object.entries(node)) {
6+
for (const [, value] of Object.entries(node)) {
77
if (Array.isArray(value)) value.forEach(v => walk(v, imports))
88
else if (typeof value === 'object') walk(value, imports)
99
}

src/package/testFile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import dynamicImports from './dynamicImports.js'
77

88
const { File, writeFile } = file
99

10-
const { readFile, mkdir } = fs
10+
const { readFile } = fs
1111
const { generate } = astring
1212

1313
const stropts = { format: { indent: { style: ' ' } } }
@@ -41,7 +41,7 @@ class TestFile extends File {
4141
const rel = p => {
4242
const u = pathToFileURL(this.pkg.cwd)
4343
const r = this.url.toString().slice(u.toString().length + 1)
44-
const pre = (r.match(/\//g) || []).map(() => '../').join('')
44+
let pre = (r.match(/\//g) || []).map(() => '../').join('')
4545
if (!pre.length) pre = './'
4646
return pre + p.slice(2)
4747
}

src/package/worker.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Worker, isMainThread, parentPort, workerData } from 'worker_threads'
2-
import { fileURLToPath, pathToFileURL } from 'url'
2+
import { fileURLToPath } from 'url'
33
import { promises as fs } from 'fs'
44
import acorn from 'acorn'
55
import astring from 'escodegen'
@@ -73,9 +73,6 @@ const run = async () => {
7373
return writeFile(url, data)
7474
}
7575

76-
let cjsCompile
77-
let esmCompile
78-
7976
const commands = {}
8077
commands.deflate = async (dist, cwd) => {
8178
const path = fileURLToPath(url)
@@ -93,8 +90,8 @@ const run = async () => {
9390
})
9491
parentPort.postMessage({ id: 'init', ret: imports })
9592
convert(cjs)
96-
cjsCompile = generate(cjs, stropts)
97-
esmCompile = generate(program, stropts)
93+
const cjsCompile = generate(cjs, stropts)
94+
const esmCompile = generate(program, stropts)
9895
}
9996

10097
let mod = null

src/run.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import pathToUrl from './path-to-url.js'
22
import api from './api.js'
33
// import IPFS from 'ipfs'
4-
import Block from '@ipld/block/defaults.js'
4+
// import Block from '@ipld/block/defaults.js'
55
import { client } from './demo/registry/index.js'
66
import { fromModule } from './util.js'
7-
import { promises as fs } from 'fs'
7+
// import { promises as fs } from 'fs'
88

9+
/*
910
const getIPFS = cid => IPFS.create({
1011
repo: `/tmp/ipjs-${cid}`,
1112
silent: true,
@@ -18,6 +19,7 @@ const getIPFS = cid => IPFS.create({
1819
}
1920
}
2021
})
22+
*/
2123

2224
const fromPackage = pkg => {
2325
const buffer = Buffer.from(pkg.nodejs)

0 commit comments

Comments
 (0)