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 parser: annotations in comments are printed without comments #2597

Closed
davidaurelio opened this issue Aug 7, 2017 · 5 comments
Closed
Labels
area:flow comment types lang:flow Issues affecting Flow-specific constructs (not general JS issues) type:intended Bug reports that actually turned out to be intended behavior

Comments

@davidaurelio
Copy link

When using the flow parser, all flow annotations inside of special comments (/*: ... */ and /*:: ... */) are printed as annotations without comments. Example.

It is not always feasible to switch to babylon as parser, so it would be nice if prettier would support outputting comments with flow’s parser, too.

@hawkrives
Copy link
Contributor

See also #719

@vjeux
Copy link
Contributor

vjeux commented Aug 7, 2017

Using the flow parser to output comments if there's any /*: comment inside of the file would actually be pretty easy but haven't had the time to work on it and won't be in the forseeable future. If someone is interested, it should be fun to work on and impactful.

@azz azz added the lang:flow Issues affecting Flow-specific constructs (not general JS issues) label Oct 1, 2017
@duailibe
Copy link
Member

/*: ... */ comments handling just landed in master (#3449)

/*:: ... */ comments are WIP :)

@duailibe duailibe added this to the 1.10 milestone Dec 15, 2017
@azz azz removed this from the 1.10 milestone Jan 10, 2018
@dmnd
Copy link

dmnd commented Nov 18, 2019

/*:: ... */ comments are WIP :)

@duailibe, does this happen to still be in progress?

rk-for-zulip added a commit to rk-for-zulip/zulip-mobile that referenced this issue Mar 12, 2020
The `babel-flow` and `flow` parsers produce subtly different ASTs, and
Prettier's support for the latter is relatively poor.

In particular, when using the `flow` parser:
  * prettier/prettier#5288: the private field sigil `#` is stripped.
  * prettier/prettier#2597: type-declaration comments are promoted to
      inline type declarations.

This commit will enable some simple uses of private fields, but not
all. See our commit 86a4258 and its
associated PR (zulip#3725) for more detail.

The more important fix is the second. This will allow us to rely on
Flow's typechecking in scripts which will be executed directly by Node
without a preliminary Babel run -- e.g., scripts residing in `tools/`,
or plugins for support tools such as Jest or ESLint.
gnprice pushed a commit to rk-for-zulip/zulip-mobile that referenced this issue Mar 13, 2020
The `babel-flow` and `flow` parsers produce subtly different ASTs, and
Prettier's support for the latter has historically been relatively poor.

In particular, when using the `flow` parser:
  * prettier/prettier#5288: the private field sigil `#` is stripped.
    (Resolved, but not in our current version.)
  * prettier/prettier#2597: type-declaration comments are promoted to
    inline type declarations.

This commit will enable some simple uses of private fields, but not
all. See our commit 86a4258 and its
associated PR (zulip#3725) for more detail.

The more important fix (and the one that can't be obtained by updating
Prettier, at least not yet) is the second. This will allow us to rely
on Flow's typechecking in scripts which will be executed directly by
Node without a preliminary Babel run -- e.g., scripts residing in
`tools/`, or plugins for support tools such as Jest or ESLint.
@thorn0
Copy link
Member

thorn0 commented Oct 24, 2022

Not an issue anymore because support for Flow comments was removed in #13687
Now this output is intended.

@thorn0 thorn0 closed this as completed Oct 24, 2022
@thorn0 thorn0 added the type:intended Bug reports that actually turned out to be intended behavior label Oct 24, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:flow comment types lang:flow Issues affecting Flow-specific constructs (not general JS issues) type:intended Bug reports that actually turned out to be intended behavior
Projects
None yet
Development

No branches or pull requests

7 participants