ng lint <project> [options]
ng l <project> [options]
| 参数和语法 | 描述 |
| <project> | 要 lint 的项目名称。 |
| 选项和语法 | 描述 |
| --configuration=configuration |
要使用的 linting 配置。
别名:-c
|
| --exclude | 要从 linting 中排除的文件。 |
| --files | 要包含在 linting 中的文件。 |
| --fix=true|false | 修复 linting 错误(可能会覆盖 linted 文件)。
默认值:false
|
| --force=true|false |
即使有 linting 错误也会成功。
默认值:false
|
| --format=format |
输出格式(prose、json、stylish、verbose、pmd、msbuild、checkstyle、vso、fileslist)。
默认:prose
|
| --help=true|false|json|JSON |
在控制台中显示此命令的帮助消息。
默认值:false
|
| --silent=true|false |
显示输出文本。
默认值:false
|
| --tsConfig=tsConfig | TypeScript 配置文件的名称。 |
| --tslintConfig=tslintConfig | TSLint 配置文件的名称。 |
| --typeCheck=true|false |
控制 linting 的类型检查。
默认值:false
|
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-goals',
templateUrl: './goals.component.html',
styleUrls: ['./goals.component.css']
})
export class GoalsComponent implements OnInit {
title = 'Goal Component'
constructor() { }
ngOnInit(): void {
}
}
<p>{{title}}</p>
\>Node\>Lidihuo> ng lint Linting "Lidihuo"... ERROR: D:/Node/Lidihuo/src/app/goals/goals.component.ts:9:27-Missing semicolon ERROR: D:/Node/Lidihuo/src/app/goals/goals.component.ts:13:2-file should end with a newline Lint errors found in the listed files.
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-goals',
templateUrl: './goals.component.html',
styleUrls: ['./goals.component.css']
})
export class GoalsComponent implements OnInit {
title = 'Goal Component';
constructor() { }
ngOnInit(): void {
}
}
\>Node\>Lidihuo> ng lint
Linting "Lidihuo"...
All files pass linting.