Prettier 1.10.2
Playground link
Input:
/*
* It looks like "require" and "define" calls are formatted differently,
* all else being equal. (fwiw, I think require's formatting here looks
* way better)
*/
require(
[
'jquery',
'common/global.context',
'common/log.event',
'some_project/square',
'some_project/rectangle',
'some_project/triangle',
'some_project/circle',
'some_project/star',
],
function($, Context, EventLogger, Square, Rectangle, Triangle, Circle, Star) {
console.log('some code')
}
);
define(
[
'jquery',
'common/global.context',
'common/log.event',
'some_project/square',
'some_project/rectangle',
'some_project/triangle',
'some_project/circle',
'some_project/star',
],
function($, Context, EventLogger, Square, Rectangle, Triangle, Circle, Star) {
console.log('some code')
}
);
/*
* This only seems to happen when the array of imports is sufficiently long
*/
require(["ohkay", "another_imported_thing", "and also this one here"], function(ok) {
console.log(ok);
})
define(["ohkay", "another_imported_thing", "and also this one here"], function(ok) {
console.log(ok);
})
Output:
/*
* It looks like "require" and "define" calls are formatted differently,
* all else being equal. (fwiw, I think require's formatting here looks
* way better)
*/
require([
"jquery",
"common/global.context",
"common/log.event",
"some_project/square",
"some_project/rectangle",
"some_project/triangle",
"some_project/circle",
"some_project/star"
], function(
$,
Context,
EventLogger,
Square,
Rectangle,
Triangle,
Circle,
Star
) {
console.log("some code");
});
define(
[
"jquery",
"common/global.context",
"common/log.event",
"some_project/square",
"some_project/rectangle",
"some_project/triangle",
"some_project/circle",
"some_project/star"
],
function($, Context, EventLogger, Square, Rectangle, Triangle, Circle, Star) {
console.log("some code");
}
);
/*
* This only seems to happen when the array of imports is sufficiently long
*/
require(["ohkay", "another_imported_thing", "and also this one here"], function(
ok
) {
console.log(ok);
});
define(["ohkay", "another_imported_thing", "and also this one here"], function(
ok
) {
console.log(ok);
});
Expected behavior:
Prettier 1.10.2
Playground link
Input:
Output:
Expected behavior: