[TIL] VSCode: configure auto format on save

TIL about VSCode project configurations to enable auto format on save.

This can be specially helpful in team projects configured with eslint and prettier, where you're interested in enforcing code conventions and standards.

From the project root, create a .vscode/settings.json file with the following:

  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  "editor.defaultFormatter": "esbenp.prettier-vscode"

When a project contributor checks out the project and is using VSCode (with eslint and prettier plugins installed) auto format on save will be enabled, based on the eslint and prettier rules configured.