Skip to content

Commit 6fb1ee1

Browse files
authored
chore: migrate to oxfmt (#19200)
This PR migrates our formatting tool from `prettier` to `oxfmt` which is part of the oxc toolchain and offers faster checking and format fixing speeds while [maintaining the same coverage](https://x.com/boshen_c/status/2018329440607203471). I created a follow up PR in #19311 to unignore a few rules and fix the associated snapshot tests affected by it. ### Benchmarks Benchmark | Prettier | oxfmt | Speedup -- | -- | -- | -- CI | 45s | 6.0s-7.0s | ~5x-7.5× Local M3 Pro | 22s | 1.22s-1.98s | ~11× --- closes #19223
1 parent fb52cd2 commit 6fb1ee1

File tree

37 files changed

+301
-181
lines changed

37 files changed

+301
-181
lines changed

.cursor/rules/sdk_development.mdc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
3434

3535
- `yarn lint` - Run ESLint and Prettier checks
3636
- `yarn fix` - Auto-fix linting and formatting issues
37+
- `yarn format:check` - Check file formatting only
38+
- `yarn format` - Auto-fix formatting issues
3739
- `yarn lint:es-compatibility` - Check ES compatibility
3840

3941
## Git Flow Branching Strategy

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ trim_trailing_whitespace = true
88
insert_final_newline = true
99

1010
[*.md]
11-
trim_trailing_whitespace = false
11+
trim_trailing_whitespace = false

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ jobs:
339339
id: install_dependencies
340340

341341
- name: Check file formatting
342-
run: yarn lint:prettier
342+
run: yarn format:check
343343

344344
job_circular_dep_check:
345345
name: Circular Dependency Check

.oxfmtrc.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"arrowParens": "avoid",
4+
"printWidth": 120,
5+
"proseWrap": "always",
6+
"singleQuote": true,
7+
"trailingComma": "all",
8+
"experimentalSortPackageJson": false,
9+
"ignorePatterns": [
10+
"packages/browser/test/loader.js",
11+
"packages/replay-worker/examples/worker.min.js",
12+
"dev-packages/browser-integration-tests/fixtures",
13+
"**/test.ts-snapshots/**",
14+
"/.nx/cache",
15+
"/.nx/workspace-data",
16+
"dev-packages/**/*.html",
17+
"dev-packages/**/*.hbs",
18+
"packages/ember/**/*.hbs",
19+
"packages/ember/**/*.html"
20+
],
21+
"overrides": [
22+
{
23+
"files": ["*.md", "*.mdc"],
24+
"options": {
25+
"proseWrap": "preserve"
26+
}
27+
}
28+
]
29+
}

.prettierignore

Lines changed: 0 additions & 9 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// See http://go.microsoft.com/fwlink/?LinkId=827846
33
// for the documentation about the extensions.json format
44
"recommendations": [
5-
"esbenp.prettier-vscode",
5+
"oxc.oxc-vscode",
66
"dbaeumer.vscode-eslint",
77
"augustocdias.tasks-shell-input",
88
"denoland.vscode-deno"

.vscode/settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
},
1212
"typescript.tsdk": "./node_modules/typescript/lib",
1313
"[markdown]": {
14-
"editor.defaultFormatter": "esbenp.prettier-vscode"
14+
"editor.defaultFormatter": "oxc.oxc-vscode"
1515
},
1616
"[css]": {
17-
"editor.defaultFormatter": "esbenp.prettier-vscode"
17+
"editor.defaultFormatter": "oxc.oxc-vscode"
1818
},
1919
"yaml.schemas": {
2020
"https://json.schemastore.org/github-workflow.json": ".github/workflows/**.yml"
@@ -25,8 +25,8 @@
2525
}
2626
],
2727
"deno.enablePaths": ["packages/deno/test"],
28-
"editor.defaultFormatter": "esbenp.prettier-vscode",
28+
"editor.defaultFormatter": "oxc.oxc-vscode",
2929
"[typescript]": {
30-
"editor.defaultFormatter": "esbenp.prettier-vscode"
30+
"editor.defaultFormatter": "oxc.oxc-vscode"
3131
}
3232
}

CLAUDE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
3131

3232
### Linting and Formatting
3333

34-
- `yarn lint` - Run ESLint and Prettier checks
34+
- `yarn lint` - Run ESLint and Oxfmt checks
3535
- `yarn fix` - Auto-fix linting and formatting issues
36+
- `yarn format:check` - Check file formatting only
37+
- `yarn format` - Auto-fix formatting issues
3638
- `yarn lint:es-compatibility` - Check ES compatibility
3739

3840
## Git Flow Branching Strategy

dev-packages/cloudflare-integration-tests/suites/basic/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"name": "worker-name",
33
"compatibility_date": "2025-06-17",
44
"main": "index.ts",
5-
"compatibility_flags": ["nodejs_compat"]
5+
"compatibility_flags": ["nodejs_compat"],
66
}

dev-packages/cloudflare-integration-tests/suites/hono-integration/wrangler.jsonc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
"name": "hono-basic-worker",
33
"compatibility_date": "2025-06-17",
44
"main": "index.ts",
5-
"compatibility_flags": ["nodejs_compat"]
5+
"compatibility_flags": ["nodejs_compat"],
66
}
7-

0 commit comments

Comments
 (0)