prettier-plugin-java 1.6.2 → 2.1.0

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.
Files changed (115) hide show
  1. package/LICENSE +1 -1
  2. package/dist/base-cst-printer.js +3 -3
  3. package/dist/index.js +2 -2
  4. package/dist/options.js +1 -0
  5. package/dist/printers/arrays.js +3 -3
  6. package/dist/printers/blocks-and-statements.js +106 -102
  7. package/dist/printers/classes.js +176 -160
  8. package/dist/printers/comments/format-comments.js +21 -13
  9. package/dist/printers/comments/handle-comments.js +1 -1
  10. package/dist/printers/expressions.js +127 -105
  11. package/dist/printers/interfaces.js +56 -56
  12. package/dist/printers/lexical-structure.js +4 -4
  13. package/dist/printers/names.js +8 -8
  14. package/dist/printers/packages-and-modules.js +72 -59
  15. package/dist/printers/prettier-builder.js +24 -12
  16. package/dist/printers/printer-utils.js +63 -56
  17. package/dist/printers/types-values-and-variables.js +43 -39
  18. package/dist/src/base-cst-printer.js +77 -0
  19. package/dist/src/cst-printer.js +37 -0
  20. package/dist/src/index.js +67 -0
  21. package/dist/src/options.js +256 -0
  22. package/dist/src/parser.js +7 -0
  23. package/dist/src/printer.js +28 -0
  24. package/dist/src/printers/arrays.js +49 -0
  25. package/dist/src/printers/blocks-and-statements.js +493 -0
  26. package/dist/src/printers/classes.js +724 -0
  27. package/dist/src/printers/comments/comments-utils.js +29 -0
  28. package/dist/src/printers/comments/format-comments.js +187 -0
  29. package/dist/src/printers/comments/handle-comments.js +38 -0
  30. package/dist/src/printers/expressions.js +549 -0
  31. package/dist/src/printers/interfaces.js +251 -0
  32. package/dist/src/printers/lexical-structure.js +43 -0
  33. package/dist/src/printers/names.js +53 -0
  34. package/dist/src/printers/packages-and-modules.js +185 -0
  35. package/dist/src/printers/prettier-builder.js +47 -0
  36. package/dist/src/printers/printer-utils.js +577 -0
  37. package/dist/src/printers/types-values-and-variables.js +183 -0
  38. package/dist/src/types/utils.js +29 -0
  39. package/dist/src/utils/expressions-utils.js +29 -0
  40. package/dist/src/utils/index.js +10 -0
  41. package/dist/src/utils/printArgumentListWithBraces.js +21 -0
  42. package/dist/src/utils/printSingleLambdaInvocation.js +20 -0
  43. package/dist/test/babel-register.js +3 -0
  44. package/dist/test/repository-test/core-test.js +12 -0
  45. package/dist/test/repository-test/jhipster-1-test.js +17 -0
  46. package/dist/test/repository-test/jhipster-2-test.js +16 -0
  47. package/dist/test/test-utils.js +215 -0
  48. package/dist/test/unit-test/annotation_type_declaration/annotation_type_declaration-spec.js +6 -0
  49. package/dist/test/unit-test/args/args-spec.js +6 -0
  50. package/dist/test/unit-test/assert/assert-spec.js +6 -0
  51. package/dist/test/unit-test/binary_expressions/binary_expressions-spec.js +6 -0
  52. package/dist/test/unit-test/blank_lines/blank_lines-spec.js +6 -0
  53. package/dist/test/unit-test/bug-fixes/bug-fixes-spec.js +6 -0
  54. package/dist/test/unit-test/cast/cast-spec.js +6 -0
  55. package/dist/test/unit-test/char_literal/char_literal-spec.js +6 -0
  56. package/dist/test/unit-test/classes/multiple_classes-spec.js +6 -0
  57. package/dist/test/unit-test/comments/comments-spec.js +14 -0
  58. package/dist/test/unit-test/complex_generic_class/complex_generic_class-spec.js +6 -0
  59. package/dist/test/unit-test/constructors/constructors-spec.js +6 -0
  60. package/dist/test/unit-test/empty_statement/empty_statement-spec.js +6 -0
  61. package/dist/test/unit-test/enum/enum-spec.js +6 -0
  62. package/dist/test/unit-test/expressions/expressions-spec.js +6 -0
  63. package/dist/test/unit-test/extends_abstract_class/extends_abstract_class-spec.js +6 -0
  64. package/dist/test/unit-test/extends_abstract_class_and_implements_interfaces/extends_abstract_class_and_implements_interfaces-spec.js +6 -0
  65. package/dist/test/unit-test/for/for-spec.js +6 -0
  66. package/dist/test/unit-test/generic_class/generic_class-spec.js +6 -0
  67. package/dist/test/unit-test/generic_questionmark/generic_questionmark-spec.js +6 -0
  68. package/dist/test/unit-test/hello-world/hello-word-spec.js +6 -0
  69. package/dist/test/unit-test/if/if-spec.js +6 -0
  70. package/dist/test/unit-test/indent/indent-spec.js +6 -0
  71. package/dist/test/unit-test/instantiation/instantiation-spec.js +6 -0
  72. package/dist/test/unit-test/interface/interface-spec.js +6 -0
  73. package/dist/test/unit-test/lambda/lambda-spec.js +6 -0
  74. package/dist/test/unit-test/marker_annotations/marker_annotations-spec.js +6 -0
  75. package/dist/test/unit-test/member_chain/member_chain-spec.js +6 -0
  76. package/dist/test/unit-test/method_reference/method_reference-spec.js +6 -0
  77. package/dist/test/unit-test/modifiers/modifiers-spec.js +6 -0
  78. package/dist/test/unit-test/modules/modules-spec.js +6 -0
  79. package/dist/test/unit-test/package_and_imports/package_and_imports-spec.js +34 -0
  80. package/dist/test/unit-test/pattern-matching/pattern-matching-spec.js +6 -0
  81. package/dist/test/unit-test/prettier-ignore/prettier-ignore-spec.js +28 -0
  82. package/dist/test/unit-test/records/records-spec.js +6 -0
  83. package/dist/test/unit-test/return/return-spec.js +6 -0
  84. package/dist/test/unit-test/sealed/sealed-spec.js +6 -0
  85. package/dist/test/unit-test/snippets/arrays/array-initializer.spec.js +94 -0
  86. package/dist/test/unit-test/snippets/arrays/variable-initializer-list.spec.js +19 -0
  87. package/dist/test/unit-test/snippets/blocks-and-statements/switch.spec.js +26 -0
  88. package/dist/test/unit-test/snippets/classes/class-body.spec.js +181 -0
  89. package/dist/test/unit-test/snippets/classes/enum-body.spec.js +87 -0
  90. package/dist/test/unit-test/snippets/classes/variableDeclarator/test.spec.js +186 -0
  91. package/dist/test/unit-test/snippets/interfaces/element-value-array-initializer.spec.js +85 -0
  92. package/dist/test/unit-test/snippets/names/ambiguousName/test.spec.js +19 -0
  93. package/dist/test/unit-test/snippets/names/expressionName/test.spec.js +19 -0
  94. package/dist/test/unit-test/snippets/names/methodName/test.spec.js +12 -0
  95. package/dist/test/unit-test/snippets/names/packageOrTypeName/test.spec.js +19 -0
  96. package/dist/test/unit-test/snippets/types-values-and-variables/floatingPointType/test.spec.js +19 -0
  97. package/dist/test/unit-test/snippets/types-values-and-variables/integralType/test.spec.js +40 -0
  98. package/dist/test/unit-test/snippets/types-values-and-variables/numericType/test.spec.js +88 -0
  99. package/dist/test/unit-test/snippets/types-values-and-variables/wildcard/test.spec.js +112 -0
  100. package/dist/test/unit-test/snippets/types-values-and-variables/wildcardBounds/test.spec.js +81 -0
  101. package/dist/test/unit-test/switch/switch-spec.js +6 -0
  102. package/dist/test/unit-test/synchronized/synchronized-spec.js +6 -0
  103. package/dist/test/unit-test/text-blocks/text-block-spec.js +6 -0
  104. package/dist/test/unit-test/throws/throws-spec.js +6 -0
  105. package/dist/test/unit-test/try_catch/try_catch-spec.js +6 -0
  106. package/dist/test/unit-test/types/types-spec.js +6 -0
  107. package/dist/test/unit-test/variables/variables-spec.js +6 -0
  108. package/dist/test/unit-test/while/while-spec.js +6 -0
  109. package/dist/test/unit-test/yield-statement/yield-statement-spec.js +6 -0
  110. package/dist/utils/index.js +3 -1
  111. package/dist/utils/isEmptyDoc.js +6 -0
  112. package/dist/utils/printArgumentListWithBraces.js +2 -2
  113. package/dist/utils/printSingleLambdaInvocation.js +4 -4
  114. package/package.json +21 -21
  115. package/dist/utils/constants.js +0 -4
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var base_cst_printer_1 = require("../../../../../src/base-cst-printer");
40
+ var sinon_1 = require("sinon");
41
+ var test_utils_1 = require("../../../../test-utils");
42
+ describe("Wildcard", function () {
43
+ var wildcardBoundsSpy;
44
+ // eslint-disable-next-line no-undef
45
+ beforeEach(function () {
46
+ if (wildcardBoundsSpy !== undefined) {
47
+ wildcardBoundsSpy.restore();
48
+ }
49
+ wildcardBoundsSpy = sinon_1.spy(base_cst_printer_1.BaseCstPrettierPrinter.prototype, "wildcardBounds");
50
+ });
51
+ it("can format a wildcard", function () { return __awaiter(void 0, void 0, void 0, function () {
52
+ return __generator(this, function (_a) {
53
+ switch (_a.label) {
54
+ case 0: return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
55
+ snippet: "?",
56
+ expectedOutput: "?",
57
+ entryPoint: "wildcard"
58
+ })];
59
+ case 1:
60
+ _a.sent();
61
+ return [2 /*return*/];
62
+ }
63
+ });
64
+ }); });
65
+ it("can format a wildcard with one annotations", function () { return __awaiter(void 0, void 0, void 0, function () {
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0: return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
69
+ snippet: "@Anno ?",
70
+ expectedOutput: "@Anno ?",
71
+ entryPoint: "wildcard"
72
+ })];
73
+ case 1:
74
+ _a.sent();
75
+ return [2 /*return*/];
76
+ }
77
+ });
78
+ }); });
79
+ it("can format a wildcard with annotations that exceed printWidth ", function () { return __awaiter(void 0, void 0, void 0, function () {
80
+ var snippet, expectedOutput;
81
+ return __generator(this, function (_a) {
82
+ switch (_a.label) {
83
+ case 0:
84
+ snippet = "@Annotation1 @Annotation2 @Annotation3 @Annotation4 @Annotation5 @Annotation6 @Annotation7 ?";
85
+ expectedOutput = "@Annotation1 @Annotation2 @Annotation3 @Annotation4 @Annotation5 @Annotation6 @Annotation7 ?";
86
+ return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
87
+ snippet: snippet,
88
+ expectedOutput: expectedOutput,
89
+ entryPoint: "wildcard"
90
+ })];
91
+ case 1:
92
+ _a.sent();
93
+ return [2 /*return*/];
94
+ }
95
+ });
96
+ }); });
97
+ it("can format a wildcard with wildcardBound", function () { return __awaiter(void 0, void 0, void 0, function () {
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
100
+ case 0: return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
101
+ snippet: "? extends int[]",
102
+ expectedOutput: "? extends int[]",
103
+ entryPoint: "wildcard"
104
+ })];
105
+ case 1:
106
+ _a.sent();
107
+ sinon_1.assert.calledTwice(wildcardBoundsSpy);
108
+ return [2 /*return*/];
109
+ }
110
+ });
111
+ }); });
112
+ });
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var base_cst_printer_1 = require("../../../../../src/base-cst-printer");
40
+ var sinon_1 = require("sinon");
41
+ var test_utils_1 = require("../../../../test-utils");
42
+ describe("Wildcard Bounds", function () {
43
+ var referenceTypeSpy;
44
+ // eslint-disable-next-line no-undef
45
+ beforeEach(function () {
46
+ if (referenceTypeSpy !== undefined) {
47
+ referenceTypeSpy.restore();
48
+ }
49
+ referenceTypeSpy = sinon_1.spy(base_cst_printer_1.BaseCstPrettierPrinter.prototype, "referenceType");
50
+ });
51
+ it("can format a wildcardBounds with extends", function () { return __awaiter(void 0, void 0, void 0, function () {
52
+ return __generator(this, function (_a) {
53
+ switch (_a.label) {
54
+ case 0: return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
55
+ snippet: "extends int[]",
56
+ expectedOutput: "extends int[]",
57
+ entryPoint: "wildcardBounds"
58
+ })];
59
+ case 1:
60
+ _a.sent();
61
+ sinon_1.assert.callCount(referenceTypeSpy, 2);
62
+ return [2 /*return*/];
63
+ }
64
+ });
65
+ }); });
66
+ it("can format a wildcardBounds with super", function () { return __awaiter(void 0, void 0, void 0, function () {
67
+ return __generator(this, function (_a) {
68
+ switch (_a.label) {
69
+ case 0: return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
70
+ snippet: "super int[]",
71
+ expectedOutput: "super int[]",
72
+ entryPoint: "wildcardBounds"
73
+ })];
74
+ case 1:
75
+ _a.sent();
76
+ sinon_1.assert.callCount(referenceTypeSpy, 2);
77
+ return [2 /*return*/];
78
+ }
79
+ });
80
+ }); });
81
+ });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var test_utils_1 = require("../../test-utils");
4
+ describe("prettier-java: switch", function () {
5
+ test_utils_1.testSample(__dirname);
6
+ });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var test_utils_1 = require("../../test-utils");
4
+ describe("prettier-java: synchronized", function () {
5
+ test_utils_1.testSample(__dirname);
6
+ });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var test_utils_1 = require("../../test-utils");
4
+ describe("prettier-java: Text Blocks", function () {
5
+ test_utils_1.testSample(__dirname);
6
+ });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var test_utils_1 = require("../../test-utils");
4
+ describe("prettier-java: throws", function () {
5
+ test_utils_1.testSample(__dirname);
6
+ });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var test_utils_1 = require("../../test-utils");
4
+ describe("prettier-java: try catch", function () {
5
+ test_utils_1.testSample(__dirname);
6
+ });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var test_utils_1 = require("../../test-utils");
4
+ describe("prettier-java: types", function () {
5
+ test_utils_1.testSample(__dirname);
6
+ });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var test_utils_1 = require("../../test-utils");
4
+ describe("prettier-java: variables", function () {
5
+ test_utils_1.testSample(__dirname);
6
+ });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var test_utils_1 = require("../../test-utils");
4
+ describe("prettier-java: while", function () {
5
+ test_utils_1.testSample(__dirname);
6
+ });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var test_utils_1 = require("../../test-utils");
4
+ describe("prettier-java: yield statement", function () {
5
+ test_utils_1.testSample(__dirname);
6
+ });
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.printSingleLambdaInvocation = exports.printArgumentListWithBraces = void 0;
6
+ exports.isEmptyDoc = exports.printSingleLambdaInvocation = exports.printArgumentListWithBraces = void 0;
7
7
  var printArgumentListWithBraces_1 = require("./printArgumentListWithBraces");
