Skip to content

Commit

Permalink
Add auto format prettier
Browse files Browse the repository at this point in the history
Add auto format prettier

Add prettier

Add configuration file for prettier
  • Loading branch information
jonashonecker committed Jun 5, 2024
1 parent 9898c60 commit 8e43e7c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Format
on:
push:
pull_request:
branches: [main]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v2
with:
node-version: "20.x"
- run: npm ci
working-directory: ./frontend
- run: npm run prettify
working-directory: ./frontend
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply formatting changes
branch: ${{ github.head_ref }}
22 changes: 22 additions & 0 deletions frontend/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"bracketSameLine": false,
"jsxBracketSameLine": false,
"arrowParens": "always",
"requirePragma": false,
"insertPragma": false,
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css",
"vueIndentScriptAndStyle": false,
"endOfLine": "lf",
"embeddedLanguageFormatting": "auto",
"singleAttributePerLine": false
}
16 changes: 16 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"test": "jest",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"preview": "vite preview",
"prettify": "prettier ./src -w"
},
"dependencies": {
"axios": "^1.7.2",
Expand All @@ -19,6 +20,7 @@
"styled-components": "^6.1.11"
},
"devDependencies": {
"prettier": "^3.3.1",
"@babel/core": "^7.24.6",
"@babel/preset-env": "^7.24.6",
"@babel/preset-react": "^7.24.6",
Expand Down

0 comments on commit 8e43e7c

Please sign in to comment.