prettier 1.16.2 → 1.17.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.
package/standalone.js CHANGED
@@ -5,7 +5,7 @@
5
5
  }(this, (function () { 'use strict';
6
6
 
7
7
  var name = "prettier";
8
- var version$1 = "1.16.2";
8
+ var version$1 = "1.17.1";
9
9
  var description = "Prettier is an opinionated code formatter";
10
10
  var bin = {
11
11
  "prettier": "./bin/prettier.js"
@@ -19,12 +19,12 @@ var engines = {
19
19
  "node": ">=6"
20
20
  };
21
21
  var dependencies = {
22
- "@angular/compiler": "6.1.10",
23
- "@babel/code-frame": "7.0.0-beta.46",
22
+ "@angular/compiler": "7.2.9",
23
+ "@babel/code-frame": "7.0.0",
24
24
  "@babel/parser": "7.2.0",
25
25
  "@glimmer/syntax": "0.30.3",
26
26
  "@iarna/toml": "2.0.0",
27
- "@typescript-eslint/typescript-estree": "1.1.0",
27
+ "@typescript-eslint/typescript-estree": "1.6.0",
28
28
  "angular-estree-parser": "1.1.5",
29
29
  "angular-html-parser": "1.2.0",
30
30
  "camelcase": "4.1.0",
@@ -43,11 +43,11 @@ var dependencies = {
43
43
  "flow-parser": "0.84.0",
44
44
  "get-stream": "3.0.0",
45
45
  "globby": "6.1.0",
46
- "graphql": "0.13.2",
46
+ "graphql": "14.2.0",
47
47
  "html-element-attributes": "2.0.0",
48
48
  "html-styles": "1.0.0",
49
49
  "html-tag-names": "1.1.2",
50
- "ignore": "3.3.7",
50
+ "ignore": "4.0.6",
51
51
  "is-ci": "2.0.0",
52
52
  "jest-docblock": "23.2.0",
53
53
  "json-stable-stringify": "1.0.1",
@@ -72,7 +72,7 @@ var dependencies = {
72
72
  "resolve": "1.5.0",
73
73
  "semver": "5.4.1",
74
74
  "string-width": "3.0.0",
75
- "typescript": "3.2.2",
75
+ "typescript": "3.4.1",
76
76
  "unicode-regex": "2.0.0",
77
77
  "unified": "6.1.6",
78
78
  "vnopts": "1.0.2",
@@ -101,7 +101,7 @@ var devDependencies = {
101
101
  "jest-snapshot-serializer-raw": "1.1.0",
102
102
  "jest-watch-typeahead": "0.1.0",
103
103
  "mkdirp": "0.5.1",
104
- "prettier": "1.16.1",
104
+ "prettier": "1.17.0",
105
105
  "prettylint": "1.0.0",
106
106
  "rimraf": "2.6.2",
107
107
  "rollup": "0.47.6",
@@ -120,9 +120,6 @@ var devDependencies = {
120
120
  "tempy": "0.2.1",
121
121
  "webpack": "3.12.0"
122
122
  };
123
- var resolutions = {
124
- "@babel/code-frame": "7.0.0-beta.46"
125
- };
126
123
  var scripts = {
127
124
  "prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
128
125
  "prepare-release": "yarn && yarn build && yarn test:dist",
@@ -152,7 +149,6 @@ var _package = {
152
149
  engines: engines,
153
150
  dependencies: dependencies,
154
151
  devDependencies: devDependencies,
155
- resolutions: resolutions,
156
152
  scripts: scripts
157
153
  };
158
154
 
@@ -169,7 +165,6 @@ var _package$1 = Object.freeze({
169
165
  engines: engines,
170
166
  dependencies: dependencies,
171
167
  devDependencies: devDependencies,
172
- resolutions: resolutions,
173
168
  scripts: scripts,
174
169
  default: _package
175
170
  });
@@ -6318,6 +6313,10 @@ var options$2 = {
6318
6313
  value: "angular",
6319
6314
  since: "1.15.0",
6320
6315
  description: "Angular"
6316
+ }, {
6317
+ value: "lwc",
6318
+ since: "1.17.0",
6319
+ description: "Lightning Web Components"
6321
6320
  }]
6322
6321
  },
6323
6322
  plugins: {
@@ -6496,6 +6495,7 @@ function getSupportInfo$2(version, opts) {
6496
6495
  });
6497
6496
  });
6498
6497
  var usePostCssParser = semver.lt(version, "1.7.1");
6498
+ var useBabylonParser = semver.lt(version, "1.16.0");
6499
6499
  var languages = plugins.reduce(function (all, plugin) {
6500
6500
  return all.concat(plugin.languages || []);
6501
6501
  }, []).filter(filterSince).map(function (language) {
@@ -6510,6 +6510,15 @@ function getSupportInfo$2(version, opts) {
6510
6510
  return Object.assign({}, language, {
6511
6511
  parsers: ["typescript"]
6512
6512
  });
6513
+ } // "babylon" was renamed to "babel" in 1.16.0
6514
+
6515
+
6516
+ if (useBabylonParser && language.parsers.indexOf("babel") !== -1) {
6517
+ return Object.assign({}, language, {
6518
+ parsers: language.parsers.map(function (parser) {
6519
+ return parser === "babel" ? "babylon" : parser;
6520
+ })
6521
+ });
6513
6522
  }
6514
6523
 
6515
6524
  if (usePostCssParser && (language.name === "CSS" || language.group === "CSS")) {
@@ -11322,19 +11331,20 @@ var loc = {
11322
11331
  };
11323
11332
 
11324
11333
  var jsTokens = createCommonjsModule(function (module, exports) {
11325
- // Copyright 2014, 2015, 2016, 2017 Simon Lydell
11334
+ // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
11326
11335
  // License: MIT. (See LICENSE.)
11327
11336
  Object.defineProperty(exports, "__esModule", {
11328
11337
  value: true
11329
11338
  }); // This regex comes from regex.coffee, and is inserted here by generate-index.js
11330
11339
  // (run `npm run build`).
11331
11340
 
11332
- exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
11341
+ exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
11333
11342
 
11334
11343
  exports.matchToToken = function (match) {
11335
11344
  var token = {
11336
11345
  type: "invalid",
11337
- value: match[0]
11346
+ value: match[0],
11347
+ closed: undefined
11338
11348
  };
11339
11349
  if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
11340
11350
  return token;
@@ -12455,7 +12465,7 @@ var lib$3 = createCommonjsModule(function (module, exports) {
12455
12465
  exports.default = highlight;
12456
12466
 
12457
12467
  function _jsTokens() {
12458
- var data = _interopRequireWildcard(jsTokens);
12468
+ var data = _interopRequireWildcard$$1(jsTokens);
12459
12469
 
12460
12470
  _jsTokens = function _jsTokens() {
12461
12471
  return data;
@@ -12465,7 +12475,7 @@ var lib$3 = createCommonjsModule(function (module, exports) {
12465
12475
  }
12466
12476
 
12467
12477
  function _esutils() {
12468
- var data = _interopRequireDefault(utils$2);
12478
+ var data = _interopRequireDefault$$1(utils$2);
12469
12479
 
12470
12480
  _esutils = function _esutils() {
12471
12481
  return data;
@@ -12475,7 +12485,7 @@ var lib$3 = createCommonjsModule(function (module, exports) {
12475
12485
  }
12476
12486
 
12477
12487
  function _chalk() {
12478
- var data = _interopRequireDefault(chalk$5);
12488
+ var data = _interopRequireDefault$$1(chalk$5);
12479
12489
 
12480
12490
  _chalk = function _chalk() {
12481
12491
  return data;
@@ -12484,13 +12494,13 @@ var lib$3 = createCommonjsModule(function (module, exports) {
12484
12494
  return data;
12485
12495
  }
12486
12496
 
12487
- function _interopRequireDefault(obj) {
12497
+ function _interopRequireDefault$$1(obj) {
12488
12498
  return obj && obj.__esModule ? obj : {
12489
12499
  default: obj
12490
12500
  };
12491
12501
  }
12492
12502
 
12493
- function _interopRequireWildcard(obj) {
12503
+ function _interopRequireWildcard$$1(obj) {
12494
12504
  if (obj && obj.__esModule) {
12495
12505
  return obj;
12496
12506
  } else {
@@ -12535,8 +12545,9 @@ var lib$3 = createCommonjsModule(function (module, exports) {
12535
12545
 
12536
12546
  function getTokenType(match) {
12537
12547
  var _match$slice = match.slice(-2),
12538
- offset = _match$slice[0],
12539
- text = _match$slice[1];
12548
+ _match$slice2 = _slicedToArray(_match$slice, 2),
12549
+ offset = _match$slice2[0],
12550
+ text = _match$slice2[1];
12540
12551
 
12541
12552
  var token = (0, _jsTokens().matchToToken)(match);
12542
12553
 
@@ -12601,10 +12612,8 @@ var lib$3 = createCommonjsModule(function (module, exports) {
12601
12612
  return chalk;
12602
12613
  }
12603
12614
 
12604
- function highlight(code, options) {
12605
- if (options === void 0) {
12606
- options = {};
12607
- }
12615
+ function highlight(code) {
12616
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12608
12617
 
12609
12618
  if (shouldHighlight(options)) {
12610
12619
  var chalk = getChalk(options);
@@ -12674,7 +12683,7 @@ var lib$2 = createCommonjsModule(function (module, exports) {
12674
12683
  var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
12675
12684
 
12676
12685
  function getMarkerLines(loc, source, opts) {
12677
- var startLoc = Object.assign({}, {
12686
+ var startLoc = Object.assign({
12678
12687
  column: 0,
12679
12688
  line: -1
12680
12689
  }, loc.start);
@@ -12739,11 +12748,8 @@ var lib$2 = createCommonjsModule(function (module, exports) {
12739
12748
  };
12740
12749
  }
12741
12750
 
12742
- function codeFrameColumns(rawLines, loc, opts) {
12743
- if (opts === void 0) {
12744
- opts = {};
12745
- }
12746
-
12751
+ function codeFrameColumns(rawLines, loc) {
12752
+ var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
12747
12753
  var highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
12748
12754
  var chalk = (0, _highlight().getChalk)(opts);
12749
12755
  var defs = getDefs(chalk);
@@ -12764,8 +12770,8 @@ var lib$2 = createCommonjsModule(function (module, exports) {
12764
12770
  var numberMaxWidth = String(end).length;
12765
12771
  var frame = lines.slice(start, end).map(function (line, index) {
12766
12772
  var number = start + 1 + index;
12767
- var paddedNumber = (" " + number).slice(-numberMaxWidth);
12768
- var gutter = " " + paddedNumber + " | ";
12773
+ var paddedNumber = " ".concat(number).slice(-numberMaxWidth);
12774
+ var gutter = " ".concat(paddedNumber, " | ");
12769
12775
  var hasMarker = markerLines[number];
12770
12776
  var lastMarkerLine = !markerLines[number + 1];
12771
12777
 
@@ -12784,12 +12790,12 @@ var lib$2 = createCommonjsModule(function (module, exports) {
12784
12790
 
12785
12791
  return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
12786
12792
  } else {
12787
- return " " + maybeHighlight(defs.gutter, gutter) + line;
12793
+ return " ".concat(maybeHighlight(defs.gutter, gutter)).concat(line);
12788
12794
  }
12789
12795
  }).join("\n");
12790
12796
 
12791
12797
  if (opts.message && !hasColumns) {
12792
- frame = "" + " ".repeat(numberMaxWidth + 1) + opts.message + "\n" + frame;
12798
+ frame = "".concat(" ".repeat(numberMaxWidth + 1)).concat(opts.message, "\n").concat(frame);
12793
12799
  }
12794
12800
 
12795
12801
  if (highlighted) {
@@ -12799,10 +12805,8 @@ var lib$2 = createCommonjsModule(function (module, exports) {
12799
12805
  }
12800
12806
  }
12801
12807
 
12802
- function _default(rawLines, lineNumber, colNumber, opts) {
12803
- if (opts === void 0) {
12804
- opts = {};
12805
- }
12808
+ function _default(rawLines, lineNumber, colNumber) {
12809
+ var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
12806
12810
 
12807
12811
  if (!deprecationWarningShown) {
12808
12812
  deprecationWarningShown = true;
@@ -13470,14 +13474,6 @@ function getPenultimate(arr) {
13470
13474
  return null;
13471
13475
  }
13472
13476
 
13473
- function getLast$3(arr) {
13474
- if (arr.length > 0) {
13475
- return arr[arr.length - 1];
13476
- }
13477
-
13478
- return null;
13479
- }
13480
-
13481
13477
  function skip(chars) {
13482
13478
  return function (text, index, opts) {
13483
13479
  var backwards = opts && opts.backwards; // Allow `skip` functions to be threaded together without having
@@ -13892,7 +13888,7 @@ function printString(raw, options, isDirectiveLiteral) {
13892
13888
  // sure that we consistently output the minimum amount of escaped quotes.
13893
13889
 
13894
13890
 
13895
- return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.parentParser === "html" || options.parentParser === "vue" || options.parentParser === "angular"));
13891
+ return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.parentParser === "html" || options.parentParser === "vue" || options.parentParser === "angular" || options.parentParser === "lwc"));
13896
13892
  }
13897
13893
 
13898
13894
  function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
@@ -14080,7 +14076,7 @@ var util = {
14080
14076
  isExportDeclaration: isExportDeclaration,
14081
14077
  getParentExportDeclaration: getParentExportDeclaration,
14082
14078
  getPenultimate: getPenultimate,
14083
- getLast: getLast$3,
14079
+ getLast: getLast,
14084
14080
  getNextNonSpaceNonCommentCharacterIndexWithStartIndex: getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
14085
14081
  getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex,
14086
14082
  getNextNonSpaceNonCommentCharacter: getNextNonSpaceNonCommentCharacter,
@@ -15533,7 +15529,7 @@ function printTrailingComment(commentPath, print, options) {
15533
15529
  return concat([" ", contents]);
15534
15530
  }
15535
15531
 
15536
- return concat([lineSuffix(" " + contents), !isBlock ? breakParent : ""]);
15532
+ return concat([lineSuffix(concat([" ", contents])), !isBlock ? breakParent : ""]);
15537
15533
  }
15538
15534
 
15539
15535
  function printDanglingComments(path, options, sameIndent, filter) {
@@ -16293,7 +16289,6 @@ function formatRange(text, opts) {
16293
16289
  var rangeResult = coreFormat(rangeString, Object.assign({}, opts, {
16294
16290
  rangeStart: 0,
16295
16291
  rangeEnd: Infinity,
16296
- printWidth: opts.printWidth - alignmentSize,
16297
16292
  // track the cursor offset only if it's within our range
16298
16293
  cursorOffset: opts.cursorOffset >= rangeStart && opts.cursorOffset < rangeEnd ? opts.cursorOffset - rangeStart : -1
16299
16294
  }), alignmentSize); // Since the range contracts to avoid trailing whitespace,
@@ -18175,7 +18170,7 @@ function genericPrint$1(path, options, print) {
18175
18170
 
18176
18171
  case "FragmentDefinition":
18177
18172
  {
18178
- return concat$6(["fragment ", path.call(print, "name"), " on ", path.call(print, "typeCondition"), printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
18173
+ return concat$6(["fragment ", path.call(print, "name"), n.variableDefinitions && n.variableDefinitions.length ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.map(print, "variableDefinitions"))])), softline$2, ")"])) : "", " on ", path.call(print, "typeCondition"), printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
18179
18174
  }
18180
18175
 
18181
18176
  case "SelectionSet":
@@ -18258,7 +18253,7 @@ function genericPrint$1(path, options, print) {
18258
18253
 
18259
18254
  case "VariableDefinition":
18260
18255
  {
18261
- return concat$6([path.call(print, "variable"), ": ", path.call(print, "type"), n.defaultValue ? concat$6([" = ", path.call(print, "defaultValue")]) : ""]);
18256
+ return concat$6([path.call(print, "variable"), ": ", path.call(print, "type"), n.defaultValue ? concat$6([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]);
18262
18257
  }
18263
18258
 
18264
18259
  case "TypeExtensionDefinition":
@@ -18547,8 +18542,8 @@ function print(path, options, print) {
18547
18542
  case "BlockStatement":
18548
18543
  {
18549
18544
  var pp = path.getParentNode(1);
18550
- var isElseIf = pp && pp.inverse && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if";
18551
- var hasElseIf = n.inverse && n.inverse.body[0] && n.inverse.body[0].type === "BlockStatement" && n.inverse.body[0].path.parts[0] === "if";
18545
+ var isElseIf = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if";
18546
+ var hasElseIf = n.inverse && n.inverse.body.length === 1 && n.inverse.body[0].type === "BlockStatement" && n.inverse.body[0].path.parts[0] === "if";
18552
18547
  var indentElse = hasElseIf ? function (a) {
18553
18548
  return a;
18554
18549
  } : indent$4;
@@ -20664,6 +20659,15 @@ function embed$2(path, print, textToDoc, options) {
20664
20659
 
20665
20660
  if (/^PRETTIER_HTML_PLACEHOLDER_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
20666
20661
  return concat$8([node.rawName, "=", node.value]);
20662
+ } // lwc: html`<my-element data-for={value}></my-elememt>`
20663
+
20664
+
20665
+ if (options.parser === "lwc") {
20666
+ var interpolationRegex = /^\{[\s\S]*\}$/;
20667
+
20668
+ if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
20669
+ return concat$8([node.rawName, "=", node.value]);
20670
+ }
20667
20671
  }
20668
20672
 
20669
20673
  var embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, function (code, opts) {
@@ -21444,6 +21448,15 @@ var languages$3 = [createLanguage(require$$0$22, {
21444
21448
  extensions: [".mjml" // MJML is considered XML in Linguist but it should be formatted as HTML
21445
21449
  ]
21446
21450
  }
21451
+ }), createLanguage(require$$0$22, {
21452
+ override: {
21453
+ name: "Lightning Web Components",
21454
+ since: "1.17.0",
21455
+ parsers: ["lwc"],
21456
+ vscodeLanguageIds: ["html"],
21457
+ extensions: [],
21458
+ filenames: []
21459
+ }
21447
21460
  }), createLanguage(require$$1$9, {
21448
21461
  override: {
21449
21462
  since: "1.10.0",
@@ -22693,27 +22706,36 @@ var utils$8 = {
22693
22706
 
22694
22707
  var hasFlowShorthandAnnotationComment$1 = utils$8.hasFlowShorthandAnnotationComment;
22695
22708
 
22696
- function hasClosureCompilerTypeCastComment(text, path, locStart, locEnd) {
22709
+ function hasClosureCompilerTypeCastComment(text, path) {
22697
22710
  // https://github.com/google/closure-compiler/wiki/Annotating-Types#type-casts
22698
22711
  // Syntax example: var x = /** @type {string} */ (fruit);
22699
22712
  var n = path.getValue();
22700
- return util.getNextNonSpaceNonCommentCharacter(text, n, locEnd) === ")" && (hasTypeCastComment(n) || hasAncestorTypeCastComment(0)); // for sub-item: /** @type {array} */ (numberOrString).map(x => x);
22713
+ return isParenthesized(n) && (hasTypeCastComment(n) || hasAncestorTypeCastComment(0)); // for sub-item: /** @type {array} */ (numberOrString).map(x => x);
22701
22714
 
22702
22715
  function hasAncestorTypeCastComment(index) {
22703
22716
  var ancestor = path.getParentNode(index);
22704
- return ancestor && util.getNextNonSpaceNonCommentCharacter(text, ancestor, locEnd) !== ")" && /^[\s(]*$/.test(text.slice(locStart(ancestor), locStart(n))) ? hasTypeCastComment(ancestor) || hasAncestorTypeCastComment(index + 1) : false;
22717
+ return ancestor && !isParenthesized(ancestor) ? hasTypeCastComment(ancestor) || hasAncestorTypeCastComment(index + 1) : false;
22705
22718
  }
22706
22719
 
22707
22720
  function hasTypeCastComment(node) {
22708
22721
  return node.comments && node.comments.some(function (comment) {
22709
- return comment.leading && comments$3.isBlockComment(comment) && isTypeCastComment(comment.value) && util.getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === "(";
22722
+ return comment.leading && comments$3.isBlockComment(comment) && isTypeCastComment(comment.value);
22710
22723
  });
22711
22724
  }
22712
22725
 
22726
+ function isParenthesized(node) {
22727
+ // Closure typecast comments only really make sense when _not_ using
22728
+ // typescript or flow parsers, so we take advantage of the babel parser's
22729
+ // parenthesized expressions.
22730
+ return node.extra && node.extra.parenthesized;
22731
+ }
22732
+
22713
22733
  function isTypeCastComment(comment) {
22714
- var trimmed = comment.trim();
22734
+ var cleaned = comment.trim().split("\n").map(function (line) {
22735
+ return line.replace(/^[\s*]+/, "");
22736
+ }).join(" ").trim();
22715
22737
 
22716
- if (!/^\*\s*@type\s*\{[^]+\}$/.test(trimmed)) {
22738
+ if (!/^@type\s+\{[^]+\}$/.test(cleaned)) {
22717
22739
  return false;
22718
22740
  }
22719
22741
 
@@ -22724,7 +22746,7 @@ function hasClosureCompilerTypeCastComment(text, path, locStart, locEnd) {
22724
22746
  var _iteratorError = undefined;
22725
22747
 
22726
22748
  try {
22727
- for (var _iterator = trimmed[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
22749
+ for (var _iterator = cleaned[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
22728
22750
  var char = _step.value;
22729
22751
 
22730
22752
  if (char === "{") {
@@ -22792,7 +22814,7 @@ function needsParens(path, options) {
22792
22814
  // parentheses.
22793
22815
 
22794
22816
 
22795
- if (hasClosureCompilerTypeCastComment(options.originalText, path, options.locStart, options.locEnd)) {
22817
+ if (hasClosureCompilerTypeCastComment(options.originalText, path)) {
22796
22818
  return true;
22797
22819
  }
22798
22820
 
@@ -23103,6 +23125,7 @@ function needsParens(path, options) {
23103
23125
  case "TSAsExpression":
23104
23126
  case "TSNonNullExpression":
23105
23127
  case "BindExpression":
23128
+ case "OptionalMemberExpression":
23106
23129
  return true;
23107
23130
 
23108
23131
  case "MemberExpression":
@@ -23216,6 +23239,7 @@ function needsParens(path, options) {
23216
23239
 
23217
23240
  case "FunctionExpression":
23218
23241
  switch (parent.type) {
23242
+ case "NewExpression":
23219
23243
  case "CallExpression":
23220
23244
  return name === "callee";
23221
23245
  // Not strictly necessary, but it's clearer to the reader if IIFEs are wrapped in parentheses.
@@ -23260,7 +23284,16 @@ function needsParens(path, options) {
23260
23284
  }
23261
23285
 
23262
23286
  case "ClassExpression":
23263
- return parent.type === "ExportDefaultDeclaration";
23287
+ switch (parent.type) {
23288
+ case "ExportDefaultDeclaration":
23289
+ return true;
23290
+
23291
+ case "NewExpression":
23292
+ return name === "callee" && parent.callee === node;
23293
+
23294
+ default:
23295
+ return false;
23296
+ }
23264
23297
 
23265
23298
  case "OptionalMemberExpression":
23266
23299
  return parent.type === "MemberExpression";
@@ -23292,7 +23325,7 @@ function needsParens(path, options) {
23292
23325
  return false;
23293
23326
 
23294
23327
  case "NGPipeExpression":
23295
- if (parent.type === "NGRoot" || parent.type === "ObjectProperty" || parent.type === "ArrayExpression" || (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.arguments[name] === node || parent.type === "NGPipeExpression" && name === "right" || parent.type === "MemberExpression" && name === "property" || parent.type === "AssignmentExpression") {
23328
+ if (parent.type === "NGRoot" || parent.type === "NGMicrosyntaxExpression" || parent.type === "ObjectProperty" || parent.type === "ArrayExpression" || (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.arguments[name] === node || parent.type === "NGPipeExpression" && name === "right" || parent.type === "MemberExpression" && name === "property" || parent.type === "AssignmentExpression") {
23296
23329
  return false;
23297
23330
  }
23298
23331
 
@@ -23453,7 +23486,7 @@ var shouldFlatten$1 = util.shouldFlatten;
23453
23486
  var getNextNonSpaceNonCommentCharacter$1 = util.getNextNonSpaceNonCommentCharacter;
23454
23487
  var hasNewline$3 = util.hasNewline;
23455
23488
  var hasNewlineInRange$1 = util.hasNewlineInRange;
23456
- var getLast$4 = util.getLast;
23489
+ var getLast$3 = util.getLast;
23457
23490
  var getStringWidth$2 = util.getStringWidth;
23458
23491
  var printString$2 = util.printString;
23459
23492
  var printNumber$2 = util.printNumber;
@@ -23475,6 +23508,7 @@ var isVueEventBindingExpression$2 = htmlBinding.isVueEventBindingExpression;
23475
23508
  var hasNode = utils$8.hasNode;
23476
23509
  var hasFlowAnnotationComment = utils$8.hasFlowAnnotationComment;
23477
23510
  var hasFlowShorthandAnnotationComment = utils$8.hasFlowShorthandAnnotationComment;
23511
+ var needsQuoteProps = new WeakMap();
23478
23512
  var _require$$6$builders = doc.builders;
23479
23513
  var concat$11 = _require$$6$builders.concat;
23480
23514
  var join$7 = _require$$6$builders.join;
@@ -23607,7 +23641,7 @@ function genericPrint$3(path, options, printPath, args) {
23607
23641
  }
23608
23642
 
23609
23643
  function hasNewlineBetweenOrAfterDecorators(node, options) {
23610
- return hasNewlineInRange$1(options.originalText, options.locStart(node.decorators[0]), options.locEnd(getLast$4(node.decorators))) || hasNewline$3(options.originalText, options.locEnd(getLast$4(node.decorators)));
23644
+ return hasNewlineInRange$1(options.originalText, options.locStart(node.decorators[0]), options.locEnd(getLast$3(node.decorators))) || hasNewline$3(options.originalText, options.locEnd(getLast$3(node.decorators)));
23611
23645
  }
23612
23646
 
23613
23647
  function printDecorators(path, options, print) {
@@ -23924,7 +23958,7 @@ function printPathNoParens(path, options, print, args) {
23924
23958
  return chain;
23925
23959
  }
23926
23960
 
23927
- var jsxPart = getLast$4(_parts);
23961
+ var jsxPart = getLast$3(_parts);
23928
23962
  return group$10(concat$11([chain, ifBreak$6(indent$6(jsxPart), jsxPart, {
23929
23963
  groupId: groupId
23930
23964
  })]));
@@ -24269,7 +24303,7 @@ function printPathNoParens(path, options, print, args) {
24269
24303
  if ( // We want to keep CommonJS- and AMD-style require calls, and AMD-style
24270
24304
  // define calls, as a unit.
24271
24305
  // e.g. `define(["some/lib", (lib) => {`
24272
- !isNew && n.callee.type === "Identifier" && (n.callee.name === "require" || n.callee.name === "define") || n.callee.type === "Import" || // Template literals as single arguments
24306
+ !isNew && n.callee.type === "Identifier" && (n.callee.name === "require" || n.callee.name === "define") || // Template literals as single arguments
24273
24307
  n.arguments.length === 1 && isTemplateOnItsOwnLine(n.arguments[0], options.originalText, options) || // Keep test declarations on a single line
24274
24308
  // e.g. `it('long name', () => {`
24275
24309
  !isNew && isTestCall(n, path.getParentNode())) {
@@ -24389,7 +24423,7 @@ function printPathNoParens(path, options, print, args) {
24389
24423
  props.push(concat$11(separatorParts.concat(group$10("..."))));
24390
24424
  }
24391
24425
 
24392
- var lastElem = getLast$4(n[propertiesField]);
24426
+ var lastElem = getLast$3(n[propertiesField]);
24393
24427
  var canHaveTrailingSeparator = !(lastElem && (lastElem.type === "RestProperty" || lastElem.type === "RestElement" || hasNodeIgnoreComment$1(lastElem) || n.inexact));
24394
24428
  var content;
24395
24429
 
@@ -24471,7 +24505,7 @@ function printPathNoParens(path, options, print, args) {
24471
24505
  parts.push(group$10(concat$11(["[", comments.printDanglingComments(path, options), softline$5, "]"])));
24472
24506
  }
24473
24507
  } else {
24474
- var _lastElem = getLast$4(n.elements);
24508
+ var _lastElem = getLast$3(n.elements);
24475
24509
 
24476
24510
  var canHaveTrailingComma = !(_lastElem && _lastElem.type === "RestElement"); // JavaScript allows you to have empty elements in an array which
24477
24511
  // changes its length based on the number of commas. The algorithm
@@ -24915,7 +24949,7 @@ function printPathNoParens(path, options, print, args) {
24915
24949
  return group$10(concat$11(["<", path.call(print, "name"), path.call(print, "typeParameters"), " ", concat$11(path.map(print, "attributes")), _n.selfClosing ? " />" : ">"]));
24916
24950
  }
24917
24951
 
24918
- var lastAttrHasTrailingComments = _n.attributes.length && hasTrailingComment(getLast$4(_n.attributes));
24952
+ var lastAttrHasTrailingComments = _n.attributes.length && hasTrailingComment(getLast$3(_n.attributes));
24919
24953
  var bracketSameLine = // Simple tags (no attributes and no comment in tag name) should be
24920
24954
  // kept unbroken regardless of `jsxBracketSameLine`
24921
24955
  !_n.attributes.length && !nameHasComments || options.jsxBracketSameLine && ( // We should print the bracket in a new line for the following cases:
@@ -26083,18 +26117,27 @@ function printStatementSequence(path, options, print) {
26083
26117
 
26084
26118
  function printPropertyKey(path, options, print) {
26085
26119
  var node = path.getNode();
26120
+ var parent = path.getParentNode();
26086
26121
  var key = node.key;
26087
26122
 
26088
- if (key.type === "Identifier" && !node.computed && options.parser === "json") {
26123
+ if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
26124
+ var objectHasStringProp = (parent.properties || parent.body || parent.members).some(function (prop) {
26125
+ return prop.key && prop.key.type !== "Identifier" && !isStringPropSafeToCoerceToIdentifier(prop, options);
26126
+ });
26127
+ needsQuoteProps.set(parent, objectHasStringProp);
26128
+ }
26129
+
26130
+ if (key.type === "Identifier" && !node.computed && (options.parser === "json" || options.quoteProps === "consistent" && needsQuoteProps.get(parent))) {
26089
26131
  // a -> "a"
26132
+ var prop = printString$2(JSON.stringify(key.name), options);
26090
26133
  return path.call(function (keyPath) {
26091
26134
  return comments.printComments(keyPath, function () {
26092
- return JSON.stringify(key.name);
26135
+ return prop;
26093
26136
  }, options);
26094
26137
  }, "key");
26095
26138
  }
26096
26139
 
26097
- if (isStringLiteral(key) && isIdentifierName(key.value) && !node.computed && options.parser !== "json" && !(options.parser === "typescript" && node.type === "ClassProperty")) {
26140
+ if (isStringPropSafeToCoerceToIdentifier(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
26098
26141
  // 'a' -> a
26099
26142
  return path.call(function (keyPath) {
26100
26143
  return comments.printComments(keyPath, function () {
@@ -26153,7 +26196,7 @@ function couldGroupArg(arg) {
26153
26196
  }
26154
26197
 
26155
26198
  function shouldGroupLastArg(args) {
26156
- var lastArg = getLast$4(args);
26199
+ var lastArg = getLast$3(args);
26157
26200
  var penultimateArg = getPenultimate$1(args);
26158
26201
  return !hasLeadingComment(lastArg) && !hasTrailingComment(lastArg) && couldGroupArg(lastArg) && ( // If the last two arguments are of the same type,
26159
26202
  // disable last element expansion.
@@ -26249,7 +26292,8 @@ function printArgumentsList(path, options, print) {
26249
26292
 
26250
26293
  return concat$11(parts);
26251
26294
  }, "arguments");
26252
- var maybeTrailingComma = shouldPrintComma$1(options, "all") ? "," : "";
26295
+ var maybeTrailingComma = // Dynamic imports cannot have trailing commas
26296
+ !(node.callee && node.callee.type === "Import") && shouldPrintComma$1(options, "all") ? "," : "";
26253
26297
 
26254
26298
  function allArgsBrokenOut() {
26255
26299
  return group$10(concat$11(["(", indent$6(concat$11([line$8, concat$11(printedArguments)])), maybeTrailingComma, line$8, ")"]), {
@@ -26298,14 +26342,14 @@ function printArgumentsList(path, options, print) {
26298
26342
  var somePrintedArgumentsWillBreak = printedArguments.some(willBreak$1);
26299
26343
  return concat$11([somePrintedArgumentsWillBreak ? breakParent$3 : "", conditionalGroup$1([concat$11([ifBreak$6(indent$6(concat$11(["(", softline$5, concat$11(printedExpanded)])), concat$11(["(", concat$11(printedExpanded)])), somePrintedArgumentsWillBreak ? concat$11([ifBreak$6(maybeTrailingComma), softline$5]) : "", ")"]), shouldGroupFirst ? concat$11(["(", group$10(printedExpanded[0], {
26300
26344
  shouldBreak: true
26301
- }), concat$11(printedExpanded.slice(1)), ")"]) : concat$11(["(", concat$11(printedArguments.slice(0, -1)), group$10(getLast$4(printedExpanded), {
26345
+ }), concat$11(printedExpanded.slice(1)), ")"]) : concat$11(["(", concat$11(printedArguments.slice(0, -1)), group$10(getLast$3(printedExpanded), {
26302
26346
  shouldBreak: true
26303
26347
  }), ")"]), allArgsBrokenOut()], {
26304
26348
  shouldBreak: shouldBreak
26305
26349
  })]);
26306
26350
  }
26307
26351
 
26308
- return group$10(concat$11(["(", indent$6(concat$11([softline$5, concat$11(printedArguments)])), ifBreak$6(shouldPrintComma$1(options, "all") ? "," : ""), softline$5, ")"]), {
26352
+ return group$10(concat$11(["(", indent$6(concat$11([softline$5, concat$11(printedArguments)])), ifBreak$6(maybeTrailingComma), softline$5, ")"]), {
26309
26353
  shouldBreak: printedArguments.some(willBreak$1) || anyArgEmptyLine
26310
26354
  });
26311
26355
  }
@@ -26344,12 +26388,37 @@ function printFunctionTypeParameters(path, options, print) {
26344
26388
 
26345
26389
  function printFunctionParams(path, print, options, expandArg, printTypeParams) {
26346
26390
  var fun = path.getValue();
26391
+ var parent = path.getParentNode();
26347
26392
  var paramsField = fun.parameters ? "parameters" : "params";
26393
+ var isParametersInTestCall = isTestCall(parent);
26394
+ var shouldHugParameters = shouldHugArguments(fun);
26395
+ var shouldExpandParameters = expandArg && !(fun[paramsField] && fun[paramsField].some(function (n) {
26396
+ return n.comments;
26397
+ }));
26348
26398
  var typeParams = printTypeParams ? printFunctionTypeParameters(path, options, print) : "";
26349
26399
  var printed = [];
26350
26400
 
26351
26401
  if (fun[paramsField]) {
26352
- printed = path.map(print, paramsField);
26402
+ var lastArgIndex = fun[paramsField].length - 1;
26403
+ printed = path.map(function (childPath, index) {
26404
+ var parts = [];
26405
+ var param = childPath.getValue();
26406
+ parts.push(print(childPath));
26407
+
26408
+ if (index === lastArgIndex) {
26409
+ if (fun.rest) {
26410
+ parts.push(",", line$8);
26411
+ }
26412
+ } else if (isParametersInTestCall || shouldHugParameters || shouldExpandParameters) {
26413
+ parts.push(", ");
26414
+ } else if (isNextLineEmpty$4(options.originalText, param, options)) {
26415
+ parts.push(",", hardline$8, hardline$8);
26416
+ } else {
26417
+ parts.push(",", line$8);
26418
+ }
26419
+
26420
+ return concat$11(parts);
26421
+ }, paramsField);
26353
26422
  }
26354
26423
 
26355
26424
  if (fun.rest) {
@@ -26364,7 +26433,7 @@ function printFunctionParams(path, print, options, expandArg, printTypeParams) {
26364
26433
  }), ")"]);
26365
26434
  }
26366
26435
 
26367
- var lastParam = getLast$4(fun[paramsField]); // If the parent is a call with the first/last argument expansion and this is the
26436
+ var lastParam = getLast$3(fun[paramsField]); // If the parent is a call with the first/last argument expansion and this is the
26368
26437
  // params of the first/last argument, we dont want the arguments to break and instead
26369
26438
  // want the whole expression to be on a new line.
26370
26439
  //
@@ -26375,10 +26444,8 @@ function printFunctionParams(path, print, options, expandArg, printTypeParams) {
26375
26444
  // }) ) => {
26376
26445
  // })
26377
26446
 
26378
- if (expandArg && !(fun[paramsField] && fun[paramsField].some(function (n) {
26379
- return n.comments;
26380
- }))) {
26381
- return group$10(concat$11([removeLines$2(typeParams), "(", join$7(", ", printed.map(removeLines$2)), ")"]));
26447
+ if (shouldExpandParameters) {
26448
+ return group$10(concat$11([removeLines$2(typeParams), "(", concat$11(printed.map(removeLines$2)), ")"]));
26382
26449
  } // Single object destructuring should hug
26383
26450
  //
26384
26451
  // function({
@@ -26388,14 +26455,13 @@ function printFunctionParams(path, print, options, expandArg, printTypeParams) {
26388
26455
  // }) {}
26389
26456
 
26390
26457
 
26391
- if (shouldHugArguments(fun)) {
26392
- return concat$11([typeParams, "(", join$7(", ", printed), ")"]);
26393
- }
26458
+ if (shouldHugParameters) {
26459
+ return concat$11([typeParams, "(", concat$11(printed), ")"]);
26460
+ } // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})`
26394
26461
 
26395
- var parent = path.getParentNode(); // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})`
26396
26462
 
26397
- if (isTestCall(parent)) {
26398
- return concat$11([typeParams, "(", join$7(", ", printed), ")"]);
26463
+ if (isParametersInTestCall) {
26464
+ return concat$11([typeParams, "(", concat$11(printed), ")"]);
26399
26465
  }
26400
26466
 
26401
26467
  var isFlowShorthandWithOneArg = (isObjectTypePropertyAFunction(parent, options) || isTypeAnnotationAFunction(parent, options) || parent.type === "TypeAlias" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || parent.type === "IntersectionTypeAnnotation" || parent.type === "FunctionTypeAnnotation" && parent.returnType === fun) && fun[paramsField].length === 1 && fun[paramsField][0].name === null && fun[paramsField][0].typeAnnotation && fun.typeParameters === null && isSimpleFlowType(fun[paramsField][0].typeAnnotation) && !fun.rest;
@@ -26409,7 +26475,7 @@ function printFunctionParams(path, print, options, expandArg, printTypeParams) {
26409
26475
  }
26410
26476
 
26411
26477
  var canHaveTrailingComma = !(lastParam && lastParam.type === "RestElement") && !fun.rest;
26412
- return concat$11([typeParams, "(", indent$6(concat$11([softline$5, join$7(concat$11([",", line$8]), printed)])), ifBreak$6(canHaveTrailingComma && shouldPrintComma$1(options, "all") ? "," : ""), softline$5, ")"]);
26478
+ return concat$11([typeParams, "(", indent$6(concat$11([softline$5, concat$11(printed)])), ifBreak$6(canHaveTrailingComma && shouldPrintComma$1(options, "all") ? "," : ""), softline$5, ")"]);
26413
26479
  }
26414
26480
 
26415
26481
  function shouldPrintParamsWithoutParens(path, options) {
@@ -26936,27 +27002,23 @@ function printMemberChain(path, options, print) {
26936
27002
  return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpression && isShort(firstNode.name) || hasComputed);
26937
27003
  }
26938
27004
 
26939
- var lastNode = getLast$4(groups[0]).node;
27005
+ var lastNode = getLast$3(groups[0]).node;
26940
27006
  return (lastNode.type === "MemberExpression" || lastNode.type === "OptionalMemberExpression") && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed);
26941
27007
  }
26942
27008
 
26943
27009
  var shouldMerge = groups.length >= 2 && !groups[1][0].node.comments && shouldNotWrap(groups);
26944
27010
 
26945
27011
  function printGroup(printedGroup) {
26946
- var result = [];
26947
-
26948
- for (var _i3 = 0; _i3 < printedGroup.length; _i3++) {
26949
- // Checks if the next node (i.e. the parent node) needs parens
26950
- // and print accordingly
26951
- if (printedGroup[_i3 + 1] && printedGroup[_i3 + 1].needsParens) {
26952
- result.push("(", printedGroup[_i3].printed, printedGroup[_i3 + 1].printed, ")");
26953
- _i3++;
26954
- } else {
26955
- result.push(printedGroup[_i3].printed);
26956
- }
27012
+ var printed = printedGroup.map(function (tuple) {
27013
+ return tuple.printed;
27014
+ }); // Checks if the last node (i.e. the parent node) needs parens and print
27015
+ // accordingly
27016
+
27017
+ if (printedGroup.length > 0 && printedGroup[printedGroup.length - 1].needsParens) {
27018
+ return concat$11(["("].concat(_toConsumableArray(printed), [")"]));
26957
27019
  }
26958
27020
 
26959
- return concat$11(result);
27021
+ return concat$11(printed);
26960
27022
  }
26961
27023
 
26962
27024
  function printIndentedGroup(groups) {
@@ -26986,7 +27048,7 @@ function printMemberChain(path, options, print) {
26986
27048
  // empty line after
26987
27049
 
26988
27050
 
26989
- var lastNodeBeforeIndent = getLast$4(shouldMerge ? groups.slice(1, 2)[0] : groups[0]).node;
27051
+ var lastNodeBeforeIndent = getLast$3(shouldMerge ? groups.slice(1, 2)[0] : groups[0]).node;
26990
27052
  var shouldHaveEmptyLineBeforeIndent = lastNodeBeforeIndent.type !== "CallExpression" && lastNodeBeforeIndent.type !== "OptionalCallExpression" && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
26991
27053
  var expanded = concat$11([printGroup(groups[0]), shouldMerge ? concat$11(groups.slice(1, 2).map(printGroup)) : "", shouldHaveEmptyLineBeforeIndent ? hardline$8 : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))]);
26992
27054
  var callExpressions = printedNodes.map(function (_ref) {
@@ -27006,7 +27068,7 @@ function printMemberChain(path, options, print) {
27006
27068
  */
27007
27069
  function (lastGroupDoc, lastGroupNode) {
27008
27070
  return isCallOrOptionalCallExpression(lastGroupNode) && willBreak$1(lastGroupDoc);
27009
- }(getLast$4(printedGroups), getLast$4(getLast$4(groups)).node) && callExpressions.slice(0, -1).some(function (n) {
27071
+ }(getLast$3(printedGroups), getLast$3(getLast$3(groups)).node) && callExpressions.slice(0, -1).some(function (n) {
27010
27072
  return n.arguments.some(isFunctionOrArrowExpression);
27011
27073
  })) {
27012
27074
  return group$10(expanded);
@@ -27217,7 +27279,7 @@ function printJSXChildren(path, options, print, jsxWhitespace, isFacebookTransla
27217
27279
 
27218
27280
  var endWhitespace; // Ends with whitespace
27219
27281
 
27220
- if (getLast$4(words) === "") {
27282
+ if (getLast$3(words) === "") {
27221
27283
  words.pop();
27222
27284
  endWhitespace = words.pop();
27223
27285
  } // This was whitespace only without a new line.
@@ -27238,13 +27300,13 @@ function printJSXChildren(path, options, print, jsxWhitespace, isFacebookTransla
27238
27300
  if (endWhitespace !== undefined) {
27239
27301
  if (/\n/.test(endWhitespace)) {
27240
27302
  var _next = n.children[i + 1];
27241
- children.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$4(children), child, _next));
27303
+ children.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$3(children), child, _next));
27242
27304
  } else {
27243
27305
  children.push(jsxWhitespace);
27244
27306
  }
27245
27307
  } else {
27246
27308
  var _next2 = n.children[i + 1];
27247
- children.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$4(children), child, _next2));
27309
+ children.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$3(children), child, _next2));
27248
27310
  }
27249
27311
  } else if (/\n/.test(text)) {
27250
27312
  // Keep (up to one) blank line between tags/expressions/text.
@@ -27353,7 +27415,7 @@ function printJSXElement(path, options, print) {
27353
27415
  } // Trim trailing lines (or empty strings)
27354
27416
 
27355
27417
 
27356
- while (children.length && (isLineNext$1(getLast$4(children)) || isEmpty$1(getLast$4(children)))) {
27418
+ while (children.length && (isLineNext$1(getLast$3(children)) || isEmpty$1(getLast$3(children)))) {
27357
27419
  children.pop();
27358
27420
  } // Trim leading lines (or empty strings)
27359
27421
 
@@ -27900,7 +27962,7 @@ function needsHardlineAfterDanglingComment(node) {
27900
27962
  return false;
27901
27963
  }
27902
27964
 
27903
- var lastDanglingComment = getLast$4(node.comments.filter(function (comment) {
27965
+ var lastDanglingComment = getLast$3(node.comments.filter(function (comment) {
27904
27966
  return !comment.leading && !comment.trailing;
27905
27967
  }));
27906
27968
  return lastDanglingComment && !comments$3.isBlockComment(lastDanglingComment);
@@ -27910,6 +27972,10 @@ function isLiteral(node) {
27910
27972
  return node.type === "BooleanLiteral" || node.type === "DirectiveLiteral" || node.type === "Literal" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "RegExpLiteral" || node.type === "StringLiteral" || node.type === "TemplateLiteral" || node.type === "TSTypeLiteral" || node.type === "JSXText";
27911
27973
  }
27912
27974
 
27975
+ function isStringPropSafeToCoerceToIdentifier(node, options) {
27976
+ return isStringLiteral(node.key) && isIdentifierName(node.key.value) && !node.computed && options.parser !== "json" && !(options.parser === "typescript" && node.type === "ClassProperty");
27977
+ }
27978
+
27913
27979
  function isNumericLiteral(node) {
27914
27980
  return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number";
27915
27981
  }
@@ -28000,7 +28066,7 @@ function willPrintOwnComments(path) {
28000
28066
  }
28001
28067
 
28002
28068
  function canAttachComment$1(node) {
28003
- return node.type && node.type !== "CommentBlock" && node.type !== "CommentLine" && node.type !== "Line" && node.type !== "Block" && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import" && !(node.callee && node.callee.type === "Import");
28069
+ return node.type && node.type !== "CommentBlock" && node.type !== "CommentLine" && node.type !== "Line" && node.type !== "Block" && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import";
28004
28070
  }
28005
28071
 
28006
28072
  function printComment$2(commentPath, options) {
@@ -28198,6 +28264,23 @@ var options$12 = {
28198
28264
  default: false,
28199
28265
  description: "Use single quotes in JSX."
28200
28266
  },
28267
+ quoteProps: {
28268
+ since: "1.17.0",
28269
+ category: CATEGORY_JAVASCRIPT,
28270
+ type: "choice",
28271
+ default: "as-needed",
28272
+ description: "Change when properties in objects are quoted.",
28273
+ choices: [{
28274
+ value: "as-needed",
28275
+ description: "Only add quotes around object properties where required."
28276
+ }, {
28277
+ value: "consistent",
28278
+ description: "If at least one property in an object requires quotes, quote all properties."
28279
+ }, {
28280
+ value: "preserve",
28281
+ description: "Respect the input use of quotes in object properties."
28282
+ }]
28283
+ },
28201
28284
  trailingComma: {
28202
28285
  since: "0.0.0",
28203
28286
  category: CATEGORY_JAVASCRIPT,
@@ -28549,7 +28632,7 @@ var json$9 = {"cjkPattern":"[\\u02ea-\\u02eb\\u1100-\\u11ff\\u2e80-\\u2e99\\u2e9
28549
28632
  var cjkPattern = json$9.cjkPattern;
28550
28633
  var kPattern = json$9.kPattern;
28551
28634
  var punctuationPattern$1 = json$9.punctuationPattern;
28552
- var getLast$5 = util.getLast;
28635
+ var getLast$4 = util.getLast;
28553
28636
  var INLINE_NODE_TYPES$1 = ["liquidNode", "inlineCode", "emphasis", "strong", "delete", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"];
28554
28637
  var INLINE_NODE_WRAPPER_TYPES$1 = INLINE_NODE_TYPES$1.concat(["tableCell", "paragraph", "heading"]);
28555
28638
  var kRegex = new RegExp(kPattern);
@@ -28594,7 +28677,7 @@ function splitText$1(text, options) {
28594
28677
  value: innerToken,
28595
28678
  kind: KIND_NON_CJK,
28596
28679
  hasLeadingPunctuation: punctuationRegex.test(innerToken[0]),
28597
- hasTrailingPunctuation: punctuationRegex.test(getLast$5(innerToken))
28680
+ hasTrailingPunctuation: punctuationRegex.test(getLast$4(innerToken))
28598
28681
  });
28599
28682
  }
28600
28683
 
@@ -28620,7 +28703,7 @@ function splitText$1(text, options) {
28620
28703
  return nodes;
28621
28704
 
28622
28705
  function appendNode(node) {
28623
- var lastNode = getLast$5(nodes);
28706
+ var lastNode = getLast$4(nodes);
28624
28707
 
28625
28708
  if (lastNode && lastNode.type === "word") {
28626
28709
  if (lastNode.kind === KIND_NON_CJK && node.kind === KIND_CJ_LETTER && !lastNode.hasTrailingPunctuation || lastNode.kind === KIND_CJ_LETTER && node.kind === KIND_NON_CJK && !node.hasLeadingPunctuation) {
@@ -29082,6 +29165,7 @@ function markAlignedList(ast, options) {
29082
29165
  var preprocess_1$4 = preprocess$4;
29083
29166
 
29084
29167
  var _require$$0$builders$8 = doc.builders;
29168
+ var breakParent$4 = _require$$0$builders$8.breakParent;
29085
29169
  var concat$15 = _require$$0$builders$8.concat;
29086
29170
  var join$11 = _require$$0$builders$8.join;
29087
29171
  var line$10 = _require$$0$builders$8.line;
@@ -29089,6 +29173,7 @@ var literalline$5 = _require$$0$builders$8.literalline;
29089
29173
  var markAsRoot$3 = _require$$0$builders$8.markAsRoot;
29090
29174
  var hardline$11 = _require$$0$builders$8.hardline;
29091
29175
  var softline$7 = _require$$0$builders$8.softline;
29176
+ var ifBreak$7 = _require$$0$builders$8.ifBreak;
29092
29177
  var fill$5 = _require$$0$builders$8.fill;
29093
29178
  var align$2 = _require$$0$builders$8.align;
29094
29179
  var indent$9 = _require$$0$builders$8.indent;
@@ -29441,6 +29526,7 @@ function printLine(path, value, options) {
29441
29526
  }
29442
29527
 
29443
29528
  function printTable(path, options, print) {
29529
+ var hardlineWithoutBreakParent = hardline$11.parts[0];
29444
29530
  var node = path.getValue();
29445
29531
  var contents = []; // { [rowIndex: number]: { [columnIndex: number]: string } }
29446
29532
 
@@ -29450,7 +29536,8 @@ function printTable(path, options, print) {
29450
29536
  rowContents.push(printDocToString$2(cellPath.call(print), options).formatted);
29451
29537
  }, "children");
29452
29538
  contents.push(rowContents);
29453
- }, "children");
29539
+ }, "children"); // Get the width of each column
29540
+
29454
29541
  var columnMaxWidths = contents.reduce(function (currentWidths, rowContents) {
29455
29542
  return currentWidths.map(function (width, columnIndex) {
29456
29543
  return Math.max(width, util.getStringWidth(rowContents[columnIndex]));
@@ -29459,28 +29546,48 @@ function printTable(path, options, print) {
29459
29546
  return 3;
29460
29547
  }) // minimum width = 3 (---, :--, :-:, --:)
29461
29548
  );
29462
- return join$11(hardline$11, [printRow(contents[0]), printSeparator(), join$11(hardline$11, contents.slice(1).map(printRow))]);
29463
-
29464
- function printSeparator() {
29549
+ var alignedTable = join$11(hardlineWithoutBreakParent, [printRow(contents[0]), printSeparator(), join$11(hardlineWithoutBreakParent, contents.slice(1).map(function (rowContents) {
29550
+ return printRow(rowContents);
29551
+ }))]);
29552
+
29553
+ if (options.proseWrap !== "never") {
29554
+ return concat$15([breakParent$4, alignedTable]);
29555
+ } // Only if the --prose-wrap never is set and it exceeds the print width.
29556
+
29557
+
29558
+ var compactTable = join$11(hardlineWithoutBreakParent, [printRow(contents[0],
29559
+ /* isCompact */
29560
+ true), printSeparator(
29561
+ /* isCompact */
29562
+ true), join$11(hardlineWithoutBreakParent, contents.slice(1).map(function (rowContents) {
29563
+ return printRow(rowContents,
29564
+ /* isCompact */
29565
+ true);
29566
+ }))]);
29567
+ return concat$15([breakParent$4, group$15(ifBreak$7(compactTable, alignedTable))]);
29568
+
29569
+ function printSeparator(isCompact) {
29465
29570
  return concat$15(["| ", join$11(" | ", columnMaxWidths.map(function (width, index) {
29571
+ var spaces = isCompact ? 3 : width;
29572
+
29466
29573
  switch (node.align[index]) {
29467
29574
  case "left":
29468
- return ":" + "-".repeat(width - 1);
29575
+ return ":" + "-".repeat(spaces - 1);
29469
29576
 
29470
29577
  case "right":
29471
- return "-".repeat(width - 1) + ":";
29578
+ return "-".repeat(spaces - 1) + ":";
29472
29579
 
29473
29580
  case "center":
29474
- return ":" + "-".repeat(width - 2) + ":";
29581
+ return ":" + "-".repeat(spaces - 2) + ":";
29475
29582
 
29476
29583
  default:
29477
- return "-".repeat(width);
29584
+ return "-".repeat(spaces);
29478
29585
  }
29479
29586
  })), " |"]);
29480
29587
  }
29481
29588
 
29482
- function printRow(rowContents) {
29483
- return concat$15(["| ", join$11(" | ", rowContents.map(function (rowContent, columnIndex) {
29589
+ function printRow(rowContents, isCompact) {
29590
+ return concat$15(["| ", join$11(" | ", isCompact ? rowContents : rowContents.map(function (rowContent, columnIndex) {
29484
29591
  switch (node.align[columnIndex]) {
29485
29592
  case "right":
29486
29593
  return alignRight(rowContent, columnMaxWidths[columnIndex]);
@@ -29495,11 +29602,13 @@ function printTable(path, options, print) {
29495
29602
  }
29496
29603
 
29497
29604
  function alignLeft(text, width) {
29498
- return concat$15([text, " ".repeat(width - util.getStringWidth(text))]);
29605
+ var spaces = width - util.getStringWidth(text);
29606
+ return concat$15([text, " ".repeat(spaces)]);
29499
29607
  }
29500
29608
 
29501
29609
  function alignRight(text, width) {
29502
- return concat$15([" ".repeat(width - util.getStringWidth(text)), text]);
29610
+ var spaces = width - util.getStringWidth(text);
29611
+ return concat$15([" ".repeat(spaces), text]);
29503
29612
  }
29504
29613
 
29505
29614
  function alignCenter(text, width) {
@@ -29884,7 +29993,7 @@ var pragma$11 = {
29884
29993
  insertPragma: insertPragma$9
29885
29994
  };
29886
29995
 
29887
- var getLast$7 = util.getLast;
29996
+ var getLast$6 = util.getLast;
29888
29997
 
29889
29998
  function getAncestorCount$1(path, filter) {
29890
29999
  var counter = 0;
@@ -29973,7 +30082,7 @@ function isLastDescendantNode$1(path) {
29973
30082
  }
29974
30083
 
29975
30084
  function getLastDescendantNode$2(node) {
29976
- return "children" in node && node.children.length !== 0 ? getLastDescendantNode$2(getLast$7(node.children)) : node;
30085
+ return "children" in node && node.children.length !== 0 ? getLastDescendantNode$2(getLast$6(node.children)) : node;
29977
30086
  }
29978
30087
 
29979
30088
  function isPrettierIgnore$2(comment) {
@@ -29985,10 +30094,10 @@ function hasPrettierIgnore$5(path) {
29985
30094
 
29986
30095
  if (node.type === "documentBody") {
29987
30096
  var document = path.getParentNode();
29988
- return hasEndComments$1(document.head) && isPrettierIgnore$2(getLast$7(document.head.endComments));
30097
+ return hasEndComments$1(document.head) && isPrettierIgnore$2(getLast$6(document.head.endComments));
29989
30098
  }
29990
30099
 
29991
- return hasLeadingComments$1(node) && isPrettierIgnore$2(getLast$7(node.leadingComments));
30100
+ return hasLeadingComments$1(node) && isPrettierIgnore$2(getLast$6(node.leadingComments));
29992
30101
  }
29993
30102
 
29994
30103
  function isEmptyNode$1(node) {
@@ -30088,7 +30197,7 @@ function getFlowScalarLineContents$1(nodeType, content, options) {
30088
30197
  return lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent);
30089
30198
  }).reduce(function (reduced, lineContentWords, index) {
30090
30199
  return index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !( // trailing backslash in quoteDouble should be preserved
30091
- nodeType === "quoteDouble" && getLast$7(getLast$7(reduced)).endsWith("\\")) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
30200
+ nodeType === "quoteDouble" && getLast$6(getLast$6(reduced)).endsWith("\\")) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
30092
30201
  }, []).map(function (lineContentWords) {
30093
30202
  return options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords;
30094
30203
  });
@@ -30116,11 +30225,11 @@ function getBlockValueLineContents$1(node, _ref) {
30116
30225
  return removeUnnecessaryTrailingNewlines(rawLineContents.map(function (lineContent) {
30117
30226
  return lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent);
30118
30227
  }).reduce(function (reduced, lineContentWords, index) {
30119
- return index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !/^\s/.test(lineContentWords[0]) && !/^\s|\s$/.test(getLast$7(reduced)) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
30228
+ return index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !/^\s/.test(lineContentWords[0]) && !/^\s|\s$/.test(getLast$6(reduced)) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
30120
30229
  }, []).map(function (lineContentWords) {
30121
30230
  return lineContentWords.reduce(function (reduced, word) {
30122
30231
  return (// disallow trailing spaces
30123
- reduced.length !== 0 && /\s$/.test(getLast$7(reduced)) ? reduced.concat(reduced.pop() + " " + word) : reduced.concat(word)
30232
+ reduced.length !== 0 && /\s$/.test(getLast$6(reduced)) ? reduced.concat(reduced.pop() + " " + word) : reduced.concat(word)
30124
30233
  );
30125
30234
  }, []);
30126
30235
  }).map(function (lineContentWords) {
@@ -30129,7 +30238,7 @@ function getBlockValueLineContents$1(node, _ref) {
30129
30238
 
30130
30239
  function removeUnnecessaryTrailingNewlines(lineContents) {
30131
30240
  if (node.chomping === "keep") {
30132
- return getLast$7(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
30241
+ return getLast$6(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
30133
30242
  }
30134
30243
 
30135
30244
  var trailingNewlineCount = 0;
@@ -30148,7 +30257,7 @@ function getBlockValueLineContents$1(node, _ref) {
30148
30257
  }
30149
30258
 
30150
30259
  var utils$12 = {
30151
- getLast: getLast$7,
30260
+ getLast: getLast$6,
30152
30261
  getAncestorCount: getAncestorCount$1,
30153
30262
  isNode: isNode$1,
30154
30263
  isEmptyNode: isEmptyNode$1,
@@ -30172,7 +30281,7 @@ var isPragma = pragma$11.isPragma;
30172
30281
  var getAncestorCount = utils$12.getAncestorCount;
30173
30282
  var getBlockValueLineContents = utils$12.getBlockValueLineContents;
30174
30283
  var getFlowScalarLineContents = utils$12.getFlowScalarLineContents;
30175
- var getLast$6 = utils$12.getLast;
30284
+ var getLast$5 = utils$12.getLast;
30176
30285
  var getLastDescendantNode$1 = utils$12.getLastDescendantNode;
30177
30286
  var hasLeadingComments = utils$12.hasLeadingComments;
30178
30287
  var hasMiddleComments = utils$12.hasMiddleComments;
@@ -30188,14 +30297,14 @@ var defineShortcut = utils$12.defineShortcut;
30188
30297
  var mapNode = utils$12.mapNode;
30189
30298
  var docBuilders$3 = doc.builders;
30190
30299
  var conditionalGroup$2 = docBuilders$3.conditionalGroup;
30191
- var breakParent$4 = docBuilders$3.breakParent;
30300
+ var breakParent$5 = docBuilders$3.breakParent;
30192
30301
  var concat$17 = docBuilders$3.concat;
30193
30302
  var dedent$4 = docBuilders$3.dedent;
30194
30303
  var dedentToRoot$3 = docBuilders$3.dedentToRoot;
30195
30304
  var fill$6 = docBuilders$3.fill;
30196
30305
  var group$16 = docBuilders$3.group;
30197
30306
  var hardline$13 = docBuilders$3.hardline;
30198
- var ifBreak$7 = docBuilders$3.ifBreak;
30307
+ var ifBreak$8 = docBuilders$3.ifBreak;
30199
30308
  var join$12 = docBuilders$3.join;
30200
30309
  var line$11 = docBuilders$3.line;
30201
30310
  var lineSuffix$2 = docBuilders$3.lineSuffix;
@@ -30249,7 +30358,7 @@ function genericPrint$6(path, options, print) {
30249
30358
  var tag = !node.tag ? "" : path.call(print, "tag");
30250
30359
  var anchor = !node.anchor ? "" : path.call(print, "anchor");
30251
30360
  var nextEmptyLine = isNode(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode(path) ? printNextEmptyLine(path, options.originalText) : "";
30252
- return concat$17([node.type !== "mappingValue" && hasLeadingComments(node) ? concat$17([join$12(hardline$13, path.map(print, "leadingComments")), hardline$13]) : "", tag, tag && anchor ? " " : "", anchor, tag || anchor ? isNode(node, ["sequence", "mapping"]) && !hasMiddleComments(node) ? hardline$13 : " " : "", hasMiddleComments(node) ? concat$17([node.middleComments.length === 1 ? "" : hardline$13, join$12(hardline$13, path.map(print, "middleComments")), hardline$13]) : "", hasPrettierIgnore$4(path) ? concat$17(replaceEndOfLineWith$3(options.originalText.slice(node.position.start.offset, node.position.end.offset), literalline$7)) : group$16(_print(node, parentNode, path, options, print)), hasTrailingComment$1(node) && !isNode(node, ["document", "documentHead"]) ? lineSuffix$2(concat$17([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent$4, path.call(print, "trailingComment")])) : "", nextEmptyLine, hasEndComments(node) && !isNode(node, ["documentHead", "documentBody"]) ? align$3(node.type === "sequenceItem" ? 2 : 0, concat$17([hardline$13, join$12(hardline$13, path.map(print, "endComments"))])) : ""]);
30361
+ return concat$17([node.type !== "mappingValue" && hasLeadingComments(node) ? concat$17([join$12(hardline$13, path.map(print, "leadingComments")), hardline$13]) : "", tag, tag && anchor ? " " : "", anchor, tag || anchor ? isNode(node, ["sequence", "mapping"]) && !hasMiddleComments(node) ? hardline$13 : " " : "", hasMiddleComments(node) ? concat$17([node.middleComments.length === 1 ? "" : hardline$13, join$12(hardline$13, path.map(print, "middleComments")), hardline$13]) : "", hasPrettierIgnore$4(path) ? concat$17(replaceEndOfLineWith$3(options.originalText.slice(node.position.start.offset, node.position.end.offset), literalline$7)) : group$16(_print(node, parentNode, path, options, print)), hasTrailingComment$1(node) && !isNode(node, ["document", "documentHead"]) ? lineSuffix$2(concat$17([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent$5, path.call(print, "trailingComment")])) : "", nextEmptyLine, hasEndComments(node) && !isNode(node, ["documentHead", "documentBody"]) ? align$3(node.type === "sequenceItem" ? 2 : 0, concat$17([hardline$13, join$12(hardline$13, path.map(print, "endComments"))])) : ""]);
30253
30362
  }
30254
30363
 
30255
30364
  function _print(node, parentNode, path, options, print) {
@@ -30385,9 +30494,9 @@ function _print(node, parentNode, path, options, print) {
30385
30494
  return forceExplicitKey ? concat$17(["? ", align$3(2, key), hardline$13, join$12("", path.map(print, "value", "leadingComments").map(function (comment) {
30386
30495
  return concat$17([comment, hardline$13]);
30387
30496
  })), ": ", align$3(2, value)]) : // force singleline
30388
- isSingleLineNode(node.key.content) && !hasLeadingComments(node.key.content) && !hasMiddleComments(node.key.content) && !hasTrailingComment$1(node.key.content) && !hasEndComments(node.key) && !hasLeadingComments(node.value.content) && !hasMiddleComments(node.value.content) && !hasEndComments(node.value) && isAbsolutelyPrintedAsSingleLineNode(node.value.content, options) ? concat$17([key, needsSpaceInFrontOfMappingValue(node) ? " " : "", ": ", value]) : conditionalGroup$2([concat$17([group$16(concat$17([ifBreak$7("? "), group$16(align$3(2, key), {
30497
+ isSingleLineNode(node.key.content) && !hasLeadingComments(node.key.content) && !hasMiddleComments(node.key.content) && !hasTrailingComment$1(node.key.content) && !hasEndComments(node.key) && !hasLeadingComments(node.value.content) && !hasMiddleComments(node.value.content) && !hasEndComments(node.value) && isAbsolutelyPrintedAsSingleLineNode(node.value.content, options) ? concat$17([key, needsSpaceInFrontOfMappingValue(node) ? " " : "", ": ", value]) : conditionalGroup$2([concat$17([group$16(concat$17([ifBreak$8("? "), group$16(align$3(2, key), {
30389
30498
  id: groupId
30390
- })])), ifBreak$7(concat$17([hardline$13, ": ", align$3(2, value)]), indent(concat$17([needsSpaceInFrontOfMappingValue(node) ? " " : "", ":", hasLeadingComments(node.value.content) || hasEndComments(node.value) && node.value.content && !isNode(node.value.content, ["mapping", "sequence"]) || parentNode.type === "mapping" && hasTrailingComment$1(node.key.content) && isInlineNode(node.value.content) || isNode(node.value.content, ["mapping", "sequence"]) && node.value.content.tag === null && node.value.content.anchor === null ? hardline$13 : !node.value.content ? "" : line$11, value])), {
30499
+ })])), ifBreak$8(concat$17([hardline$13, ": ", align$3(2, value)]), indent(concat$17([needsSpaceInFrontOfMappingValue(node) ? " " : "", ":", hasLeadingComments(node.value.content) || hasEndComments(node.value) && node.value.content && !isNode(node.value.content, ["mapping", "sequence"]) || parentNode.type === "mapping" && hasTrailingComment$1(node.key.content) && isInlineNode(node.value.content) || isNode(node.value.content, ["mapping", "sequence"]) && node.value.content.tag === null && node.value.content.anchor === null ? hardline$13 : !node.value.content ? "" : line$11, value])), {
30391
30500
  groupId: groupId
30392
30501
  })])]);
30393
30502
  }
@@ -30401,11 +30510,11 @@ function _print(node, parentNode, path, options, print) {
30401
30510
 
30402
30511
  var isLastItemEmptyMappingItem = node.children.length !== 0 && function (lastItem) {
30403
30512
  return lastItem.type === "flowMappingItem" && isEmptyNode(lastItem.key) && isEmptyNode(lastItem.value);
30404
- }(getLast$6(node.children));
30513
+ }(getLast$5(node.children));
30405
30514
 
30406
30515
  return concat$17([openMarker, indent(concat$17([bracketSpacing, concat$17(path.map(function (childPath, index) {
30407
30516
  return concat$17([print(childPath), index === node.children.length - 1 ? "" : concat$17([",", line$11, node.children[index].position.start.line !== node.children[index + 1].position.start.line ? printNextEmptyLine(childPath, options.originalText) : ""])]);
30408
- }, "children")), ifBreak$7(",", "")])), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker]);
30517
+ }, "children")), ifBreak$8(",", "")])), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker]);
30409
30518
  }
30410
30519
 
30411
30520
  case "flowSequenceItem":