prettier 2.8.4 → 2.8.6

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/index.js CHANGED
@@ -18317,8 +18317,12 @@ var require_editorconfig_to_prettier = __commonJS2({
18317
18317
  } else if (editorConfig.tab_width !== void 0) {
18318
18318
  result.tabWidth = editorConfig.tab_width;
18319
18319
  }
18320
- if (editorConfig.max_line_length && editorConfig.max_line_length !== "off") {
18321
- result.printWidth = editorConfig.max_line_length;
18320
+ if (editorConfig.max_line_length) {
18321
+ if (editorConfig.max_line_length === "off") {
18322
+ result.printWidth = Number.POSITIVE_INFINITY;
18323
+ } else {
18324
+ result.printWidth = editorConfig.max_line_length;
18325
+ }
18322
18326
  }
18323
18327
  if (editorConfig.quote_type === "single") {
18324
18328
  result.singleQuote = true;
@@ -24044,6 +24048,9 @@ var require_needs_parens = __commonJS2({
24044
24048
  }
24045
24049
  case "Decorator": {
24046
24050
  if (name === "expression") {
24051
+ if (isMemberExpression(node) && node.computed) {
24052
+ return true;
24053
+ }
24047
24054
  let hasCallExpression = false;
24048
24055
  let hasMemberExpression = false;
24049
24056
  let current = node;
@@ -24269,6 +24276,8 @@ var require_needs_parens = __commonJS2({
24269
24276
  return parent.type === "TSArrayType" || parent.type === "TSOptionalType" || parent.type === "TSRestType" || name === "objectType" && parent.type === "TSIndexedAccessType" || parent.type === "TSTypeOperator" || parent.type === "TSTypeAnnotation" && path.getParentNode(1).type.startsWith("TSJSDoc");
24270
24277
  case "TSTypeQuery":
24271
24278
  return name === "objectType" && parent.type === "TSIndexedAccessType" || name === "elementType" && parent.type === "TSArrayType";
24279
+ case "TypeofTypeAnnotation":
24280
+ return name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType") || name === "elementType" && parent.type === "ArrayTypeAnnotation";
24272
24281
  case "ArrayTypeAnnotation":
24273
24282
  return parent.type === "NullableTypeAnnotation";
24274
24283
  case "IntersectionTypeAnnotation":
@@ -24282,8 +24291,6 @@ var require_needs_parens = __commonJS2({
24282
24291
  }
24283
24292
  case "OptionalIndexedAccessType":
24284
24293
  return name === "objectType" && parent.type === "IndexedAccessType";
24285
- case "TypeofTypeAnnotation":
24286
- return name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
24287
24294
  case "StringLiteral":
24288
24295
  case "NumericLiteral":
24289
24296
  case "Literal":
@@ -27172,7 +27179,7 @@ var require_type_parameters = __commonJS2({
27172
27179
  }
27173
27180
  function printTypeParameter(path, options, print) {
27174
27181
  const node = path.getValue();
27175
- const parts = [];
27182
+ const parts = [node.type === "TSTypeParameter" && node.const ? "const " : ""];
27176
27183
  const parent = path.getParentNode();
27177
27184
  if (parent.type === "TSMappedType") {
27178
27185
  if (parent.readonly) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "description": "Prettier is an opinionated code formatter",
5
5
  "bin": "./bin-prettier.js",
6
6
  "repository": "prettier/prettier",