Skip to content

Commit 0a2270c

Browse files
Merge pull request #79 from laravel/ci-format-code
CI JS code formatting
2 parents b5d6c81 + 829c471 commit 0a2270c

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

.github/workflows/coding-standards.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: fix code styling
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
48

59
permissions:
610
contents: write
@@ -10,3 +14,20 @@ jobs:
1014
uses: laravel/.github/.github/workflows/coding-standards.yml@main
1115
with:
1216
php: "8.3"
17+
format:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Install dependencies
25+
run: npm install
26+
27+
- name: Format code
28+
run: npm run format
29+
30+
- name: Commit formatted files
31+
uses: stefanzweifel/git-auto-commit-action@v5
32+
with:
33+
commit_message: "Fix code style"

.prettierrc.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"test-routes-cached": "WAYFINDER_CACHE_ROUTES=1 vitest run",
66
"lint": "eslint ./workbench/resources/js --ext .ts,.tsx",
77
"lint:fix": "eslint ./workbench/resources/js --ext .ts,.tsx --fix",
8+
"format": "npx --yes prettier --write \"resources/js/**/*.{ts,js,json}\"",
89
"tsc": "tsc --noEmit"
910
},
1011
"devDependencies": {

0 commit comments

Comments
 (0)