Skip to content

Commit

Permalink
chore: add prettier (#7)
Browse files Browse the repository at this point in the history
Add `prettier` as formatter to the project. Formatting will be checked
in the `CI` pipeline to enfore consistent formatting in all source
files.
  • Loading branch information
xDivisionByZerox authored Sep 3, 2023
1 parent 4d6f701 commit 66ea55f
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
"groupName": "eslint",
"matchPackagePrefixes": ["@typescript-eslint/", "eslint"]
},
{
"groupName": "prettier",
"matchPackagePrefixes": ["prettier"]
},
{
"groupName": "typescript",
"matchPackageNames": ["typescript"]
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ jobs:
- name: Lint
run: npx eslint .

format:
runs-on: ubuntu-latest
timeout-minutes: 5
name: 'Format: node-18, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set node version to 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install deps
run: npm install

- name: Format
run: npx prettier src --check

ts-check-tests:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"trailingComma": "all",
"singleQuote": true
}
16 changes: 16 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"format": "prettier src --write",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
Expand All @@ -31,6 +32,7 @@
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"eslint": "^8.42.0",
"prettier": "^3.0.3",
"typescript": "~5.0.4"
}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// todo write the application
// todo write the application

0 comments on commit 66ea55f

Please sign in to comment.