close
Skip to content

challenge(formatter): quit hard line break if default clause has no consequent#768

Merged
unvalley merged 2 commits intobiomejs:mainfrom
unvalley:fix-js-switch-comment2
Nov 18, 2023
Merged

challenge(formatter): quit hard line break if default clause has no consequent#768
unvalley merged 2 commits intobiomejs:mainfrom
unvalley:fix-js-switch-comment2

Conversation

@unvalley
Copy link
Copy Markdown
Member

@unvalley unvalley commented Nov 18, 2023

Summary

This PR will suppress comment hard line breaks in the default clause of switch and reduce diffs with prettier.

But this pr does not fix test cases perfectly, skip below one. I'm investigating, but we can separate the PR.

// FIXME
// TODO: reformat issue
// switch(5){default: // comment5
// // comment5a
// foo();bar();//comment5b
// break;// comment5c
// }

Test Plan

cargo test -p biome_js_formatter --test prettier_tests

@github-actions github-actions Bot added A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages labels Nov 18, 2023
@ematipico ematipico changed the title challnge(formatter): quit hard line break if default clause has no consequent challenge(formatter): quit hard line break if default clause has no consequent Nov 18, 2023
@unvalley unvalley merged commit 0149819 into biomejs:main Nov 18, 2023
@unvalley unvalley deleted the fix-js-switch-comment2 branch November 18, 2023 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants