Skip to content

JavaScript: Prefer a trailing comment when there is comment between test and consequent on ternary#6418

Closed
sosukesuzuki wants to merge 12 commits intoprettier:masterfrom
sosukesuzuki:fix-2076
Closed

JavaScript: Prefer a trailing comment when there is comment between test and consequent on ternary#6418
sosukesuzuki wants to merge 12 commits intoprettier:masterfrom
sosukesuzuki:fix-2076

Conversation

@sosukesuzuki
Copy link
Copy Markdown
Contributor

Fix #2076

  • 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

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.

Good job, let's add more tests

comment
comment */
foo
: bar;
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.

Let's add more test:

  • comments after :
  • nested ternary with same examples

@j-f1
Copy link
Copy Markdown
Member

j-f1 commented Jan 16, 2020

What’s the status of this PR?

@sosukesuzuki
Copy link
Copy Markdown
Contributor Author

sosukesuzuki commented Jan 16, 2020

@j-f1 Sorry, I forgot this. I'll do this in this weekend.

@fisker
Copy link
Copy Markdown
Member

fisker commented Jun 5, 2020

@sosukesuzuki

Comment thread src/main/comments.js

const isLastComment = comments.length - 1 === i;

const isEnclosedByTernary =
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 not the right file for JS-specific things. This should be handled in language-js/comments.js.

@sosukesuzuki
Copy link
Copy Markdown
Contributor Author

ooops sorry I forgot. I'll work on this at today or tomorrow.

@sosukesuzuki
Copy link
Copy Markdown
Contributor Author

It is hard to merge master into this branch because master includes may changes. I'll close this PR, for now and I'll open new PR to fix #2076

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 9, 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.

Comment inside multiline ternary moves after ?

5 participants