Skip to content

Commit

Permalink
Add Prettier config and GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nunogoncalves03 committed Jan 21, 2024
1 parent c304a1e commit 6666aa3
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 5 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/prettier-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Prettier Check

on:
push:
branches:
- main

jobs:
prettier-check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install frontend dependencies
run: |
cd frontend
npm install -D
- name: Install backend dependencies
run: |
cd backend
npm install -D
- name: Frontend Prettier check
run: |
cd frontend
npm run prettier:check
- name: Backend Prettier check
run: |
cd backend
npm run prettier:check
11 changes: 11 additions & 0 deletions backend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf"
}
24 changes: 23 additions & 1 deletion backend/package-lock.json

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

7 changes: 5 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"main": "index.js",
"scripts": {
"start": "nodemon src/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"prettier:check": "prettier --check \"**/*.{js,json,md}\"",
"prettier:format": "prettier --write \"**/*.{js,json,md}\""
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -39,6 +41,7 @@
"winston": "^3.11.0"
},
"devDependencies": {
"nodemon": "^2.0.22"
"nodemon": "^2.0.22",
"prettier": "3.2.4"
}
}
16 changes: 16 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "avoid",
"endOfLine": "lf",
"embeddedLanguageFormatting": "auto",
"singleAttributePerLine": false
}
22 changes: 22 additions & 0 deletions frontend/package-lock.json

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

7 changes: 5 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
"dev": "vite --host",
"build": "vite build",
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"preview": "vite preview",
"prettier:check": "prettier --check \"**/*.{js,json,md,jsx,html,css}\"",
"prettier:format": "prettier --write \"**/*.{js,json,md,jsx,html,css}\""
},
"dependencies": {
"@emotion/react": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.13.2",
"axios": "^1.6.0",
"plotly.js": "^2.25.2",
"notistack": "^3.0.1",
"plotly.js": "^2.25.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-plotly.js": "^2.6.0",
Expand All @@ -30,6 +32,7 @@
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"prettier": "3.2.4",
"vite": ">=4.5.2"
}
}

0 comments on commit 6666aa3

Please sign in to comment.