Skip to content

Fix object trailing commas that last property is ignored#8111

Merged
alexander-akait merged 5 commits intoprettier:masterfrom
fisker:issues-5678-prettier-ignore
Apr 25, 2020
Merged

Fix object trailing commas that last property is ignored#8111
alexander-akait merged 5 commits intoprettier:masterfrom
fisker:issues-5678-prettier-ignore

Conversation

@fisker
Copy link
Copy Markdown
Member

@fisker fisker commented Apr 22, 2020

Fixes #5678

  • 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 changelog_unreleased/*/pr-XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@fisker fisker force-pushed the issues-5678-prettier-ignore branch from 1af3698 to 6972aaa Compare April 22, 2020 03:12
@fisker fisker force-pushed the issues-5678-prettier-ignore branch from 6972aaa to 01769c3 Compare April 22, 2020 04:22
@fisker fisker marked this pull request as ready for review April 22, 2020 04:22
@fisker fisker changed the title Fix trailing commas when last property is ignored Fix object trailing commas that last property is ignored Apr 22, 2020
Copy link
Copy Markdown
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

How about what if I wanted to don't add the trailing comma and use prettier-ignore for that 😄

Good job!

@fisker
Copy link
Copy Markdown
Member Author

fisker commented Apr 22, 2020

I guess you have to add prettier-ignore to object. :)

@fisker
Copy link
Copy Markdown
Member Author

fisker commented Apr 22, 2020

foo = {
_: "",
// prettier-ignore
bar: 1 /* comment */,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This comment is move from after , to before ,. Array do the same

@fisker fisker requested review from sosukesuzuki and thorn0 April 25, 2020 05:34
bar: /* comment */ 1,
}

/* RestElement */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is SpreadElement. Rest is destructuring.

@alexander-akait alexander-akait merged commit e69e90f into prettier:master Apr 25, 2020
@fisker
Copy link
Copy Markdown
Member Author

fisker commented Apr 25, 2020

I was going to fix that comment...

@fisker fisker deleted the issues-5678-prettier-ignore branch April 25, 2020 14:56
@alexander-akait
Copy link
Copy Markdown
Member

alexander-akait commented Apr 25, 2020

@fisker oh, sorry, feel free to send a new PR, let's use draft in future 😄

fisker added a commit to fisker/prettier that referenced this pull request Apr 25, 2020
fisker added a commit that referenced this pull request Apr 26, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comma Dangle error if prettier ignore is set to ignore last property in object

3 participants