diff --git a/src/printer.js b/src/printer.js index 2e99a8be..2c7fb157 100644 --- a/src/printer.js +++ b/src/printer.js @@ -317,7 +317,8 @@ function genericPrintNoParens(path, options, print) { n.body.type === "BlockStatement" || n.body.type === "TaggedTemplateExpression" || n.body.type === "TemplateElement" || - n.body.type === "ClassExpression" + n.body.type === "ClassExpression" || + n.body.type === "ArrowFunctionExpression" ) { return group(collapsed); } diff --git a/tests/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/arrows/__snapshots__/jsfmt.spec.js.snap index 98559667..48998b7b 100644 --- a/tests/arrows/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrows/__snapshots__/jsfmt.spec.js.snap @@ -231,6 +231,33 @@ jest.mock( " `; +exports[`currying.js 1`] = ` +"const fn = b => c => d => { + return 3; +}; + +const mw = store => next => action => { + return next(action) +} + +const middleware = options => (req, res, next) => { + // ... +}; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +const fn = b => c => d => { + return 3; +}; + +const mw = store => next => action => { + return next(action); +}; + +const middleware = options => (req, res, next) => { + // ... +}; +" +`; + exports[`long-call-no-args.js 1`] = ` "veryLongCall(VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT, () => {}) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/arrows/currying.js b/tests/arrows/currying.js new file mode 100644 index 00000000..e1a4c7e2 --- /dev/null +++ b/tests/arrows/currying.js @@ -0,0 +1,11 @@ +const fn = b => c => d => { + return 3; +}; + +const mw = store => next => action => { + return next(action) +} + +const middleware = options => (req, res, next) => { + // ... +};