← 返回命令列表

Linux command

ng-lint 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Lint project

ng lint

Lint specific project

ng lint [project-name]

Fix lint issues automatically

ng lint --fix

Output in specific format

ng lint --format json

说明

ng lint runs the configured linter on the Angular workspace. Since Angular 12, the default linter is ESLint (via the @angular-eslint plugin); earlier versions used TSLint, which is deprecated. The command honours the lint target defined in angular.json, so per-project overrides (custom rule sets, tsconfig variants, file globs) are picked up automatically. Running without a project name lints every project that has a lint target.

参数

--fix
Auto-fix lint issues.
--format _format_
Output format (stylish, json, etc.).
--force
Succeed even with lint errors.
--silent
Suppress output.
--cache
Reuse the lint cache to skip files unchanged since the last run.
--max-warnings _N_
Fail (exit code 1) if more than _N_ warnings are reported.

FAQ

What is the ng-lint command used for?

ng lint runs the configured linter on the Angular workspace. Since Angular 12, the default linter is ESLint (via the @angular-eslint plugin); earlier versions used TSLint, which is deprecated. The command honours the lint target defined in angular.json, so per-project overrides (custom rule sets, tsconfig variants, file globs) are picked up automatically. Running without a project name lints every project that has a lint target.

How do I run a basic ng-lint example?

Run `ng lint` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --fix do in ng-lint?

Auto-fix lint issues.