@typespec/prettier-plugin-typespec 0.44.0-dev.1 → 0.44.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.
package/dist/index.js CHANGED
@@ -1043,12 +1043,6 @@ const diagnostics = {
1043
1043
  topLevel: "Imports must be top-level and come prior to namespaces or other declarations.",
1044
1044
  },
1045
1045
  },
1046
- "default-optional": {
1047
- severity: "error",
1048
- messages: {
1049
- default: "Cannot use default with non optional properties",
1050
- },
1051
- },
1052
1046
  "token-expected": {
1053
1047
  severity: "error",
1054
1048
  messages: {
@@ -1606,6 +1600,14 @@ const diagnostics = {
1606
1600
  duplicate: paramMessage `Discriminator value "${"discriminator"}" is already used in another variant.`,
1607
1601
  },
1608
1602
  },
1603
+ "invalid-encode": {
1604
+ severity: "error",
1605
+ messages: {
1606
+ default: "Invalid encoding",
1607
+ wrongType: paramMessage `Encoding '${"encoding"}' cannot be used on type ${"type"}. Expected a ${"expected"}.`,
1608
+ wrongEncodingType: paramMessage `Encoding '${"encoding"}' cannot be used on type ${"type"}. Expected a ${"expected"}.`,
1609
+ },
1610
+ },
1609
1611
  /**
1610
1612
  * Service
1611
1613
  */
@@ -3229,7 +3231,7 @@ function printComment(commentPath, options) {
3229
3231
  case SyntaxKind.BlockComment:
3230
3232
  return printBlockComment(commentPath, options);
3231
3233
  case SyntaxKind.LineComment:
3232
- return `${options.originalText.slice(comment.pos, comment.end).trimRight()}`;
3234
+ return `${options.originalText.slice(comment.pos, comment.end).trimEnd()}`;
3233
3235
  default:
3234
3236
  throw new Error(`Not a comment: ${JSON.stringify(comment)}`);
3235
3237
  }
@@ -4620,9 +4622,6 @@ function createParser(code, options = {}) {
4620
4622
  parseExpected(Token.Colon);
4621
4623
  const value = parseExpression();
4622
4624
  const hasDefault = parseOptional(Token.Equals);
4623
- if (hasDefault && !optional) {
4624
- error({ code: "default-optional" });
4625
- }
4626
4625
  const defaultValue = hasDefault ? parseExpression() : undefined;
4627
4626
  return {
4628
4627
  kind: SyntaxKind.ModelProperty,
@@ -5664,9 +5663,6 @@ function createParser(code, options = {}) {
5664
5663
  parseExpected(Token.Colon);
5665
5664
  const value = parseProjectionExpression();
5666
5665
  const hasDefault = parseOptional(Token.Equals);
5667
- if (hasDefault && !optional) {
5668
- error({ code: "default-optional" });
5669
- }
5670
5666
  const defaultValue = hasDefault ? parseProjectionExpression() : undefined;
5671
5667
  return {
5672
5668
  kind: SyntaxKind.ProjectionModelProperty,