This repository was archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 657
fix(rome_js_formatter): restrict export line break for single specifier #3726
Merged
MichaReiser
merged 11 commits into
rome:main
from
unvalley:fix/restrict-export-line-break
Nov 16, 2022
Merged
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b64f8c1
fix(rome_js_formatter): restrict export line break for single specifier
unvalley f05ad09
refactor: handle specifeirs format by its length
unvalley a373f4d
fix: format single specifier without comma separator
unvalley ac8f2e8
test: add long string single specifier to export and update snapshot
unvalley d50a47f
test: update prettier_test snapshot
unvalley 27a2f1c
fix: handle single specifier with no comments
unvalley e99a13a
Update crates/rome_js_formatter/tests/specs/js/module/export/named_fr…
unvalley 4318d1c
Merge branch 'fix/restrict-export-line-break' of https://github.com/u…
unvalley 510737e
test: update snapshot test
unvalley 6d1db14
fix: handling comments for import named clause
unvalley c2042dc
test: add snapshot test for import specifier
unvalley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've referenced
import_named_clause
.tools/crates/rome_js_formatter/src/js/module/import_named_clause.rs
Line 58 in 58fbb93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fall back to the default implementation if
specifier
orseparator
isn't ok, and we have to callformat_removed
if theseparator
is not none.We should also check that the specifier has no comments
It can then be written like this (you have to make the
node
andtrailing_separator
fieldspub
onAstSeparatedElement
Thanks for pointing to the import specifier code. I noticed that I missed a check when refactoring how Rome handles comments.
Would you mind changing
to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MichaReiser
Thanks for reviewing and clear explanation! I've updated the code.
I also edited import specifier code and its test.