Prevent adding softline after arrow attribute with comments (#3641)
* failing test * fix
This commit is contained in:
1 parent
157df6e3fd
commit
7f75499dd2
3 files changed
+24
-2
No files matched your search
@@ -499,8 +499,9 @@ function printPathNoParens(path, options, print, args) {
|
||||
// with the opening (, or if it's inside a JSXExpression (e.g. an attribute)
|
||||
// we should align the expression's closing } with the line with the opening {.
|
||||
const shouldAddSoftLine =
|
||||
(args && args.expandLastArg) ||
|
||||
path.getParentNode().type === "JSXExpressionContainer";
|
||||
((args && args.expandLastArg) ||
|
||||
path.getParentNode().type === "JSXExpressionContainer") &&
|
||||
!(n.comments && n.comments.length);
|
||||
|
||||
const printTrailingComma =
|
||||
args && args.expandLastArg && shouldPrintComma(options, "all");
|
||||
|
||||
@@ -12,6 +12,13 @@ exports[`attr-comments.js 1`] = `
|
||||
// comment
|
||||
arg => fn(arg)
|
||||
}
|
||||
propArrowWithBreak={
|
||||
// comment
|
||||
arg =>
|
||||
fn({
|
||||
makeItBreak
|
||||
})
|
||||
}
|
||||
propArray={
|
||||
// comment
|
||||
[el1, el2]
|
||||
@@ -37,6 +44,13 @@ exports[`attr-comments.js 1`] = `
|
||||
// comment
|
||||
arg => fn(arg)
|
||||
}
|
||||
propArrowWithBreak={
|
||||
// comment
|
||||
arg =>
|
||||
fn({
|
||||
makeItBreak
|
||||
})
|
||||
}
|
||||
propArray={
|
||||
// comment
|
||||
[el1, el2]
|
||||
|
||||
@@ -9,6 +9,13 @@
|
||||
// comment
|
||||
arg => fn(arg)
|
||||
}
|
||||
propArrowWithBreak={
|
||||
// comment
|
||||
arg =>
|
||||
fn({
|
||||
makeItBreak
|
||||
})
|
||||
}
|
||||
propArray={
|
||||
// comment
|
||||
[el1, el2]
|
||||
|
||||
Reference in new issue
Block a user