8
8
  Object.defineProperty(exports, "printArgumentListWithBraces", { enumerable: true, get: function () { return __importDefault(printArgumentListWithBraces_1).default; } });
9
9
  var printSingleLambdaInvocation_1 = require("./printSingleLambdaInvocation");
10
10
  Object.defineProperty(exports, "printSingleLambdaInvocation", { enumerable: true, get: function () { return __importDefault(printSingleLambdaInvocation_1).default; } });
11
+ var isEmptyDoc_1 = require("./isEmptyDoc");
12
+ Object.defineProperty(exports, "isEmptyDoc", { enumerable: true, get: function () { return __importDefault(isEmptyDoc_1).default; } });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var isEmptyDoc = function (argument) {
4
+ return argument === "" || (Array.isArray(argument) && argument.length) === 0;
5
+ };
6
+ exports.default = isEmptyDoc;
@@ -9,13 +9,13 @@ var printer_utils_1 = require("../printers/printer-utils");
9
9
  var printSingleLambdaInvocation_1 = __importDefault(require("./printSingleLambdaInvocation"));
10
10
  var softline = doc_1.builders.softline;
11
11
  function printArgumentListWithBraces(argumentListCtx, rBrace, lBrace) {
12
- var isSingleLambda = expressions_utils_1.isArgumentListSingleLambda(argumentListCtx);
12
+ var isSingleLambda = (0, expressions_utils_1.isArgumentListSingleLambda)(argumentListCtx);
13
13
  if (isSingleLambda) {
14
14
  return printSingleLambdaInvocation_1.default.call(this, argumentListCtx, rBrace, lBrace);
15
15
  }
16
16
  var argumentList = this.visit(argumentListCtx, {
17
17
  isInsideMethodInvocationSuffix: true
18
18
  });
19
- return printer_utils_1.putIntoBraces(argumentList, softline, lBrace, rBrace);
19
+ return (0, printer_utils_1.putIntoBraces)(argumentList, softline, lBrace, rBrace);
20
20
  }
