Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
fisker opened this issue Oct 19, 2020 · 2 comments · Fixed by #9435
Closed

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

fisker opened this issue Oct 19, 2020 · 2 comments · Fixed by #9435
Assignees
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program

Comments

@fisker
Copy link
Member

fisker commented Oct 19, 2020

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)
@fisker fisker added type:bug Issues identifying ugly output, or a defect in the program lang:javascript Issues affecting JS labels Oct 19, 2020
@fisker fisker self-assigned this Oct 19, 2020
@FlorianWendelborn
Copy link

@fisker I agree that the comment shouldn’t be omitted entirely. However, why would anyone want to export { a as a }? Isn’t export { a } more desirable?

@fisker
Copy link
Member Author

fisker commented Nov 29, 2020

See discussion in #9435

@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Feb 28, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants