Add support for currying (#1066)
If you write your code in a functional way where you have an arrow function for each argument, it looks better for them to be inline. I can't imagine any case where it would be used in a different way if we limit to a single argument. Fixes #1065master
parent
dd792a2b22
commit
60816af4ce
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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, () => {})
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -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) => {
|
||||
// ...
|
||||
};
|
Loading…
Reference in New Issue