【发布时间】:2019-06-11 14:01:39
【问题描述】:
如何在 VSCode 中配置 TSLint 以不重新格式化我的代码?我不想完全禁用 TSLint 我只想停止它所做的一件事。 我想在 html 标记中保留前导缩进。
<ng-template [ngIf]="($eventsCount | async) > 0">
<a href=""
*ngIf="!($isClosing | async)"
class="btn--danger"
confirm="Are you sure?"
(confirmed)="onCloseAll()">
Close All
</a>
</ng-template>
当我保存上述代码时,TSLint(在 VSCode 中)将其重新格式化为:
<ng-template [ngIf]="($eventsCount | async) > 0">
<a href="" *ngIf="!($isClosing | async)" class="btn--danger" confirm="Are you sure?" (confirmed)="onCloseAll()">
Close All
</a>
</ng-template>
我需要在 TSLint 中更改什么规则以阻止它删除我的角度组件 html 中的前导空格?
TSLint 版本:5.9.1
谢谢
【问题讨论】:
-
TSLint 仅适用于 TypeScript,而不适用于 HTML。 VSCode 使用基于 js-beautify 的格式化程序用于 HTML code.visualstudio.com/docs/languages/html#_formatting
标签: html visual-studio-code tslint linter