In my Angular project, when I create new components, the files aren’t automatically formatted. I have to manually save each file to apply formatting. Is there a way to configure this so that the files are automatically formatted upon creation?
Question posted in Visual Studio Code
View the official documentation.
View the official documentation.
3
Answers
There is an open feature request in the Angular CLI for this exact issue. However it’s not implemented yet, so for now you need to apply the format manually.
If you create your files using the CLI. Then you can make use of Prettier CLI. For example you could set it up that it would always run after creating your file.
Not seeing the utility of generating files and never modifying them, but if it’s an issue for you, "just" make Prettier run automatically on all added/modified files using a git hook.