-- file.tsx -- ~~ lineWidth: 50 ~~ == should format when single line == const t = Test; [expect] const t = Test; == should format when multi line == const t = Test; [expect] const t = ( Test ); == should use multi lines even when empty (since someone may want it that way in order to insert statements later) == const t = ; [expect] const t = ( ); == should format elements inside == const t = Text Text Text Text ; [expect] const t = ( Text Text Text Text ); == should format when self closing == const t = ; [expect] const t = ; == should format when element exceeds line width with no children == const t = ; const u = ; [expect] const t = ( ); const u = ( ); == should make the children multi-line when they exceed the line width == const t = ; [expect] const t = ( ); == should make the jsx element multi-line once it contains a jsx element or fragment == const t1 =
; const t2 = ; const t3 =
<>
; [expect] const t1 = (
); const t2 = ( ); const t3 = (
<>
); == should make JSX elements that are beside each other multi-line == const t =
; [expect] const t = (
); == should make JSX elements that have a space between them not multi-line == const t =
; [expect] const t = (
); == should make the children multi-line when the header exceeds the line width == const t = ; [expect] const t = ( ); == should keep jsx expressions on the same line if there is text separating them == const t = {title}:{other} ; [expect] const t = ( {title}:{other} ); == should keep jsx text on the same line for a following text == const t = {title}: {other} ; [expect] const t = ( {title}: {other} ); == should keep jsx text on the same line for a preceding text with and without a space == const t = Test: {title} Test{other} ; [expect] const t = ( Test: {title} Test{other} ); == should keep jsx text on the same line for the following text with and without a space == const t = {title} test {other}test ; [expect] const t = ( {title} test {other}test ); == should leave a space between the text and expression when single line == return (Test: {type}); return (Test: {type}); return ({type} test); return ({type} test); [expect] return Test: {type}; return Test: {type}; return {type} test; return {type} test; == should keep multi-line jsx element with single string attribute on same line == const t = ( Test ); const u = ( ); [expect] const t = ( Test ); const u = ( ); == should not keep long multi-line jsx element with single string attribute on same line when has type arg == const t = ( test="testing this out with some string that is long"> Test ); [expect] const t = ( test="testing this out with some string that is long" > Test ); == should try to keep jsx parened expr inlined within binary expressions == const t =
{someCondition && ( {someValue} )}
; // this has the && right at the line width max so the newline will happen before const testing = someConditionLongEnoughTestTest && ( {someValue} ); [expect] const t = (
{someCondition && ( {someValue} )}
); // this has the && right at the line width max so the newline will happen before const testing = someConditionLongEnoughTestTest && ( {someValue} );