Sitelet https://github.com/prettier/prettier/issues/7429
Skip to content

throw the error when there is flow shorthand annotation comment with other comments #7429

Description

@strager

Prettier 1.19.1
Playground link

--parser babel

Input:

f(
  // comment
  (0 /*: number */)
);

Output:

ensureAllCommentsPrinted/<@https://prettier.io/lib/standalone.js:15543:15
ensureAllCommentsPrinted@https://prettier.io/lib/standalone.js:15541:17
coreFormat@https://prettier.io/lib/standalone.js:15592:29
format@https://prettier.io/lib/standalone.js:15832:75
formatWithCursor@https://prettier.io/lib/standalone.js:15848:14
withPlugins/<@https://prettier.io/lib/standalone.js:31794:17
format@https://prettier.io/lib/standalone.js:31802:14
formatCode@https://prettier.io/worker.js:234:21
handleMessage@https://prettier.io/worker.js:185:18
self.onmessage@https://prettier.io/worker.js:155:14

Expected behavior:
Prettier exits successfully. Prettier does not change the formatting of this code.

Observations:
The following changes to the input make the crash disappear:

  • Remove the : in the comment on line 3
  • Remove the ( and ) on line 3
  • Remove the comment on line 2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions