Line comment between function an opening brace
See original GitHub issueIf you have the opening brace of a function on its own line, and a line comment after the function signature, the output of prettier is different if you run it once or twice.
Prettier 1.14.3 Playground link
--parser babylon
Input:
function foo() // this is a function
{
return 42
}
Output:
function foo() { // this is a function
return 42;
}
Second Output:
function foo() {
// this is a function
return 42;
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
What do you think of opening brace comments in source code?
I have developed a habit of writing comments in my code by putting the comments on the same line as the opening brace,...
Read more >What's the purpose of using braces (i.e. {}) for a single-line if or ...
The first code is concise; the second code is bloated. And yes, this can be mitigated to some extent by putting the opening...
Read more >Function opening brace is moved to the next line ... - YouTrack
Function opening brace is moved to the next line when arguments span multiple lines an a return type (PHP 7) is specified.
Read more >Where Do Curly Braces Belong? - Jeremy Bytes
But for other blocks (such as the "if" statement), the curly brace is on the same line.
Read more >Why are curly braces in programming languages important?
Curly braces play a big role in code structure within popular programming languages such as Java, C++ and more. Here's how to properly...
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 FreeTop 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
Top GitHub Comments
I can work on this
@jaideng123 Just handle
1
and2
variants