ng lint command - How can I execute it on only one typescript file?

隐身守侯 提交于 2020-01-29 06:36:04

问题


I am using "ng lint" command from the latest 'angular cli'.

Is it possible to run this command on only one typescript file instead of running on all the typescript files in the entire project ?

Thanks Adam


回答1:


An easy workaround: ng lint | grep nameofyourfile?




回答2:


I know I am late to the party but someone else could benefit from this. We face the same issue and to solve this I have created a package

https://www.npmjs.com/package/ng-lintone-cli

It is fairly simple package - you just need to pass command
lintone file name <file-name>

and it will display lint error associated to that file




回答3:


As of Angular CLI version 8, you can lint a single file with

ng lint --files src/app/app.component.ts



来源:https://stackoverflow.com/questions/45991332/ng-lint-command-how-can-i-execute-it-on-only-one-typescript-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!