Skip to content

Conversation

@sosukesuzuki
Copy link
Member

Fix #6189 .
Prettier inserts a trailing comma to single type parameter for arrow functions in tsx, since v 1.18 (#6115 ). But, this feature inserts a trailing comma to type parameter for besides arrow functions too (e.g, function , interface ).

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • (If the change is user-facing) I’ve added my changes to the CHANGELOG.unreleased.md file following the template.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@sosukesuzuki
Copy link
Member Author

Sorry, this bug is cause by my mistake.

Also, this feature does not happen on playground. I want somebody to check this on local environment.

parent.params &&
parent.params.length === 1 &&
options.filepath &&
options.filepath.match(/\.tsx/) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're at it, please improve this regexp a bit: /\.tsx$/i
Also it's better to rewrite the last two lines using test: /\.tsx$/i.test(options.filepath)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix from b961cdc .

@duailibe
Copy link
Collaborator

duailibe commented Jun 7, 2019

Sorry, this bug is cause by my mistake.

@sosukesuzuki Don't worry about that! It's my fault that I didn't see that could happen

@duailibe duailibe merged commit 8812792 into prettier:master Jun 7, 2019
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Sep 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 5, 2019
@lipis lipis added this to the 1.19 milestone Sep 11, 2019
@sosukesuzuki sosukesuzuki deleted the fix-6189 branch September 28, 2019 17:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inserts trailing comma into TypeScript Type Parameters

4 participants