Skip to content

avoid duplicate @import JSDoc for same specifier #12203

@mhofman

Description

@mhofman

Both manual authoring an autofix from the @agoric/group-jsdoc-imports rule can end up creating multiple @import JSDoc statement with the same identifier. We should have an eslint rule detecting and autofixing these to coalesce these imports into a single statement.

E.g. in packages/SwingSet/src/kernel/vat-loader/manager-subprocess-xsnap.js we currently have

/**
 * @import {VatDeliveryObject} from '@agoric/swingset-liveslots'
 * @import {VatDeliveryResult} from '@agoric/swingset-liveslots'
 * @import {VatSyscallObject} from '@agoric/swingset-liveslots'
 * @import {VatSyscallResult} from '@agoric/swingset-liveslots'
 * @import {LiveSlotsOptions} from '@agoric/swingset-liveslots'
 * @import {VatManagerFactory} from '../../types-internal.js'
 * @import {KernelKeeper} from '../state/kernelKeeper.js'
 * @import {KernelSlog} from '../../types-external.js'
 * @import {SnapStore} from '../../types-external.js'
 * @import {SnapshotResult} from '../../types-external.js'
 * @import {Tagged} from './types.js';
 * @import {StartXSnap} from '../../controller/startXSnap.js';
 * @import {ManagerOptions} from '../../types-internal.js';
 * @import {WorkerResults} from './types.js';
 * @import {SnapshotInfo} from '@agoric/swing-store';
 */

it should be

/**
 * @import {
 *   VatDeliveryObject,
 *   VatDeliveryResult,
 *   VatSyscallObject,
 *   VatSyscallResult,
 *   LiveSlotsOptions,
 * } from '@agoric/swingset-liveslots'
 * @import { SnapshotInfo } from '@agoric/swing-store';
 * @import { VatManagerFactory, ManagerOptions } from '../../types-internal.js'
 * @import { KernelKeeper } from '../state/kernelKeeper.js'
 * @import {
 *   KernelSlog,
 *   SnapStore,
 *   SnapshotResult,
 * } from '../../types-external.js'
 * @import { Tagged, WorkerResults } from './types.js';
 * @import { StartXSnap } from '../../controller/startXSnap.js';
 */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions