Skip to content

Commit

Permalink
docs: remove useless @returns from several functions
Browse files Browse the repository at this point in the history
*This is a minor, JSDoc-only change.*

`@returns` by itself doesn't do much in JSDoc. This either removes those
directives or adds their return type.
  • Loading branch information
EvanHahn committed Jul 30, 2024
1 parent 3ac3f65 commit 4d83538
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/blob-store/live-download.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export class DriveLiveDownload extends TypedEmitter {
*
* @param {Iterable<{ state: BlobDownloadState | BlobDownloadStateError }>} liveDownloads
* @param {{ signal?: AbortSignal }} options
* @returns
* @returns {BlobDownloadState | BlobDownloadStateError}
*/
export function combineStates(liveDownloads, { signal } = {}) {
/** @type {BlobDownloadState | BlobDownloadStateError} */
Expand Down
2 changes: 1 addition & 1 deletion src/core-manager/bitfield-rle.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function encodeFinal(state) {
* @param {number} i
* @param {number} len
* @param {number} bit
* @returns
* @returns {void}
*/
function encodeUpdate(state, i, len, bit) {
const headLength = i - len - state.inputOffset
Expand Down
1 change: 0 additions & 1 deletion src/core-manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ export class CoreManager extends TypedEmitter {
* Replicate all cores in core manager
*
* @param {Parameters<Corestore['replicate']>[0]} stream
* @returns
*/
[kCoreManagerReplicate](stream) {
const protocolStream = Hypercore.createProtocolStream(stream, {
Expand Down
4 changes: 2 additions & 2 deletions src/core-manager/remote-bitfield.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RemoteBitfieldPage {
/**
*
* @param {number} index
* @returns
* @returns {boolean}
*/
get(index) {
return quickbit.get(this.bitfield, index)
Expand Down Expand Up @@ -373,7 +373,7 @@ export default class RemoteBitfield {
/**
* @param {number} start
* @param {Uint32Array} bitfield
* @returns
* @returns {boolean}
*/
insert(start, bitfield) {
if (start % 32 !== 0) return false
Expand Down
2 changes: 1 addition & 1 deletion src/discovery/local-discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class LocalDiscovery extends TypedEmitter {
/**
*
* @param {OpenedNoiseStream} conn
* @returns
* @returns {void}
*/
#handleNoiseStreamConnection(conn) {
const { remotePublicKey, isInitiator } = conn
Expand Down
1 change: 0 additions & 1 deletion src/mapeo-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ export class MapeoProject extends TypedEmitter {
* need to replicate the manager instance via manager[kManagerReplicate])
*
* @param {Parameters<import('hypercore')['replicate']>[0]} stream A duplex stream, a @hyperswarm/secret-stream, or a Protomux instance
* @returns
*/
[kProjectReplicate](stream) {
// @ts-expect-error - hypercore types need updating
Expand Down
2 changes: 1 addition & 1 deletion test-e2e/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ async function waitForProjectSync(project, peerIds, type = 'initial') {
/**
* @param {Record<string, unknown>} remoteStates
* @param {string[]} peerIds
* @returns
* @returns {boolean}
*/
function hasPeerIds(remoteStates, peerIds) {
for (const peerId of peerIds) {
Expand Down
2 changes: 0 additions & 2 deletions tests/core-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,6 @@ async function countOpenFileDescriptors(dir) {
* @param {Hypercore} a
* @param {Hypercore} b
* @param {Parameters<typeof Hypercore.prototype.replicate>[1] & { delay?: number }} [opts]
* @returns
*/
function replicateCores(a, b, { delay = 0, ...opts } = {}) {
const s1 = a.replicate(true, { keepAlive: false, ...opts })
Expand All @@ -691,7 +690,6 @@ function replicateCores(a, b, { delay = 0, ...opts } = {}) {
/**
* Randomly delay stream chunks by up to `delay` milliseconds
* @param {number} delay
* @returns
*/
function latencyStream(delay = 0) {
return new Transform({
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/core-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { migrate } from 'drizzle-orm/better-sqlite3/migrator'
/**
*
* @param {Partial<ConstructorParameters<typeof CoreManager>[0]> & { rootKey?: Buffer }} param0
* @returns
* @returns {CoreManager}
*/
export function createCoreManager({
rootKey = randomBytes(16),
Expand Down

0 comments on commit 4d83538

Please sign in to comment.