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

Trailing commas for type parameters in Flow with --trailing-comma=es5 #3722

Closed
suchipi opened this issue Jan 11, 2018 · 6 comments
Closed

Trailing commas for type parameters in Flow with --trailing-comma=es5 #3722

suchipi opened this issue Jan 11, 2018 · 6 comments
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. status:needs discussion Issues needing discussion and a decision to be made before action can be taken

Comments

@suchipi
Copy link
Member

suchipi commented Jan 11, 2018

I'm not sure if this is the correct behavior or not, but I just moved from trailingComma: "all" to trailingComma: "es5" in our codebase at work, and was surprised to see these ones disappear.

Prettier 1.9.2
Playground link

--trailing-comma es5

Input:

type FooThisNameIsVeryLongSoThatItBreaksToTheNextLine = Something<FirstParam, SecondParam>;

Output:

type FooThisNameIsVeryLongSoThatItBreaksToTheNextLine = Something<
  FirstParam,
  SecondParam
>;

Prettier 1.9.2
Playground link

--trailing-comma all

Input:

type FooThisNameIsVeryLongSoThatItBreaksToTheNextLine = Something<FirstParam, SecondParam>;

Output:

type FooThisNameIsVeryLongSoThatItBreaksToTheNextLine = Something<
  FirstParam,
  SecondParam,
>;

This affects both flow and typescript.

Seeing as type parameters aren't valid ES5 anyway, should we maybe include trailing commas there even when using trailingComma: "es5"?

@suchipi suchipi added status:needs discussion Issues needing discussion and a decision to be made before action can be taken lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) lang:javascript Issues affecting JS lang:flow Issues affecting Flow-specific constructs (not general JS issues) labels Jan 11, 2018
@suchipi
Copy link
Member Author

suchipi commented Jan 11, 2018

Related: #3662 #3313

@duailibe
Copy link
Member

Following that logic we could consider that "es5" == "all" since it's valid in TS anyway, not ES 😂

@suchipi
Copy link
Member Author

suchipi commented Jan 12, 2018

Yeah I guess that's kinda weird... I'm looking at it from the flow perspective, though.

@vjeux
Copy link
Contributor

vjeux commented Jan 13, 2018

@suchipi looks like an oversight to me. Feel free to fix it :)

@azz
Copy link
Member

azz commented Jan 14, 2018

From memory, older versions of TS don't support trailing commas here, I think it was intentional. Might want to double check

@thorn0 thorn0 changed the title Using trailingComma: es5 omits commas from type parameter list Trailing commas for type parameters in Flow with --trailing-comma=es5 Jan 28, 2021
@thorn0 thorn0 removed lang:javascript Issues affecting JS lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) labels Jan 28, 2021
@fisker
Copy link
Member

fisker commented Feb 9, 2023

Fixed by #14085

@fisker fisker closed this as completed Feb 9, 2023
@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 Nov 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2023
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. status:needs discussion Issues needing discussion and a decision to be made before action can be taken
Projects
None yet
Development

No branches or pull requests

6 participants