Skip to content

Commit 107fde7

Browse files
authored
Merge pull request #18 from DeployGate/work/prettier
Introduce Prettier and Enforce Indentation Rules via GitHub Actions
2 parents a8cf11b + fe3112c commit 107fde7

5 files changed

Lines changed: 222 additions & 165 deletions

File tree

.github/workflows/format-check.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Format Check
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
types: [opened, synchronize, reopened]
7+
8+
jobs:
9+
format:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Check formatting
26+
run: |
27+
npm run format
28+
git diff --exit-code src/ || (echo "Formatting needs to be fixed. Please run 'npm run format' to fix it." && exit 1)

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"useTabs": false
8+
}

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "ncc build src/main.ts -o dist",
99
"prepare": "npm run build",
1010
"test": "jest",
11-
"lint": "eslint src/**/*.ts"
11+
"format": "prettier --write \"src/**/*.ts\""
1212
},
1313
"dependencies": {
1414
"@actions/core": "1.11.1",
@@ -23,7 +23,8 @@
2323
"@vercel/ncc": "0.38.3",
2424
"eslint": "8.38.0",
2525
"jest": "29.7.0",
26+
"prettier": "^3.5.3",
2627
"ts-jest": "29.3.2",
2728
"typescript": "5.8.3"
2829
}
29-
}
30+
}

0 commit comments

Comments
 (0)