Skip to content

Commit

Permalink
Add explicit default formatters by language (#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec committed Nov 13, 2020
1 parent 0e34593 commit 5c1a0f2
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": ["esbenp.prettier-vscode"],
"recommendations": ["esbenp.prettier-vscode", "ms-dotnettools.csharp"],

// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
Expand Down
28 changes: 28 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"[csharp]": {
"editor.defaultFormatter": "ms-dotnettools.csharp"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ A rapid word collection tool.
- [MongoDB](https://docs.mongodb.com/manual/administration/install-community/) and add
/bin to PATH Environment Variable
- On Windows, if using [Chocolatey][chocolatey]: `choco install mongodb`
- [VS Code](https://code.visualstudio.com/download) and Prettier code
formatting extension
- [VS Code](https://code.visualstudio.com/download) and the following extensions:
- C# (`ms-dotnettools.csharp`)
- Prettier - Code formatter (`esbenp.prettier-vscode`)
- [dotnet-format](https://github.com/dotnet/format):
`dotnet tool update --global dotnet-format --version 4.1.131201`
- [dotnet-reportgenerator](https://github.com/danielpalme/ReportGenerator)
Expand All @@ -85,13 +86,10 @@ A rapid word collection tool.
- `COMBINE_SMTP_ADDRESS`
- `COMBINE_SMTP_FROM`

6. (VS Code Users Only) Enable automatic formatting on save.
- **File** | **Preferences** | **Settings** | Search for **formatOnSave** and
check the box.
7. Run `npm start` from the project directory to install dependencies and start
6. Run `npm start` from the project directory to install dependencies and start
the project.

8. Consult our [C#](docs/c_sharp_style_guide.md)
7. Consult our [C#](docs/c_sharp_style_guide.md)
and [JavaScript/TypeScript](docs/ts_style_guide.md)
style guides for best coding practices in this project.

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"eject": "react-scripts eject",
"fmt-backend": "dotnet-format",
"fmt-backend-check": "dotnet-format --check",
"fmt-frontend": "prettier --write \"./src/**/*.{js,jsx,ts,tsx,json}\"",
"fmt-frontend-check": "prettier --check \"./src/**/*.{js,jsx,ts,tsx,json}\"",
"fmt-frontend": "prettier --write \"./{.vscode,public,scripts,src}/**/*.{js,jsx,ts,tsx,json}\"",
"fmt-frontend-check": "prettier --check \"./{.vscode,public,scripts,src}/**/*.{js,jsx,ts,tsx,json}\"",
"frontend": "react-scripts start",
"gen-backend-coverage-report": "tsc scripts/genBackendCoverageReport.ts && node scripts/genBackendCoverageReport.js",
"import-sem-doms": "tsc scripts/importSemanticDomains.ts && node scripts/importSemanticDomains.js",
Expand Down
2 changes: 1 addition & 1 deletion scripts/printVersion.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(require('../package.json').version);
console.log(require("../package.json").version);

0 comments on commit 5c1a0f2

Please sign in to comment.