Skip to content

Prettier should not convert export {a as a} to export {a} #9434

@fisker

Description

@fisker

Prettier pr-9408
Playground link

--parser babel

Input:

export {a as a} from 'a'

Output:

export { a } from "a";

Expected behavior:

export { a } from "a";

And comment will lost

Prettier pr-9408
Playground link

--parser babel

Input:

export {a as /* comment */ a} from 'a'

Output:

Error: Comment "comment" was not printed. Please report this error!
    at https://deploy-preview-9408--prettier.netlify.app/lib/standalone.js:15:111760
    at Array.forEach (<anonymous>)
    at Object.ensureAllCommentsPrinted (https://deploy-preview-9408--prettier.netlify.app/lib/standalone.js:15:111727)
    at Xi (https://deploy-preview-9408--prettier.netlify.app/lib/standalone.js:15:117453)
    at Yi (https://deploy-preview-9408--prettier.netlify.app/lib/standalone.js:15:119639)
    at formatWithCursor (https://deploy-preview-9408--prettier.netlify.app/lib/standalone.js:15:119759)
    at https://deploy-preview-9408--prettier.netlify.app/lib/standalone.js:55:37207
    at Object.format (https://deploy-preview-9408--prettier.netlify.app/lib/standalone.js:55:37290)
    at formatCode (https://deploy-preview-9408--prettier.netlify.app/worker.js:115:21)
    at handleMessage (https://deploy-preview-9408--prettier.netlify.app/worker.js:66:18)

Metadata

Metadata

Assignees

Labels

lang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions