Skip to content

chore: Replace prettier with oxfmt#5880

Merged
antonis merged 40 commits intomainfrom
antonis/oxfmt
Mar 30, 2026
Merged

chore: Replace prettier with oxfmt#5880
antonis merged 40 commits intomainfrom
antonis/oxfmt

Conversation

@antonis
Copy link
Copy Markdown
Contributor

@antonis antonis commented Mar 25, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Replace prettier with oxfmt (the Oxc formatter) across the entire repository. oxfmt has 100% prettier compatibility for JS/TS and adds built-in import sorting, recovering the simple-import-sort functionality lost in the oxlint migration (#5867).

What changed

  • Added .oxfmtrc.json with the same formatting options as .prettierrc.json + import sorting config
  • Replaced prettier with oxfmt in all package.json devDependencies and lint/fix scripts
  • Removed .prettierrc.json and .prettierignore
  • Updated VS Code extensions recommendation
  • Auto-formatted all SDK files (~198 files, primarily import reordering)

Formatting changes

The bulk of the diff is import reordering — grouping type imports before value imports, separating external from internal, and adding blank lines between groups. A few minor formatting normalizations (arrow function parens consistent with arrowParens: "avoid", whitespace fixes) are also included.

Import sorting config

"sortImports": {
  "groups": [
    "type-import",
    ["value-builtin", "value-external"],
    ["type-internal", "value-internal"],
    ["type-parent", "type-sibling", "type-index"],
    ["value-parent", "value-sibling", "value-index"],
    "unknown"
  ]
}

Performance

Metric prettier oxfmt Speedup
Format check (285 files) ~3s ~70ms ~40x

Status

oxfmt is in beta (v0.42.0) but has 1.7M weekly npm downloads and passes 100% of prettier's JS/TS conformance tests. sentry-javascript already migrated (#19200). Also adopted by Vue.js, Turborepo, and Hugging Face.

💡 Motivation and Context

  • Recovers simple-import-sort functionality lost in oxlint migration (chore: Migrate from ESLint to oxlint #5867)
  • sentry-javascript already migrated to oxfmt (#19200)
  • ~40x faster formatting
  • Completes the Oxc toolchain adoption (oxlint for linting, oxfmt for formatting)

Closes #5878

💚 How did you test it?

  • yarn lint passes (all 4 lerna projects)
  • oxfmt --check reports zero formatting issues
  • oxlint --type-aware reports zero errors
  • Build and tests pass

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

  • Monitor oxfmt for stable release (currently beta)

antonis and others added 12 commits March 23, 2026 15:30
Replace ESLint with oxlint for ~430x faster linting (30s → 70ms).
Follows the same pattern as sentry-javascript#19134.

Changes:
- Add .oxlintrc.json with rule parity to the previous ESLint config
- Use jsPlugins for @sentry-internal/eslint-plugin-sdk custom rules
- Migrate all eslint-disable comments to oxlint-disable format
- Remove unused disable directives (rules already off in config)
- Remove ESLint dependencies and config files
- Clean up ESLint-related yarn resolutions

Known gaps (same as sentry-javascript):
- No import sorting (simple-import-sort has no oxlint equivalent)
- No naming-convention, member-ordering, explicit-member-accessibility
- sdk/no-regexp-constructor disabled (inline disable not supported for jsPlugin rules)

Closes #5615

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removing ESLint from packages/core changed the dependency resolution
tree, causing the expo sample to resolve es-iterator-helpers@1.0.19
which has a known incompatibility with eslint-plugin-react. Pinning
to ^1.2.1 resolves the issue.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove ESLint from all sample apps (react-native, react-native-macos,
expo) and performance test apps (TestAppPlain, TestAppSentry). Replace
with lightweight oxlint configs for samples that had lint scripts.

Also clean up root package.json:
- Remove es-iterator-helpers resolution (no longer needed)
- Remove eslint-plugin-ft-flow resolution
- Remove @typescript-eslint/typescript-estree minimatch resolutions

This fully removes ESLint from the repository.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update dependabot.yml: replace typescript-eslint group with oxlint
- Update VS Code extensions: replace vscode-eslint with oxlint extension
- Update update-javascript.sh: remove @sentry-internal/eslint-config-sdk
- Remove stale eslint-disable comments from sample apps
- Update comments referencing ESLint in SDK source files
- Downgrade react-hooks/exhaustive-deps to warn in sample configs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sample apps reference `npx oxlint` but oxlint was only installed in
packages/core. With yarn PnP, the binary isn't available to sibling
workspaces. Adding it to root devDependencies makes it available to
all workspaces.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removing direct @typescript-eslint v8 dependencies caused the
transitive @typescript-eslint/typescript-estree@6.21.0 (from
eslint-plugin-sdk) to resolve minimatch@9.0.3 which has known
ReDoS vulnerabilities. Pin to ^9.0.7 to resolve.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s to error

The big-data.test.ts file contained only a skipped test with no
running assertions. Removing it and promoting sdk/no-skipped-tests
back to error since there are no more intentional test.skip usages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace prettier with oxfmt (the Oxc formatter) across the entire
repository. oxfmt has 100% prettier compatibility for JS/TS and adds
built-in import sorting, recovering the simple-import-sort functionality
lost in the ESLint → oxlint migration.

- Add .oxfmtrc.json with same settings as .prettierrc.json + import sorting
- Replace prettier with oxfmt in all package.json devDependencies
- Update lint/fix scripts in packages/core and samples
- Remove .prettierrc.json and .prettierignore
- Update VS Code extensions recommendation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Auto-formatted all SDK source, test, script, and plugin files with
oxfmt. Changes are primarily import reordering (grouping type imports,
separating external from internal) and minor formatting normalization
(arrow function parens consistent with arrowParens: "avoid").

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • chore: Replace prettier with oxfmt by antonis in #5880
  • chore(deps): bump brace-expansion to ^5.0.5 by antonis in #5920
  • chore(deps): bump path-to-regexp to ^8.4.0 by antonis in #5919
  • chore: Migrate from ESLint to oxlint by antonis in #5867
  • chore(deps): bump yaml to ^2.8.3 by antonis in #5921
  • chore(deps): bump activesupport to >= 7.2.3.1 by antonis in #5922
  • fix(ci): Update validate-pr action to remove draft enforcement by stephanie-anderson in #5923
  • chore(deps): bump actions/checkout from 4 to 6 by dependabot in #5916
  • chore(deps): bump getsentry/craft from 2.25.0 to 2.25.2 by dependabot in #5918
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.25.0 to 2.25.2 by dependabot in #5914
  • chore(deps): bump github/codeql-action from 4.34.1 to 4.35.1 by dependabot in #5917
  • chore(deps): bump dorny/paths-filter from 3.0.2 to 4.0.1 by dependabot in #5915
  • fix: Prevent script injection vulnerability in platform-check action by fix-it-felix-sentry in #5913
  • chore(ios): Upgrade clang-format from v20 to v22 by antonis in #5905
  • chore: Add PR validation workflow by stephanie-anderson in #5906
  • chore(deps): bump brace-expansion from 1.1.12 to 1.1.13 by dependabot in #5909
  • chore(deps): bump picomatch to fix ReDoS and method injection by antonis in #5900
  • chore(deps): update Android SDK to v8.37.1 by github-actions in #5884
  • fix(build): Update expo-handler sentry-android version in update script by antonis in #5904
  • fix(ios): synchronize RNSentryTimeToDisplay across main and bridge th… by huextrat in #5887
  • chore(deps): bump node-forge from 1.3.2 to 1.4.0 by dependabot in #5903
  • chore(deps): update Sentry Android Gradle Plugin to v6.3.0 by github-actions in #5902
  • chore(deps): bump handlebars from 4.7.8 to 4.7.9 by dependabot in #5901

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request

Generated by 🚫 dangerJS against faf0c6b

@antonis antonis linked an issue Mar 25, 2026 that may be closed by this pull request
antonis and others added 6 commits March 26, 2026 12:00
Now that TypeScript is upgraded to 5.9.3, enable type-aware linting
via oxlint --type-aware + oxlint-tsgolint. This enforces rules like
no-floating-promises, unbound-method, and no-unsafe-member-access
that require type information.

- Add oxlint-tsgolint devDependency
- Add tsconfig.lint.json for tsgolint (avoids alwaysStrict compat issue
  with @sentry-internal/typescript tsconfig)
- Enable --type-aware and --deny-warnings in lint scripts
- Disable await-thenable (not in original ESLint config, false positives on mocks)
- Add oxlint-disable comments for intentional violations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
express@4.19.2 is no longer in the dependency tree.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve merge conflicts, apply oxfmt formatting to new/changed files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@antonis antonis marked this pull request as ready for review March 26, 2026 15:58
@antonis antonis mentioned this pull request Mar 26, 2026
10 tasks
antonis and others added 5 commits March 26, 2026 17:12
The merge with main lost the !__DEV__ condition in the
__SENTRY_OPTIONS__ check, which would have changed behavior in
dev builds by skipping native auto-initialization. Restore the
guard and update tests to match main's version that properly
tests dev vs release build behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
antonis and others added 4 commits March 27, 2026 12:33
…re linting

The `@sentry-internal/typescript/tsconfig.json` sets `alwaysStrict: false`
which tsgolint rejects. Use the env var workaround from sentry-javascript.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This rule was available in oxlint but missed during the ESLint migration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use `typescript-eslint(rule-name)` format to match the rest of the codebase.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolves conflict in package.json: keeps oxfmt commands with the
OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS env var.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@lucas-zimerman lucas-zimerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

antonis and others added 7 commits March 30, 2026 09:41
…plugin/utils.ts

The file-level oxlint-disable for no-unsafe-member-access was a
leftover that's no longer needed — the file has no actual violations
with type-aware linting enabled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	packages/core/android/libs/replay-stubs.jar
… errors

- Restore oxlint-disable for no-unsafe-member-access in plugin/utils.ts
  (tsgolint false positive: types `fs` as `error` with SUPPRESS_DIAGNOSTICS)
- Fix lint:oxlint grep pattern from [01] to 0 so it no longer silently
  accepts 1 genuine lint error

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	packages/core/android/libs/replay-stubs.jar
#	packages/core/package.json
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

antonis and others added 4 commits March 30, 2026 10:25
Import sorting displaced the file-level oxlint-disable comment from
line 1 to line 3. Move it back to the top so it applies to the
entire file.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tern

- Convert 3 stale eslint-disable comments for no-unnecessary-type-assertion
  to oxlint-disable format (touchevents.tsx, nativelinkederrors.ts)
- Fix override glob "*.tsx" → "**/*.tsx" for consistency with other overrides

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	packages/core/src/js/touchevents.tsx
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Base automatically changed from antonis/oxlint to main March 30, 2026 13:57
antonis added 2 commits March 30, 2026 16:00
# Conflicts:
#	.vscode/extensions.json
#	package.json
#	packages/core/package.json
#	packages/core/src/js/RNSentryReplayMaskNativeComponent.ts
#	packages/core/src/js/RNSentryReplayUnmaskNativeComponent.ts
#	packages/core/src/js/feedback/FeedbackWidgetManager.tsx
#	packages/core/src/js/integrations/default.ts
#	packages/core/src/js/sdk.tsx
#	packages/core/src/js/tools/sentryMetroSerializer.ts
#	packages/core/src/js/tools/utils.ts
#	packages/core/src/js/tools/vendor/metro/utils.ts
#	packages/core/src/js/touchevents.tsx
#	packages/core/src/js/tracing/reactnativetracing.ts
#	packages/core/test/tools/sentryMetroSerializer.test.ts
#	packages/core/test/wrap.mocked.test.tsx
#	samples/expo/package.json
#	yarn.lock
@antonis antonis merged commit 5eb7843 into main Mar 30, 2026
41 of 49 checks passed
@antonis antonis deleted the antonis/oxfmt branch March 30, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: Evaluate oxfmt as a prettier replacement

2 participants