prettier-plugin-java 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,6 +69,8 @@ export default {
69
69
  if (!path.node.children.QuestionMark) {
70
70
  return isInParentheses ? binaryExpression : group(binaryExpression);
71
71
  }
72
+ const isInReturn = grandparentNodeName === "returnStatement";
73
+ const prefix = group(isInReturn ? indent(binaryExpression) : binaryExpression);
72
74
  const [consequent, alternate] = map(path, print, "expression");
73
75
  const suffix = [
74
76
  line,
@@ -81,9 +83,9 @@ export default {
81
83
  ? suffix
82
84
  : align(Math.max(0, options.tabWidth - 2), suffix);
83
85
  if (isNestedTernary) {
84
- return [group(binaryExpression), alignedSuffix];
86
+ return [prefix, alignedSuffix];
85
87
  }
86
- const parts = [group(binaryExpression), indent(alignedSuffix)];
88
+ const parts = [prefix, indent(alignedSuffix)];
87
89
  return isInParentheses ? parts : group(parts);
88
90
  },
89
91
  binaryExpression(path, print, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-java",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "Prettier Java Plugin",
5
5
  "type": "module",
6
6
  "exports": {
@@ -41,5 +41,5 @@
41
41
  "peerDependencies": {
42
42
  "prettier": "^3.0.0"
43
43
  },
44
- "gitHead": "9204b4f91e2320e7bddff9fb21c1a85fd4fb9e9a"
44
+ "gitHead": "f403f75d5f308e388ac5d27550a177bb0bd6bef4"
45
45
  }