21
21
  exports.default = printArgumentListWithBraces;
@@ -12,9 +12,9 @@ function printSingleLambdaInvocation(argumentListCtx, rBrace, lBrace) {
12
12
  lambdaParametersGroupId: lambdaParametersGroupId,
13
13
  isInsideMethodInvocationSuffix: true
14
14
  });
15
- var formattedRBrace = expressions_utils_1.isSingleArgumentLambdaExpressionWithBlock(argumentListCtx)
16
- ? ifBreak(prettier_builder_1.indent(prettier_builder_1.concat([softline, rBrace])), format_comments_1.printTokenWithComments(rBrace), { groupId: lambdaParametersGroupId })
17
- : prettier_builder_1.indent(prettier_builder_1.concat([softline, rBrace]));
18
- return prettier_builder_1.dedent(printer_utils_1.putIntoBraces(argumentList, "", lBrace, formattedRBrace));
15
+ var formattedRBrace = (0, expressions_utils_1.isSingleArgumentLambdaExpressionWithBlock)(argumentListCtx)
16
+ ? ifBreak((0, prettier_builder_1.indent)((0, prettier_builder_1.concat)([softline, rBrace])), (0, format_comments_1.printTokenWithComments)(rBrace), { groupId: lambdaParametersGroupId })
17
+ : (0, prettier_builder_1.indent)((0, prettier_builder_1.concat)([softline, rBrace]));
18
+ return (0, prettier_builder_1.dedent)((0, printer_utils_1.putIntoBraces)(argumentList, "", lBrace, formattedRBrace));
19
19
  }
