angulartypescripttslint

Having trouble running ng lint on a directory


I'm attempting to use the linter that comes with Angular 8, but I've neglected TSLint errors for a while. I'm hoping to slowly clean up the errors, and I'm searching for a way to run the linter on entire directories, some of which may have multiple subdirectories.

I've looked at the Angular documentation for ng lint, but I'm not finding anything helpful (or I may be overlooking something). What I thought I was looking for was the --files flag, but I must be doing something wrong, because when I run ng lint --files, I can only get it to work with a single file, and not an entire directory.

For example, using ng lint --files src/app/+register/registration.component.ts works perfectly.

Does anybody have any thoughts on this? I'd love some help.

Thanks in advance!


Solution

  • You can use a glob, or wildcard, to get the functionality you need. Example below.

    ng lint --files=src/app/folder/**/*.ts