我正在努力为 Angular HTML 组件配置 Prettier 格式。我尝试了不同的配置覆盖,但我无法得到我想要的。
默认情况下,在 VS Code + Prettier 上,以下标记:
<ng-container *ngIf="emailRef.hasError('email')">A valid email address must be used</ng-container>
被格式化为(因为行长):
<ng-container *ngIf="emailRef.hasError('email')"
  >A valid email address must be used</ng-container
>
我一点都不喜欢。我不希望 Prettier 像那样拆分标签。我宁愿:
<ng-container *ngIf="emailRef.hasError('email')">
  A valid email address must be used
</ng-container>
有谁知道如何覆盖其默认行为?当使用多个属性时,我可以使用默认格式,例如:
<input
  id="email"
  name="email"
  type="email"
  email
  required
  [(ngModel)]="email"
  #emailRef="ngModel"
/>