Break long `exports` into multiple lines.

Ref #19.
master
Benjamin Tan 2017-01-11 21:56:10 +08:00 committed by James Long
parent bbe2524dab
commit 1549936e68
5 changed files with 61 additions and 3 deletions

View File

@ -1866,9 +1866,25 @@ function printExportDeclaration(path, options, print) {
} else {
parts.push(
decl.exportKind === "type" ? "type " : "",
shouldPrintSpaces ? "{ " : "{",
join(", ", path.map(print, "specifiers")),
shouldPrintSpaces ? " }" : "}"
conditionalGroup([
concat([
shouldPrintSpaces ? "{ " : "{",
join(", ", path.map(print, "specifiers")),
shouldPrintSpaces ? " }" : "}"
]),
concat([
"{",
indent(
options.tabWidth,
concat([
hardline,
join(concat([",", hardline]), path.map(print, "specifiers"))
])
),
hardline,
"}"
])
])
);
}

View File

@ -352,8 +352,15 @@ declare export {
* @flow
*/
<<<<<<< bbe2524dab164d43febc1a8d549a76e26eb9d483
declare export { numberValue1, numberValue2 as numberValue2_renamed } from \"ES6_ExportFrom_Source1\";
"
=======
declare export {
numberValue1,
numberValue2 as numberValue2_renamed
} from \"ES6_ExportFrom_Source1\";"
>>>>>>> Break long `exports` into multiple lines.
`;
exports[`test ES6_ExportFrom_Intermediary2.js 1`] = `
@ -372,8 +379,15 @@ declare export {
* @flow
*/
<<<<<<< bbe2524dab164d43febc1a8d549a76e26eb9d483
declare export { numberValue1, numberValue2 as numberValue2_renamed2 } from \"ES6_ExportFrom_Source2\";
"
=======
declare export {
numberValue1,
numberValue2 as numberValue2_renamed2
} from \"ES6_ExportFrom_Source2\";"
>>>>>>> Break long `exports` into multiple lines.
`;
exports[`test ES6_ExportFrom_Source1.js 1`] = `

View File

@ -429,8 +429,15 @@ export {
* @flow
*/
<<<<<<< bbe2524dab164d43febc1a8d549a76e26eb9d483
export { numberValue1, numberValue2 as numberValue2_renamed } from \"ES6_ExportFrom_Source1\";
"
=======
export {
numberValue1,
numberValue2 as numberValue2_renamed
} from \"ES6_ExportFrom_Source1\";"
>>>>>>> Break long `exports` into multiple lines.
`;
exports[`test ES6_ExportFrom_Intermediary2.js 1`] = `
@ -449,8 +456,15 @@ export {
* @flow
*/
<<<<<<< bbe2524dab164d43febc1a8d549a76e26eb9d483
export { numberValue1, numberValue2 as numberValue2_renamed2 } from \"ES6_ExportFrom_Source2\";
"
=======
export {
numberValue1,
numberValue2 as numberValue2_renamed2
} from \"ES6_ExportFrom_Source2\";"
>>>>>>> Break long `exports` into multiple lines.
`;
exports[`test ES6_ExportFrom_Source1.js 1`] = `

View File

@ -1,3 +1,4 @@
<<<<<<< bbe2524dab164d43febc1a8d549a76e26eb9d483
exports[`test directives.js 1`] = `
"\"use strict\";
@ -11,6 +12,18 @@ function fn() {
\"use strict\";
}
"
=======
exports[`test exports.js 1`] = `
"export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \"exports\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export {
value1,
value2 as value2_renamed,
value3,
value4 as value4_renamed,
value5
} from \"exports\";"
>>>>>>> Break long `exports` into multiple lines.
`;
exports[`test optional-type-name.js 1`] = `

View File

@ -0,0 +1 @@
export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from "exports";