Skip to content

Commit

Permalink
Add code formatting guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
hurairahmateen committed May 21, 2024
1 parent 9d43b8a commit 4f7ecc9
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions docs/manual/98_contributing/05_source/60_codeFormatting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Code Formatter

Check warning on line 1 in docs/manual/98_contributing/05_source/60_codeFormatting.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Headings] 'Code Formatter' should use sentence-style capitalization. Raw Output: {"message": "[Microsoft.Headings] 'Code Formatter' should use sentence-style capitalization.", "location": {"path": "docs/manual/98_contributing/05_source/60_codeFormatting.md", "range": {"start": {"line": 1, "column": 3}}}, "severity": "INFO"}

We use prettier to format our code.

Check warning on line 3 in docs/manual/98_contributing/05_source/60_codeFormatting.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.We] Try to avoid using first-person plural like 'We'. Raw Output: {"message": "[Microsoft.We] Try to avoid using first-person plural like 'We'.", "location": {"path": "docs/manual/98_contributing/05_source/60_codeFormatting.md", "range": {"start": {"line": 3, "column": 1}}}, "severity": "WARNING"}

Check warning on line 3 in docs/manual/98_contributing/05_source/60_codeFormatting.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.We] Try to avoid using first-person plural like 'our'. Raw Output: {"message": "[Microsoft.We] Try to avoid using first-person plural like 'our'.", "location": {"path": "docs/manual/98_contributing/05_source/60_codeFormatting.md", "range": {"start": {"line": 3, "column": 27}}}, "severity": "WARNING"}

## Format on Save

Check warning on line 5 in docs/manual/98_contributing/05_source/60_codeFormatting.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Headings] 'Format on Save' should use sentence-style capitalization. Raw Output: {"message": "[Microsoft.Headings] 'Format on Save' should use sentence-style capitalization.", "location": {"path": "docs/manual/98_contributing/05_source/60_codeFormatting.md", "range": {"start": {"line": 5, "column": 4}}}, "severity": "INFO"}

### Setting Up Prettier in VS Code

Check warning on line 7 in docs/manual/98_contributing/05_source/60_codeFormatting.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Headings] 'Setting Up Prettier in VS Code' should use sentence-style capitalization. Raw Output: {"message": "[Microsoft.Headings] 'Setting Up Prettier in VS Code' should use sentence-style capitalization.", "location": {"path": "docs/manual/98_contributing/05_source/60_codeFormatting.md", "range": {"start": {"line": 7, "column": 5}}}, "severity": "INFO"}

Check warning on line 7 in docs/manual/98_contributing/05_source/60_codeFormatting.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.HeadingAcronyms] Avoid using acronyms in a title or heading. Raw Output: {"message": "[Microsoft.HeadingAcronyms] Avoid using acronyms in a title or heading.", "location": {"path": "docs/manual/98_contributing/05_source/60_codeFormatting.md", "range": {"start": {"line": 7, "column": 28}}}, "severity": "WARNING"}

1. **Install Prettier Extension (if not already installed):**
- Press `Ctrl` + `P` to open the command palette.
- Type `ext install esbenp.prettier-vscode` and press `Enter`.
- Follow the prompts to install the Prettier extension.

2. **Open Settings:**
- Press `Ctrl` + `,` together to open the VS Code settings.

3. **Enable Format on Save:**
- In the search bar at the top, type `Format on Save`.
- You will see three tabs: User, Remote, and Workspace.
- Check the box next to `Editor: Format on Save` under both User and Remote tabs. **Do not check the box under the Workspace tab.**

Check failure on line 20 in docs/manual/98_contributing/05_source/60_codeFormatting.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Contractions] Use 'don't' instead of 'Do not'. Raw Output: {"message": "[Microsoft.Contractions] Use 'don't' instead of 'Do not'.", "location": {"path": "docs/manual/98_contributing/05_source/60_codeFormatting.md", "range": {"start": {"line": 20, "column": 88}}}, "severity": "ERROR"}

4. **Set Prettier as Default Formatter:**
- Open any file in your workspace.
- Right-click within the file editor.
- Select `Format Document With...`.
- Choose `Configure Default Formatter...`.
- Select `Prettier - Code Formatter` from the list.



### Verifying Your Setup

Check warning on line 31 in docs/manual/98_contributing/05_source/60_codeFormatting.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Headings] 'Verifying Your Setup' should use sentence-style capitalization. Raw Output: {"message": "[Microsoft.Headings] 'Verifying Your Setup' should use sentence-style capitalization.", "location": {"path": "docs/manual/98_contributing/05_source/60_codeFormatting.md", "range": {"start": {"line": 31, "column": 5}}}, "severity": "INFO"}

1. **Test Format on Save:**
- Open a file with some unformatted code.
- Make a small edit and save the file (`Ctrl` + `S`).
- Verify that the code is automatically formatted upon saving.

By following these steps, you ensure that Prettier is set up as the default code formatter and that formatting occurs automatically on save, reducing formatting issues across the team.

Check warning on line 38 in docs/manual/98_contributing/05_source/60_codeFormatting.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Vocab] Verify your use of 'ensure' with the A-Z word list. Raw Output: {"message": "[Microsoft.Vocab] Verify your use of 'ensure' with the A-Z word list.", "location": {"path": "docs/manual/98_contributing/05_source/60_codeFormatting.md", "range": {"start": {"line": 38, "column": 31}}}, "severity": "INFO"}

Check warning on line 38 in docs/manual/98_contributing/05_source/60_codeFormatting.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Passive] 'is set' looks like passive voice. Raw Output: {"message": "[Microsoft.Passive] 'is set' looks like passive voice.", "location": {"path": "docs/manual/98_contributing/05_source/60_codeFormatting.md", "range": {"start": {"line": 38, "column": 52}}}, "severity": "INFO"}

0 comments on commit 4f7ecc9

Please sign in to comment.