简体   繁体   English

ng lint 如何使用 eslint CLI 标志,例如 --max-warnings=0

[英]ng lint how to use eslint CLI flags such as --max-warnings=0

I've got an Angular 10 project that uses eslint.我有一个使用 eslint 的 Angular 10 项目。

I run my linting with:我运行我的 linting:

ng lint

There are no errors but some warnings.没有错误,但有一些警告。 I want ng lint to fail with a non zero exit code when there are only warnings.当只有警告时,我希望ng lint以非零退出代码失败。 I've tried using the eslint flag --max-warnings=0 as follows:我尝试使用 eslint 标志 --max-warnings=0 如下:

ng lint --max-warnings=0

but it says:但它说:

unknown option '--max-warnings'未知选项'--max-warnings'

This SO post suggests --max-warnings is an eslint CLI option only and cannot be configured via an.eslintrc file这个 SO post建议 --max-warnings 只是一个 eslint CLI 选项,不能通过 an.eslintrc 文件配置

How can I force linting to fail when there are only warnings when running ng lint ?当运行ng lint时只有警告时,如何强制 linting 失败? Many thanks非常感谢

--max-warnings 0 try this. --max-warnings 0试试这个。 The = is not required. =不是必需的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 不确定如何在角度项目中使用 ng lint - Not sure how to use ng lint in angular project 在Angular中用多个项目迁移TSLint到ESLint,ng lint命令挂起 - Migrate TSLint to ESLint in Angular with multiple projects, ng lint command hangs 无法在我的angular-cli项目上运行ng lint - Can't run ng lint on my angular-cli project 在干净的 Angular 项目中运行“ng lint”时,eslint 会为另一个文件夹中完全不同的项目提供错误 - When running "ng lint" in a clean Angular project eslint gives errors for a completely different project in another folder 如何在 angular 项目中调试 ng lint broken - How to debug ng lint broken in angular project 如何将@ Gbuomprisco / ng2-tag-input与angular-cli一起使用? - How to use @Gbuomprisco/ng2-tag-input with angular-cli? 您的全局 Angular CLI 版本高于您的本地版本。 要禁用此警告,请使用“ng config -g cli.warnings.versionMismatch false” - Your global Angular CLI version is greater than your local version. To disable this warning use "ng config -g cli.warnings.versionMismatch false" 如何在 Angular 2 CLI 中使用“ng build --prod”和“ng serve --prod”,得到 404 错误 - How to use “ng build --prod” and “ng serve --prod” with Angular 2 CLI, getting 404 errors 如何使用angular CLI排除lint目录下的所有文件? - How to exclude all files under a directory in lint using angular CLI? PhpStorm WebStorm angular-cli项目; 如何关闭皮棉 - PhpStorm WebStorm angular-cli project; how to turn off lint
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM