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

Don't trailing generic comma when format tsx file when trailingComma: never #636

Open
NWYLZW opened this issue May 21, 2024 · 3 comments
Open
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@NWYLZW
Copy link

NWYLZW commented May 21, 2024

Describe the bug

dprint-plugin-typescript version: 0.90.3

Input Code

[].filter(<T,>() => false)

Expected Output

[].filter(<T,>() => false)

Actual Output

[].filter(<T>() => false)

playground

image

@NWYLZW NWYLZW changed the title Don't trailing comma when format tsx file Don't trailing generic comma when format tsx file May 21, 2024
@dsherret
Copy link
Member

I can't reproduce this. Are you formatting in a tsx file?

It gives your expected output in the playground when selecting .tsx:

image

@NWYLZW
Copy link
Author

NWYLZW commented May 27, 2024

image

Yes, I selected the .tsx, but I had configured trailingCommon as never in playground link.

According to the semantics of tsx, the comma here has a special purpose and should not be removed by dprint. However, dprint removed it.

I think this might require special handling logic here, but to be honest, it feels a bit complicated.

@dsherret
Copy link
Member

Yes, I selected the .tsx, but I had configured trailingCommon as never

That's the key piece of missing information.

@dsherret dsherret added bug Something isn't working and removed not reproducible labels May 28, 2024
@dsherret dsherret changed the title Don't trailing generic comma when format tsx file Don't trailing generic comma when format tsx file when trailingComma: never May 28, 2024
@dsherret dsherret added the good first issue Good for newcomers label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants