nx 格式:检查elsehtml 文件中后面不应有冒号:
<div *ngIf="isValid; else errors">
Run Code Online (Sandbox Code Playgroud)
但是当我在同一个项目中运行 prettier 时,它需要一个冒号else
<div *ngIf="isValid; else: errors">
Run Code Online (Sandbox Code Playgroud)
nx format:check只是在我的根目录中执行更漂亮?更多信息:
在包含角度模板的子目录中,我可以验证该问题:
$ nx format:check --files login.component.html
$ prettier -c login.component.html
Checking formatting...
login.component.html
Code style issues found in the above file(s). Forgot to run Prettier?
Run Code Online (Sandbox Code Playgroud)
请注意,nx 不会报告问题,但 prettier 会报告问题:以下是版本:
$ nx --version
8.5.0
$ prettier --version
1.18.2
Run Code Online (Sandbox Code Playgroud)
Rus*_*tel 12
是的,没错,nx format:check在引擎盖下使用更漂亮。但是,您在此处看到的不一致可能是由于两个不同的 Prettier 版本造成的。
就我而言,我使用的是prettier-vscode 插件,该插件使用 prettier 版本 1.8,它与 nx lib 中使用的 prettier 版本不同。
nx 有一个相关问题:功能请求:使用已安装的 prettier 版本nx 的 prettier 版本可以在其package.json
中找到
| 归档时间: |
|
| 查看次数: |
18080 次 |
| 最近记录: |