Skip to content

Commit 6a7dbc6

Browse files
committed
yet another attempt to make tools happy
1 parent 434f4c0 commit 6a7dbc6

7 files changed

Lines changed: 23 additions & 32 deletions

File tree

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@
130130
"standard": {
131131
"ignore": [
132132
"dist",
133-
"vendor",
134-
"**/interface.js"
133+
"vendor"
135134
]
136135
},
137136
"directories": {

src/block.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { bytes as binary, CID } from './index.js'
22
// Linter can see that API is used in types.
33
// eslint-disable-next-line
44
import * as API from './interface.js'
5+
// eslint-disable-next-line
6+
import * as BlockAPI from './block/interface.js'
57

68
const readonly = ({ enumerable = true, configurable = false } = {}) => ({
79
enumerable,
@@ -224,7 +226,7 @@ const createUnsafe = ({ bytes, cid, value: maybeValue, codec }) => {
224226
* @param {API.ByteView<T>} options.bytes
225227
* @param {API.BlockDecoder<Code, T>} options.codec
226228
* @param {API.MultihashHasher<Alg>} options.hasher
227-
* @returns {Promise<API.BlockView<T, Code, Alg, V>>}
229+
* @returns {Promise<BlockAPI.BlockView<T, Code, Alg, V>>}
228230
*/
229231
const create = async ({ bytes, cid, hasher, codec }) => {
230232
if (!bytes) throw new Error('Missing required argument "bytes"')

src/codecs/json.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
// @ts-check
2-
3-
/**
4-
* @template T
5-
* @typedef {import('./interface').ByteView<T>} ByteView
6-
*/
1+
// eslint-disable-next-line
2+
import * as API from './interface.js'
73

84
const textEncoder = new TextEncoder()
95
const textDecoder = new TextDecoder()
@@ -14,13 +10,13 @@ export const code = 0x0200
1410
/**
1511
* @template T
1612
* @param {T} node
17-
* @returns {ByteView<T>}
13+
* @returns {API.ByteView<T>}
1814
*/
19-
export const encode = (node) => textEncoder.encode(JSON.stringify(node))
15+
export const encode = node => textEncoder.encode(JSON.stringify(node))
2016

2117
/**
2218
* @template T
23-
* @param {ByteView<T>} data
19+
* @param {API.ByteView<T>} data
2420
* @returns {T}
2521
*/
26-
export const decode = (data) => JSON.parse(textDecoder.decode(data))
22+
export const decode = data => JSON.parse(textDecoder.decode(data))

src/codecs/raw.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
// @ts-check
2-
1+
// eslint-disable-next-line
2+
import * as API from './interface.js'
33
import { coerce } from '../bytes.js'
44

5-
/**
6-
* @template T
7-
* @typedef {import('./interface').ByteView<T>} ByteView
8-
*/
9-
105
export const name = 'raw'
116
export const code = 0x55
127

138
/**
149
* @param {Uint8Array} node
15-
* @returns {ByteView<Uint8Array>}
10+
* @returns {API.ByteView<Uint8Array>}
1611
*/
17-
export const encode = (node) => coerce(node)
12+
export const encode = node => coerce(node)
1813

1914
/**
20-
* @param {ByteView<Uint8Array>} data
15+
* @param {API.ByteView<Uint8Array>} data
2116
* @returns {Uint8Array}
2217
*/
23-
export const decode = (data) => coerce(data)
18+
export const decode = data => coerce(data)

src/hashes/hasher.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import * as Digest from './digest.js'
2+
// eslint-disable-next-line
3+
import * as API from './interface.js'
24

35
/**
46
* @template {string} Name
@@ -17,7 +19,7 @@ export const from = ({ name, code, encode }) => new Hasher(name, code, encode)
1719
* @template {string} Name
1820
* @template {number} Code
1921
* @class
20-
* @implements {MultihashHasher<Code>}
22+
* @implements {API.MultihashHasher<Code>}
2123
*/
2224
export class Hasher {
2325
/**
@@ -50,11 +52,6 @@ export class Hasher {
5052
}
5153
}
5254

53-
/**
54-
* @template {number} Alg
55-
* @typedef {import('./interface').MultihashHasher} MultihashHasher
56-
*/
57-
5855
/**
5956
* @template T
6057
* @typedef {Promise<T>|T} Await

src/hashes/interface.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
// this is dummy module overlayed by interface.ts
2+
// just trying to stop eslint from campaining about
3+
// no named exports
4+
// eslint-disable-next-line no-void, no-shadow-restricted-names
5+
export const undefined = void 0

src/hashes/sha2.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// @ts-check
2-
31
import crypto from 'crypto'
42
import { from } from './hasher.js'
53
import { coerce } from '../bytes.js'

0 commit comments

Comments
 (0)