20
20
  exports.default = printSingleLambdaInvocation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-java",
3
- "version": "1.6.2",
3
+ "version": "2.1.0",
4
4
  "description": "Prettier Java Plugin",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -9,38 +9,38 @@
9
9
  "repository": "https://github.com/jhipster/prettier-java",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
- "java-parser": "2.0.2",
12
+ "java-parser": "2.0.4",
13
13
  "lodash": "4.17.21",
14
- "prettier": "2.3.1"
14
+ "prettier": "2.8.4"
15
15
  },
16
16
  "scripts": {
17
- "test": "npm-run-all test:unit test:e2e-core",
17
+ "test": "yarn run test:unit && yarn run test:e2e-core",
18
18
  "test:unit": "mocha \"test/unit-test/**/*.spec.ts\" \"test/unit-test/**/*-spec.ts\"",
19
19
  "test:e2e-core": "node scripts/clone-samples e2e-core && mocha \"test/repository-test/core-test.ts\"",
20
20
  "test:e2e-jhipster1": "node scripts/clone-samples e2e-jhipster1 && mocha \"test/repository-test/jhipster-1-test.ts\"",
21
21
  "test:e2e-jhipster2": "node scripts/clone-samples e2e-jhipster2 && mocha \"test/repository-test/jhipster-2-test.ts\"",
22
- "test:all": "npm-run-all test test:e2e-jhipster1 test:e2e-jhipster2",
22
+ "test:all": "yarn run test && yarn run test:e2e-jhipster1 && yarn run test:e2e-jhipster2",
23
23
  "clone-samples": "node scripts/clone-samples.js",
24
24
  "build": "tsc -p tsconfig.build.json --outDir dist",
25
- "build:watch": "tsc -p tsconfig.build.json --outDir dist -w"
25
+ "build:watch": "tsc -p tsconfig.build.json --inlineSourceMap --outDir dist -w"
26
26
  },
