schuchard/prettier-schematic

Add CLI builder

abraham opened this issue · 2 comments

Is your feature request related to a problem? Please describe.

Run prettier check automatically during ng lint

Describe the solution you'd like

I think that a CLI builder can be setup to run prettier check on ng lint

https://angular.io/guide/cli-builder

angularfire does something similar with ng deploy

https://github.com/angular/angularfire

Describe alternatives you've considered

An alternative would be to modify package.json so that lint is ng lint && npm run prettier.

Hi @abraham, thanks for the request. I looked at the angularfire builder source and I can't find anything related to an ng lint hook in their builder. Nor am I aware of that functionality. "A builder listening for another builder to run", if I understand the request correctly.

With my understanding of builders, if I wanted to accomplish that I would have to write a builder to replace the default ng lint that would call prettier followed by ng lint. If I've missed something though please let me know. I'm open to hearing other solutions and use cases.

Out of curiosity, what would be the main benefit of running ng lint (assuming it would run prettier) vs executing that workflow from a package.json script?

I thought about writing a builder for this schematic when builders were announced but I've struggled with the benefits it would provide vs the time it would take to build one.

Thanks.

Happy to continue discussing, but closing this for now.