--- source: crates/rome_formatter_test/src/snapshot_builder.rs info: test_file: jsx/element.jsx --- # Input ```jsx // Single string attribute
; // Not single string because of the new line a =
; // Inline a = ; // IndentAttributes a = ; // Empty a =
; <> ; // Not empty a =
; // Template a =
{`A Long Tempalte String That uses ${5 + 4} that will eventually break across multiple lines ${40 / 3 * 45}`}
; // Meaningful text after self closing element adds a hard line break a =
adefg
; // Meaningful text after a non-self closing element should add a soft line break b = a =
a
abcd
; // A word right before a self-closing element inserts a hard line break a =
ab
; // A Word not right before a self-closing element inserts a soft line break. a =
ab
text
; // whitespaces c =
a{' '}{' '}{' '}{' '}{' '}{' '}{' '}{' '}b{' '}{' '}{' '}{' '}{' '}{' '}
; c2 =
a{' '}{' '}{' '}{' '}{' '}{' '}{' '}{' '}
content{' '}{' '}{' '}{' '}{' '}{' '}
; // this group should fit one line jsx whitespaces are hidden b =
{' '} {' '} 1
; // this group should break first tag and show only first jsx whitespace b1 =
{` 12312 12312 `} {' '} {' '} 1
; // this group fit one line and hide jsx whitespace b2 = <> 123 {' '} 1 ; // this group break group and show jsx whitespace b3 = <> {` 123`} {' '} 1 ; const b4 =
Text some link {' '} | some other text,{' '}
; b5 =

long text long text long text long text long text long text long text long texturl long text long text
;
jumps over the lazy dog
; const Essay = () =>
The films of Wong Kar-Wai exemplify the synthesis of French New Wave cinema—specifically the unrelenting experimental technique and fascination with American/western culture—with more conventional melodramatic, romantic narratives.
; function Tabs() { return Input Settings Formatter Output CST AST Rome IR Prettier IR Errors { setPlaygroundState((state) => ({ ...state, code: evn.target.value, })); }} style={{ fontSize: 12, height: "100vh", fontFamily: "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", }} />

Rome

Prettier

{formatter_ir}
{prettierOutput.ir}
						{errors}
					
; } function LoginForm() { return
{ e.preventDefault(); console.log("Submitted form!")} }> setUsername(e.target.value)} /> setPassword(e.target.value)} />
} function MapoTofuRecipe() { return } } />; let component =
La Haine dir. Mathieu Kassovitz
; let component = (
Uncle Boonmee Who Can Recall His Past Lives dir. Apichatpong Weerasethakul
); (
Badlands
).property; let bar =
{foo(() =>
the quick brown fox jumps over the lazy dog and then jumps over the lazy cat and then over the lazy fish.
)}
; ; // spacing let a = {' '} let b = {" "} // comments let a = { /* comment */ " " /* comment */ }; let a = { " " /* comment */ }; let a = { /* comment */ " " }; // in array const breadcrumbItems = [ ( Home ), ].concat(extraBreadcrumbItems); function Component() { return ( ); } let b = (
aVeryLongCOntentThat
); let a = ( ); function Component() { return (
{fn(data)}{' '}
); } // jsx whitespace {' '} adds meaningful jsx text function Component() { return (
{fn(datadatadatadatadatadatadatadatadatadatadatadatadatadatadatadata)}{' '}
); } // not jsx whitespace doesn't add meaningful jsx text function Component() { return (
{fn(datadatadatadatadatadatadatadatadatadatadatadatadatadatadatadata)}{' '}
); } ``` ============================= # Outputs ## Output 1 ----- Indent style: Tab Line width: 80 Quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always ----- ```jsx // Single string attribute
; // Not single string because of the new line a = (
); // Inline a = ( ); // IndentAttributes a = ( ); // Empty a =
; <>; // Not empty a =
; // Template a = (
{`A Long Tempalte String That uses ${ 5 + 4 } that will eventually break across multiple lines ${(40 / 3) * 45}`}
); // Meaningful text after self closing element adds a hard line break a = (
		adefg
	
); // Meaningful text after a non-self closing element should add a soft line break b = a = (
a
abcd
); // A word right before a self-closing element inserts a hard line break a = (
ab
); // A Word not right before a self-closing element inserts a soft line break. a = (
ab
text
); // whitespaces c =
a b
; c2 = (
a
content{" "}
); // this group should fit one line jsx whitespaces are hidden b = (
1
); // this group should break first tag and show only first jsx whitespace b1 = (
{` 12312 12312 `} {" "} 1
); // this group fit one line and hide jsx whitespace b2 = ( <> 123 1 ); // this group break group and show jsx whitespace b3 = ( <> {` 123`} {" "} 1 ); const b4 = (
Text{" "} some link {" "} | some other text,{" "}
); b5 = (

long text long text long text long text long text long text long text long texturl long text long text
);
jumps over the lazy dog
; const Essay = () => (
The films of Wong Kar-Wai exemplify the synthesis of French New Wave cinema—specifically the unrelenting experimental technique and fascination with American/western culture—with more conventional melodramatic, romantic narratives.
); function Tabs() { return ( Input Settings Formatter Output CST AST Rome IR Prettier IR Errors { setPlaygroundState((state) => ({ ...state, code: evn.target.value, })); }} style={{ fontSize: 12, height: "100vh", fontFamily: "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", }} />

Rome

Prettier

{formatter_ir}
{prettierOutput.ir}
					{errors}
				
); } function LoginForm() { return (
{ e.preventDefault(); console.log("Submitted form!"); }} > setUsername(e.target.value)} /> setPassword(e.target.value)} />
); } function MapoTofuRecipe() { return ( ); } } />; let component =
La Haine dir. Mathieu Kassovitz
; let component = (
{" "} Uncle Boonmee Who Can Recall His Past Lives dir. Apichatpong Weerasethakul{" "}
); (
Badlands
).property; let bar = (
{foo(() => (
{" "} the quick brown fox jumps over the lazy dog and then jumps over the lazy cat and then over the lazy fish.{" "}
))}
); ; // spacing let a = ; let b = ; // comments let a = {/* comment */ " " /* comment */}; let a = ( { " " /* comment */ } ); let a = {/* comment */ " "}; // in array const breadcrumbItems = [ Home , ].concat(extraBreadcrumbItems); function Component() { return ( ); } let b = (
aVeryLongCOntentThat
); let a = ( ); function Component() { return (
{fn(data)}
); } // jsx whitespace {' '} adds meaningful jsx text function Component() { return (
{fn(datadatadatadatadatadatadatadatadatadatadatadatadatadatadatadata)}{" "}
); } // not jsx whitespace doesn't add meaningful jsx text function Component() { return (
{fn(datadatadatadatadatadatadatadatadatadatadatadatadatadatadatadata)} {" "}
); } ``` # Lines exceeding max width of 80 characters ``` 2:
; 7: tooltip="A very long tooltip text that would otherwise make the attribute break 14: 179: "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", 200: "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", 213: "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", 238:
  287: 		Uncle Boonmee Who Can Recall His Past Lives dir. Apichatpong Weerasethakul{" "}
```