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
Comments
See also #719 |
Using the flow parser to output comments if there's any |
|
@duailibe, does this happen to still be in progress? |
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.
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.
Not an issue anymore because support for Flow comments was removed in #13687 |
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.
The text was updated successfully, but these errors were encountered: