Skip to content

Commit

Permalink
Add prettier (#47)
Browse files Browse the repository at this point in the history
fix prettier config
  • Loading branch information
julienbrg authored Nov 2, 2024
1 parent cb49648 commit d84baac
Show file tree
Hide file tree
Showing 15 changed files with 2,158 additions and 30 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": "next/core-web-vitals"
"extends": ["next/core-web-vitals", "prettier"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error",
"arrow-body-style": "off",
"prefer-arrow-callback": "off"
}
}
27 changes: 17 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,49 @@
name: Run Tests
name: CI

on:
push:
branches: [main, master]
pull_request:
branches: [main]
branches: [main, master]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

- name: Install pnpm
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: '8.7.5'

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Run Prettier check
run: pnpm format:check

- name: Run tests
run: pnpm test

- name: Run ESLint
run: pnpm lint
44 changes: 44 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem
genji_app_description*

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# IDE
.idea
.vscode

# package manager
pnpm-lock.yaml
package-lock.json
yarn.lock
25 changes: 17 additions & 8 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
{
"trailingComma": "es5",
"semi": false,
"singleQuote": true,
"printWidth": 150,
"bracketSameLine": true,
"useTabs": false,
"tabWidth": 2
}
"trailingComma": "es5",
"semi": false,
"singleQuote": true,
"printWidth": 120,
"bracketSameLine": true,
"useTabs": false,
"tabWidth": 2,
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxSingleQuote": false,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false
}
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode"]
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
}
23 changes: 22 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
Loading

0 comments on commit d84baac

Please sign in to comment.