Simplify arrow functions that use blocks (fixes #268) (#496)

master
James Long 2017-01-27 13:39:17 -05:00 committed by GitHub
parent caf7f2a6f2
commit aaea8b1150
3 changed files with 21 additions and 1 deletions

View File

@ -284,7 +284,8 @@ function genericPrintNoParens(path, options, print) {
if (
n.body.type === "ArrayExpression" ||
n.body.type === "ObjectExpression" ||
n.body.type === "JSXElement"
n.body.type === "JSXElement" ||
n.body.type === "BlockStatement"
) {
return group(collapsed);
}

View File

@ -34,3 +34,19 @@ veryLongCall(
);
"
`;
exports[`test long-contents.js 1`] = `
"const foo = () => {
expect(arg1, arg2, arg3).toEqual({message: \'test\', messageType: \'SMS\', status: \'Unknown\', created: \'11/01/2017 13:36\'});
};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const foo = () => {
expect(arg1, arg2, arg3).toEqual({
message: \"test\",
messageType: \"SMS\",
status: \"Unknown\",
created: \"11/01/2017 13:36\"
});
};
"
`;

View File

@ -0,0 +1,3 @@
const foo = () => {
expect(arg1, arg2, arg3).toEqual({message: 'test', messageType: 'SMS', status: 'Unknown', created: '11/01/2017 13:36'});
};