Skip to content

Commit 660668c

Browse files
Miodecfehmer
andauthored
chore: use oxfmt for formatting (@Miodec) (monkeytypegame#7187)
8 times faster formatting, calls prettier internally for unsupported files waiting on oxc-project/oxc#16637 oxc-project/oxc#16598 oxc-project/oxc#16621 --------- Co-authored-by: Christian Fehmer <[email protected]>
1 parent 89e7e68 commit 660668c

30 files changed

+518
-439
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ updates:
44
directory: "/"
55
versioning-strategy: increase
66
schedule:
7-
interval: "weekly"
7+
interval: "weekly"

.github/labeler.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,12 @@ packages:
1818
- any: ["packages/**/*"]
1919

2020
local dev:
21-
- any: ["**/turbo.json", "**/tsconfig.json", "**/knip.json", "**/.prettierrc", "**/.oxlintrc.json", "**/.eslintrc.cjs"]
21+
- any:
22+
[
23+
"**/turbo.json",
24+
"**/tsconfig.json",
25+
"**/knip.json",
26+
"**/.prettierrc",
27+
"**/.oxlintrc.json",
28+
"**/.eslintrc.cjs",
29+
]
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Formatting check
1+
name: Check formatting
22

33
env:
44
PNPM_VERSION: "9.6.0"
@@ -8,7 +8,7 @@ on:
88
pull_request:
99
branches: [master]
1010
types: [opened, reopened, synchronize, ready_for_review]
11-
11+
1212
permissions:
1313
contents: read
1414

@@ -36,8 +36,7 @@ jobs:
3636
version: ${{ env.PNPM_VERSION }}
3737

3838
- name: Install formatter
39-
run: pnpm install -D -w prettier
40-
39+
run: pnpm install -D -w oxfmt
4140

4241
- name: Get changed files
4342
id: get-changed-files
@@ -58,6 +57,5 @@ jobs:
5857
run: |
5958
CHANGED_FILES=$(echo ${{ steps.get-changed-files.outputs.result }})
6059
if [ -n "$CHANGED_FILES" ]; then
61-
pnpm prettier --check $CHANGED_FILES
60+
pnpm oxfmt $CHANGED_FILES --check --no-error-on-unmatched-pattern
6261
fi
63-

.github/workflows/ci-failure-comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ jobs:
3434
- name: Apply label changes
3535
uses: PauMAVA/[email protected]
3636
with:
37-
issue_number: ${{ steps.pr_num_reader.outputs.content }}
37+
issue_number: ${{ steps.pr_num_reader.outputs.content }}
3838
add: "waiting for update"
3939
remove: "waiting for review"

.github/workflows/fix-formatting.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
version: ${{ env.PNPM_VERSION }}
3535

3636
- name: Install formatter
37-
run: pnpm install -D -w prettier
37+
run: pnpm install -D -w oxfmt
3838

3939
- name: Get changed files
4040
id: get-changed-files
@@ -51,12 +51,11 @@ jobs:
5151
);
5252
return changedFiles.filter(file=> file.status !== "removed").map(file => file.filename).join(' ');
5353
54-
5554
- name: Fix formatting
5655
run: |
5756
CHANGED_FILES=$(echo ${{ steps.get-changed-files.outputs.result }})
5857
if [ -n "$CHANGED_FILES" ]; then
59-
pnpm prettier --write $CHANGED_FILES
58+
pnpm oxfmt $CHANGED_FILES --no-error-on-unmatched-pattern
6059
fi
6160
6261
- name: Commit changes

.github/workflows/labeler.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
pull-requests: write
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/labeler@v4
13-
with:
14-
repo-token: "${{ secrets.API_TOKEN }}"
12+
- uses: actions/labeler@v4
13+
with:
14+
repo-token: "${{ secrets.API_TOKEN }}"

.github/workflows/monkey-ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ jobs:
8080
needs: [pre-ci]
8181
if: needs.pre-ci.outputs.should-build-be == 'true' || needs.pre-ci.outputs.should-build-fe == 'true' || needs.pre-ci.outputs.should-build-pkg == 'true' || needs.pre-ci.outputs.assets-json == 'true' || contains(github.event.pull_request.labels.*.name, 'force-full-ci')
8282
steps:
83-
8483
- name: Checkout pnpm-lock
8584
uses: actions/checkout@v4
8685
with:
@@ -175,7 +174,6 @@ jobs:
175174
runs-on: ubuntu-latest
176175
if: needs.pre-ci.outputs.should-build-fe == 'true' || needs.pre-ci.outputs.should-build-pkg == 'true' || contains(github.event.pull_request.labels.*.name, 'force-full-ci')
177176
steps:
178-
179177
- uses: actions/checkout@v4
180178
with:
181179
sparse-checkout: |
@@ -296,7 +294,6 @@ jobs:
296294
runs-on: ubuntu-latest
297295
if: needs.pre-ci.outputs.should-build-pkg == 'true' || contains(github.event.pull_request.labels.*.name, 'force-full-ci')
298296
steps:
299-
300297
- uses: actions/checkout@v4
301298
with:
302299
sparse-checkout: |

.github/workflows/publish-docker-images.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: Publish Docker image
22

3-
43
permissions:
54
contents: read
65

.github/workflows/semantic-pr-title.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
style
3838
test
3939
requireScope: false
40-
subjectPattern: ^.+ \(@[^ ,]+(, @[^ ,]+)*\)$
40+
subjectPattern: ^.+ \(@[^ ,]+(, @[^ ,]+)*\)$
4141
subjectPatternError: |
4242
Title "{title}"
4343
didn't match the configured pattern. Please ensure that the title
@@ -46,7 +46,7 @@ jobs:
4646
- uses: marocchino/sticky-pull-request-comment@v2
4747
# When the previous steps fails, the workflow would stop. By adding this
4848
# condition you can continue the execution with the populated error message.
49-
if: always() && (steps.lint_pr_title.outputs.error_message != null)
49+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
5050
with:
5151
header: pr-title-lint-error
5252
message: |

.oxfmtrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/refs/heads/main/npm/oxfmt/configuration_schema.json",
3+
"printWidth": 80,
4+
"tabWidth": 2,
5+
"useTabs": false,
6+
"htmlWhitespaceSensitivity": "ignore",
7+
"endOfLine": "lf",
8+
"trailingComma": "all",
9+
"ignorePatterns": [
10+
"node_modules",
11+
".turbo",
12+
"dist",
13+
"build",
14+
"logs",
15+
"coverage",
16+
"*.md"
17+
]
18+
}

0 commit comments

Comments
 (0)