build: add Prettier support and configurations #8220
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Opening this new one since #7757 was too much.
Why
This makes contributing harder than it should be. It's either contributors having to format their code without automated formatters, or having PRs full of irrelevant style changes with the actual feature or fix hidden somewhere.
But don't take my word for it: https://prettier.io/docs/en/why-prettier.html
What
Disclaimer
This is the minimum viable contribution to get things going in the right direction and over time get to a point where all the code is formatted the same way and code formatting is automated.
Its biggest con is that after you merge this, for months, every single PR of code written with VSCode or another IDE with active Prettier support will be full of irrelevant - but much needed for the reasons stated above - code formatting changes.
Formatting all at once (again, this is not linting, it doesn't change how the code works and it's supposed to be safe), instead, gives you a solid starting point and doesn't impact future PRs.
Related Issue(s)
Fixes #
How to test
Edit a TS (for example) file in VSCode and save it. You should see the formatting change, unless your own user settings specifically turn off format on save and Prettier support.
Release Notes