Closed standard-software closed 1 month ago
I suggest converting // comments to / / comments to address this issue. This change can help maintain consistency in the codebase and might resolve some formatting problems associated with single-line comments.
Alternatively, it might be beneficial to introduce an error message when Bracket Same Line is set to true and a comment is placed before the >. This error message prompt users to convert the comment to a /* / style.
Best regards,
If you try the playground, you will see that the same problem occurs with both // and / /.
The problem is immediately apparent when you run it in the playground: prettier has no problem, and biome has a problem. (Thank goodness playground exists!).
<div
sx={{
position: 'absolute'
}}
// comment >
test
</div>
<div
sx={{
position: 'absolute'
}} /* comment */ >
test
</div>
I apologize if my explanation wasn't clear. Please look at the code above. The code above is a hypothetical example of how the formatting should work correctly. If 'Bracket Same Line' is true, the >
should come after the comment. However, when the comment is //
, the >
would be commented out. Therefore, I thought it might be necessary to change the comment style to /* */
.
Alternatively, should we avoid format when there's a comment immediately before the>
?
Please share opinion on this.
@ematipico
Might I take a shot at this?
I'm considering implementing a solution to avoid formatting when there's a comment immediately before the >
Environment information
-> ``
This is a miss-formatting of the text inside the div, which has been changed.
Configuration
No response
Playground link
https://biomejs.dev/playground/?bracketSameLine=true&code=CgA8AGQAaQB2AAoAIAAgAHMAeAA9AHsAewAKACAAIAAgACAAcABvAHMAaQB0AGkAbwBuADoAIAAnAGEAYgBzAG8AbAB1AHQAZQAnAAoAIAAgAH0AfQAKACAAIAAvAC8AIABjAG8AbQBtAGUAbgB0AAoAPgAKACAAIAB0AGUAcwB0AAoAPAAvAGQAaQB2AD4ACgA%3D
Code of Conduct