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

This code infinitely self-replicates every time Prettier formats it #7797

Closed
nickretallack opened this issue Mar 19, 2020 · 0 comments · Fixed by #7798
Closed

This code infinitely self-replicates every time Prettier formats it #7797

nickretallack opened this issue Mar 19, 2020 · 0 comments · Fixed by #7798
Labels
area:comments Issues with how Prettier prints comments area:idempotency Issues with re-printing Prettier’s output lang:flow Issues affecting Flow-specific constructs (not general JS issues) lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) 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

@nickretallack
Copy link

Prettier 1.19.1
Playground link

--parser babel

Input:

export type a =
  | 1
  // prettier-ignore
  // @ts-ignore
  | 2;

Output:

export type a =
  | 1
    // prettier-ignore
    // @ts-ignore
  // prettier-ignore
  // @ts-ignore
  | 2;

Expected behavior:
The number of comments in the input and output should be the same. Instead, it's double. Every time you format it, it doubles.

@thorn0 thorn0 added area:comments Issues with how Prettier prints comments area:idempotency Issues with re-printing Prettier’s output lang:flow Issues affecting Flow-specific constructs (not general JS issues) lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) type:bug Issues identifying ugly output, or a defect in the program labels Mar 19, 2020
@j-f1 j-f1 linked a pull request Mar 21, 2020 that will close this issue
3 tasks
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jun 24, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:comments Issues with how Prettier prints comments area:idempotency Issues with re-printing Prettier’s output lang:flow Issues affecting Flow-specific constructs (not general JS issues) lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) 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