Comment after braces
See original GitHub issuePrettier 2.7.1 Playground link
--parser babel
--print-width 2000
--tab-width 4
Input:
const value = true;
if (value) { /** Some comment about the if option that is not keeped on this line */
} /** This comment is keeped on this line */ else { /** Some comment about the else option that is not keeped on this line */
console.log('hello'); /** This comment is keeped on this line */
}
Output:
const value = true;
if (value) {
/** Some comment about the if option that is not keeped on this line */
} /** This comment is keeped on this line */ else {
/** Some comment about the else option that is not keeped on this line */
console.log("hello"); /** This comment is keeped on this line */
}
Expected behavior:
const value = true;
if (value) { /** Some comment about the if option that is not keeped on this line */
} /** This comment is keeped on this line */ else { /** Some comment about the else option that is not keeped on this line */
console.log("hello"); /** This comment is keeped on this line */
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Testimonials - Orthodontist Newport Beach, Laguna Beach CA
We find it very rewarding to receive nice notes and comments from patients who were so positively affected by the treatment they received...
Read more >Curly Bracket automatic comments line – ReSharper Support
HiI'm just starting using ReSharper and need some help on some settings.If I write some code in C# and I want to write...
Read more >Comments in if statement without curly braces - Stack Overflow
If there is no curly braces to group the code, the statement immediately after the if statement gets executed. If there is comments...
Read more >algorithmic - Remove braces around the comment - TeX
You have two possibilitys, depending on the way you want to write your comments in the algorithmn. You can add
Read more >Why can I not place unmatched braces in Tcl comments
Tcl recognized # as a comment and ignored ignored the rest of that line, including the trailing open-brace. After successfully evaluating foreach, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This works too, does not it? Importantly, there is more space for a comment, especially in the case of a long
if
:The objective of keeping a comment after
{
is to describe what’s done inside the else part of an ‘if / else’.