Skip to content

Commit ea1b203

Browse files
committed
Setup formatting check task
Specificially not using Prettier for Markdown.
1 parent 722af37 commit ea1b203

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
"compile": "esbuild ./src/extension.ts --outdir=dist --sourcemap --bundle --external:vscode --platform=node",
105105
"watch": "npm run compile -- --watch",
106106
"lint": "eslint src test --ext .ts",
107+
"format": "prettier --check '**/*.{ts,json,yml,mjs,code-workspace}'",
107108
"package": "vsce package --out out/ --no-gitHubIssueLinking",
108109
"publish": "vsce publish",
109110
"pretest": "npm run compile",

pwsh-extension-dev.code-workspace

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
"settings": {
2525
"window.title": "PowerShell VS Code Extension Development",
2626
"debug.onTaskErrors": "prompt",
27+
"editor.formatOnSave": true,
28+
"editor.formatOnSaveMode": "modifications",
29+
"editor.formatOnPaste": true,
2730
"editor.codeActionsOnSave": {
2831
"source.fixAll": "explicit",
2932
},
30-
"[typescript][javascript][json]": {
33+
"[typescript][javascript][json][jsonc]": {
3134
"editor.defaultFormatter": "esbenp.prettier-vscode",
32-
"editor.formatOnPaste": true,
33-
"editor.formatOnSave": true,
34-
"editor.formatOnSaveMode": "modificationsIfAvailable",
35+
"editor.formatOnSaveMode": "file",
3536
},
3637
"files.associations": {
3738
"**/snippets/*.json": "jsonc", // Use JSONC instead of JSON because that's how VS Code interprets snippet files, and it enables better source documentation.

vscode-powershell.build.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ task CleanEditorServices -If (Get-EditorServicesPath) {
8686
task Lint RestoreNodeOptional, {
8787
Write-Build DarkMagenta "Linting TypeScript"
8888
Invoke-BuildExec { & npm run lint }
89+
Write-Build DarkMagenta "Checking formatting of TypeScript, JSON, etc."
90+
Invoke-BuildExec { & npm run format }
8991
}
9092

9193
task Build RestoreEditorServices, RestoreNode, {

0 commit comments

Comments
 (0)