简体   繁体   中英

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

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

An easy workaround: ng lint | grep nameofyourfile ng lint | grep nameofyourfile ?

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

从Angular CLI版本8开始,您可以使用

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

对于 10 多个版本的 angular cli 使用--lint-file-patterns

ng lint --lint-file-patterns src/app/app.component.ts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM