~~ lineWidth: 40 ~~ == should format a single line statement == const t = () => 7; [expect] const t = () => 7; == should format with everything == const t = async (p, u): s => { }; [expect] const t = async (p, u): s => { }; == should keep the body on a single line when formatted that way == const t = () => { }; [expect] const t = () => {}; == should support multiple line expressions == const t = () => true || false || true || false; [expect] const t = () => true || false || true || false; == should allow arrow functions without parens == const t = a => 5; [expect] const t = a => 5; == should use parens when specified == const t = (a) => 5; [expect] const t = (a) => 5; == should use parens when there is a type == const t = (a: string) => 5; [expect] const t = (a: string) => 5; == should use parens when async and no parens == const t = async () => 5; [expect] const t = async () => 5; == should not use parens when async and has no parens == const t = async a => 5; [expect] const t = async a => 5; == should format the params as multi-line when the return type exceeds the line width == const t = (test: s, other): testing | thisOutMore => { } [expect] const t = ( test: s, other, ): testing | thisOutMore => { }; == should format the return type on the same line when the rest of the header is multi-line == const testing = (param: string, other: number): testing | this => { } [expect] const testing = ( param: string, other: number, ): testing | this => { }; == should format the return type on a new line when it's multiple lines and the rest of the header is multi-line == const testing = (param: string, other: number): testing | other | other | test | test => { } [expect] const testing = ( param: string, other: number, ): | testing | other | other | test | test => { }; == should format arrow function containing an object expression == const test = (testing, thisOut) => ({ test: 5, other: 10 }); [expect] const test = (testing, thisOut) => ({ test: 5, other: 10, }); == should not newline when the arrow is on a separate line -- previously would newline before sum, which was useless == const test = (testing, thisOut, somethingThatWillGo) => sum(testing, thisOut, againWithSomethingThisisLong); [expect] const test = ( testing, thisOut, somethingThatWillGo, ) => sum( testing, thisOut, againWithSomethingThisisLong, ); == should break up appropriately when the body is in parens == prefixCommon.map((c) => ({ type: DiffType.common, value: c })); [expect] prefixCommon.map((c) => ({ type: DiffType.common, value: c, })); == should not keep trailing comma for type parameter with only identifier since this is not a cts or mts file == const x = (value: T): T => value; [expect] const x = (value: T): T => value; == curried functions == const someFunc = a => b => c => { return a + b + c; }; const someFunc = a => b => c => d => e => { return a + b + c; }; const someFunc = a => b => c => d => e => f => g => h => { return a + b + c; }; const someFunc = (a, b, c, d: string) => (e: string, f: number, g: string, h: number, i: string) => { return a + b + c; }; [expect] const someFunc = a => b => c => { return a + b + c; }; const someFunc = a => b => c => d => e => { return a + b + c; }; const someFunc = a => b => c => d => e => f => g => h => { return a + b + c; }; const someFunc = (a, b, c, d: string) => ( e: string, f: number, g: string, h: number, i: string, ) => { return a + b + c; }; == curried functions with comments == const someFunc = // 1 a => // 2 // 3 /* 4 */ b => // 5 // 6 // 7 /* 8 */ c => { // 9 return a + b + c; }; [expect] const someFunc = // 1 a => // 2 // 3 /* 4 */ b => // 5 // 6 // 7 /* 8 */ c => { // 9 return a + b + c; }; == curried functions with comment at before == const someFunc = // a (a: string , b : number) => ( c: string , d: number, e: testingtestingtesting ) => { return a + b + c; }; const otherFunc = // a a => b => { return a + b; }; [expect] const someFunc = // a (a: string, b: number) => ( c: string, d: number, e: testingtestingtesting, ) => { return a + b + c; }; const otherFunc = // a a => b => { return a + b; }; == curried functions with comments between == const someFunc = // a a => // b b => // c // It's ok to have spaces between comments c => { return a + b + c; }; [expect] const someFunc = // a a => // b b => // c // It's ok to have spaces between comments c => { return a + b + c; }; == should format with const type params == const t = () => {}; [expect] const t = () => {};