Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lint-staged in Angular monorepo

I'm trying to set up lint-staged with my Angular monorepo workspace, however I can't make it work. When ng lint --files is executed with changed file it errors that *file* is not part of a TypeScript project. If I run ng lint <project> --files it works. Can Angular lint all projects using files from lint-staged?

I need to run linting of only changed parts, but I don't see how I can achieve this.

I've no default project in angular.json, however ng lint appears to start from the first project and if it doesn't find the file it errors.

like image 303
Sergey Avatar asked Mar 08 '26 06:03

Sergey


1 Answers

There are some command line arguments problem with ng lint. You need to use this shim: https://www.npmjs.com/package/ng-lint-staged

like image 135
Miroslav Jasso Avatar answered Mar 09 '26 20:03

Miroslav Jasso



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!