Skip to content

prettier-ignore adds redundant semicolons to some lines #5140

@tao-cumplido

Description

@tao-cumplido

Prettier 1.14.3
Playground link

--parser typescript
--tab-width 4

Input:

interface SharedWorkerGlobalScope extends WorkerGlobalScope {
    readonly name: string;
    onconnect: null | ((event: MessageEvent) => void);
    // prettier-ignore
    addEventListener(type: 'connect', listener: ConnectEventHandler, options?: boolean | AddEventListenerOptions): void;
    // prettier-ignore
    addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
    // prettier-ignore
    removeEventListener(type: 'connect', listener: ConnectEventHandler, options?: boolean | EventListenerOptions): void;
    // prettier-ignore
    removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}

Output:

interface SharedWorkerGlobalScope extends WorkerGlobalScope {
    readonly name: string;
    onconnect: null | ((event: MessageEvent) => void);
    // prettier-ignore
    addEventListener(type: 'connect', listener: ConnectEventHandler, options?: boolean | AddEventListenerOptions): void;;
    // prettier-ignore
    addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;;
    // prettier-ignore
    removeEventListener(type: 'connect', listener: ConnectEventHandler, options?: boolean | EventListenerOptions): void;;
    // prettier-ignore
    removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}

Expected behavior:
Input and output should be exactly the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions