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

[Flow] "Comment was not printed" error with explicit inexact objects #7718

Closed
mirka opened this issue Mar 5, 2020 · 0 comments · Fixed by #7892
Closed

[Flow] "Comment was not printed" error with explicit inexact objects #7718

mirka opened this issue Mar 5, 2020 · 0 comments · Fixed by #7892
Labels
lang:flow Issues affecting Flow-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

@mirka
Copy link

mirka commented Mar 5, 2020

We are seeing "Comment was not printed" errors when there are explicit inexact objects containing only a comment (Flow playground).

Prettier 1.19.1
Playground link

--parser babel

Input:

/** @flow */

type ThisWorks = {
  foo: 1,
  /* TODO */
  ...
};
  
type ThisAlsoWorks = {
  /* TODO */
  foo: 1,
  ...
};

type ThisDoesntWork = {
  /* TODO */
  ...
};
  
type ThisAlsoDoesntWork = {
  // TODO
  ...
};

Output:

Error: Comment "TODO" was not printed. Please report this error!
    at https://prettier.io/lib/standalone.js:15543:15
    at Array.forEach (<anonymous>)
    at ensureAllCommentsPrinted (https://prettier.io/lib/standalone.js:15541:17)
    at coreFormat (https://prettier.io/lib/standalone.js:15592:5)
    at format (https://prettier.io/lib/standalone.js:15832:75)
    at formatWithCursor (https://prettier.io/lib/standalone.js:15848:14)
    at https://prettier.io/lib/standalone.js:31794:17
    at Object.format (https://prettier.io/lib/standalone.js:31802:14)
    at formatCode (https://prettier.io/worker.js:234:21)
    at handleMessage (https://prettier.io/worker.js:185:18)

Expected behavior:

@j-f1 j-f1 added lang:flow Issues affecting Flow-specific constructs (not general JS issues) type:bug Issues identifying ugly output, or a defect in the program labels Mar 5, 2020
@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 Jun 30, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:flow Issues affecting Flow-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