27
27
  "devDependencies": {
28
- "@babel/cli": "7.14.8",
29
- "@babel/core": "7.15.0",
30
- "@babel/preset-env": "7.15.0",
31
- "@babel/preset-typescript": "7.15.0",
32
- "@babel/register": "7.15.3",
28
+ "@babel/cli": "7.19.3",
29
+ "@babel/core": "7.20.2",
30
+ "@babel/preset-env": "7.20.2",
31
+ "@babel/preset-typescript": "7.18.6",
32
+ "@babel/register": "7.18.9",
33
33
  "@chevrotain/types": "9.0.2",
34
- "@types/chai": "4.2.21",
35
- "@types/fs-extra": "9.0.12",
36
- "@types/jest": "27.0.1",
34
+ "@types/chai": "4.3.4",
35
+ "@types/fs-extra": "9.0.13",
36
+ "@types/jest": "29.2.3",
37
37
  "@types/klaw-sync": "6.0.1",
38
- "@types/lodash": "4.14.172",
39
- "@types/node": "16.7.1",
40
- "@types/prettier": "2.3.1",
41
- "@types/sinon": "10.0.2",
42
- "ts-node": "10.2.1",
43
- "typescript": "4.3.5"
38
+ "@types/lodash": "4.14.190",
39
+ "@types/node": "18.11.9",
40
+ "@types/prettier": "2.7.1",
41
+ "@types/sinon": "10.0.13",
42
+ "ts-node": "10.9.1",
43
+ "typescript": "4.9.3"
44
44
  },
45
- "gitHead": "2e731c6dcec31dc9e58ec1721eef821f7fc031ee"
45
+ "gitHead": "28084f4c2c6b53784c5853fc51865dc8c7b083f9"
46
46
  }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.whitespace = void 0;
4
- exports.whitespace = " ";