Skip to content

Commit

Permalink
adds task for checking prettier locally
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronzi committed Aug 8, 2024
1 parent 91a0bff commit 7a96971
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
},
// Use 'postCreateCommand' to run commands after the container is created. Add npm
"postCreateCommand": "go install github.com/swaggo/swag/cmd/swag@latest && sudo apt-get update && sudo apt-get install -y nodejs npm && sudo npm install -g npm && sudo npm install -g yarn"
"postCreateCommand": "go install github.com/swaggo/swag/cmd/swag@latest && sudo apt-get update && sudo apt-get install -y nodejs npm && sudo npm install -g npm && sudo npm install -g yarn && sudo npm install -g prettier@latest && sudo npm install -g prettier-plugin-vue"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
7 changes: 4 additions & 3 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ jobs:
- name: Run Prettier
id: prettier-run
run: |
echo "prettier-output<<EOF" >> $GITHUB_ENV
prettier --check --config ./.prettierrc --ignore-path ./.prettierignore --no-error-on-unmatched-pattern **/*.ts **/*.vue **/*.json **/*.js | tee -a $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
if ! prettier --check --config ./.prettierrc --ignore-path ./.prettierignore --no-error-on-unmatched-pattern **/*.ts **/*.vue **/*.json **/*.js; then
echo "Formatting issues found"
exit 1
fi
- name: Prettier Output
if: ${{ failure() }}
Expand Down
19 changes: 19 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@
},
"problemMatcher": [],
"detail": "Lint the Vue 3 Vite project"
},
{
"label": "Check code formatting",
"type": "shell",
"command": "npx",
"args": [
"prettier",
"--check",
"\"**/*.{ts,vue,json,js}\""
],
"options": {
"cwd": "${workspaceFolder}"
},
"group": {
"kind": "test",
"isDefault": false
},
"problemMatcher": [],
"detail": "Check code formatting using Prettier"
}
]
}

0 comments on commit 7a96971

Please sign in to comment.