--- source: crates/rome_formatter_test/src/snapshot_builder.rs info: test_file: js/module/expression/logical_expression.js --- # Input ```js x ?? y; x || y; x && y; lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem && lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem && lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem && lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem; if (something && elsewhere && happy && thoughts && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomethin) {} do { } while (something && elsewhere && happy && thoughts && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomethin) switch (something && elsewhere && happy && thoughts && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomethin) { default: {} } while (something && elsewhere && happy && thoughts && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomethin) {} (something && elsewhere && happy && thoughts) function a() { return something && elsewhere && happy && thoughts && somethingsomethingsomethingsomething && thoughts && somethingsomethingsomethingsomething; } const a = () => aa && bb && something && somethingsomethingsomethingsomething; const a = () => aa && bb && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomething && somethingsomethingsomethingsomething && somethingsomethingsomethingsomething; const a = aa && bb && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomething; const a = x + y { something && lsewhere && happy && thoughts && dldldlldldldldldldldl && dldldlldldldldldldldl } if ( somethingsomethingsomethingsomethin && somethingsomethingsomethingsomethin || somethingsomethingsomethingsomethin && somethingsomethingsomethingsomethin) {} undefined === function () { throw undefined; }; const b = `${(veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar)}`; const a = aa && bb && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomething || aa && bb && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomething; ( lorem && // foo ipsum ); ( lorem && call_function(1, 3) // foo ); ( lorem && // foo (3 + 6 == 9) ); let a = a || b && c; let foo = one && two || three && four || five && six; // Implicitly parenthesized && and || requires parens foo && bar || baz; a instanceof Number instanceof String instanceof Boolean instanceof Number instanceof String instanceof Boolean instanceof Number instanceof String instanceof Boolean; a in LongClassName in LongClassName in LongClassName in LongClassName in LongClassName in LongClassName in LongClassName in LongClassName in LongClassName; veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo instanceof String && veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar instanceof Number || veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar instanceof Boolean ``` ============================= # Outputs ## Output 1 ----- Indent style: Tab Line width: 80 Quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always ----- ```js x ?? y; x || y; x && y; lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem && lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem && lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem && lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem_lorem; if ( something && elsewhere && happy && thoughts && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomethin ) { } do {} while ( something && elsewhere && happy && thoughts && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomethin ); switch ( something && elsewhere && happy && thoughts && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomethin ) { default: { } } while ( something && elsewhere && happy && thoughts && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomethin ) {} something && elsewhere && happy && thoughts; function a() { return ( something && elsewhere && happy && thoughts && somethingsomethingsomethingsomething && thoughts && somethingsomethingsomethingsomething ); } const a = () => aa && bb && something && somethingsomethingsomethingsomething; const a = () => aa && bb && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomething && somethingsomethingsomethingsomething && somethingsomethingsomethingsomething; const a = aa && bb && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomething; const a = x + y; { something && lsewhere && happy && thoughts && dldldlldldldldldldldl && dldldlldldldldldldldl; } if ( (somethingsomethingsomethingsomethin && somethingsomethingsomethingsomethin) || (somethingsomethingsomethingsomethin && somethingsomethingsomethingsomethin) ) { } undefined === function () { throw undefined; }; const b = `${ veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar }`; const a = (aa && bb && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomething) || (aa && bb && something && elsewhere && happy && thoughts && somethingsomethingsomethingsomething); lorem && // foo ipsum; lorem && call_function(1, 3); // foo lorem && // foo 3 + 6 == 9; let a = a || (b && c); let foo = (one && two) || (three && four) || (five && six); // Implicitly parenthesized && and || requires parens (foo && bar) || baz; a instanceof Number instanceof String instanceof Boolean instanceof Number instanceof String instanceof Boolean instanceof Number instanceof String instanceof Boolean; a in LongClassName in LongClassName in LongClassName in LongClassName in LongClassName in LongClassName in LongClassName in LongClassName in LongClassName; (veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo instanceof String && veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar instanceof Number) || veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar instanceof Boolean; ```