Skip to content

Commit 5eb7843

Browse files
antonisclaude
andauthored
chore: Replace prettier with oxfmt (#5880)
* chore(core): Migrate from ESLint to oxlint 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> * chore(core): Add sdk/no-focused-tests and sdk/no-skipped-tests rules Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Pin es-iterator-helpers to ^1.2.1 for sample app ESLint compat 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> * chore: Migrate sample apps and perf tests from ESLint to oxlint 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> * chore: Clean up remaining ESLint references across the repo - 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> * fix: Add oxlint to root devDependencies for workspace resolution 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> * fix: Pin minimatch for @typescript-eslint/typescript-estree to ^9.0.7 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> * ci: Retrigger checks * chore: Replace prettier with oxfmt 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> * style(core): Apply oxfmt formatting and import sorting 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> * Merge main into antonis/oxlint * chore(core): Enable type-aware linting with oxlint-tsgolint 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> * chore: Remove stale express/path-to-regexp resolution express@4.19.2 is no longer in the dependency tree. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(core): Restore __DEV__ guard for native auto-initialization 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> * Restore rule * fix(core): Suppress tsgolint tsconfig diagnostics for oxlint type-aware 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> * chore(core): Add typescript/unified-signatures rule to oxlint config This rule was available in oxlint but missed during the ESLint migration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(core): Use consistent oxlint disable comment format Use `typescript-eslint(rule-name)` format to match the rest of the codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore(core): Remove unnecessary no-unsafe-member-access disable from 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> * fix(core): Restore utils.ts disable and fix lint script to reject all 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> * fix(core): Move oxlint-disable above sorted imports in default.ts 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> * fix(core): Migrate remaining eslint-disable comments and fix glob pattern - 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> * style(core): Reformat touchevents.tsx with oxfmt Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fdf2e8a commit 5eb7843

File tree

210 files changed

+1263
-546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+1263
-546
lines changed

.oxfmtrc.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "./packages/core/node_modules/oxfmt/configuration_schema.json",
3+
"arrowParens": "avoid",
4+
"printWidth": 120,
5+
"proseWrap": "always",
6+
"singleQuote": true,
7+
"trailingComma": "all",
8+
"sortImports": {
9+
"groups": [
10+
"type-import",
11+
["value-builtin", "value-external"],
12+
["type-internal", "value-internal"],
13+
["type-parent", "type-sibling", "type-index"],
14+
["value-parent", "value-sibling", "value-index"],
15+
"unknown"
16+
]
17+
},
18+
"ignorePatterns": [
19+
"test/react-native/versions/**",
20+
".github/workflows/*.yml"
21+
],
22+
"overrides": [
23+
{
24+
"files": ["*.md"],
25+
"options": {
26+
"proseWrap": "preserve"
27+
}
28+
}
29+
]
30+
}

.prettierignore

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

.prettierrc.json

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

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
// See http://go.microsoft.com/fwlink/?LinkId=827846
33
// for the documentation about the extensions.json format
4-
"recommendations": ["esbenp.prettier-vscode", "nickelpack.oxlint"]
4+
"recommendations": ["nickelpack.oxlint"]
55
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
"google-java-format": "^1.4.0",
3535
"lerna": "^8.1.8",
3636
"npm-run-all2": "^6.2.2",
37+
"oxfmt": "^0.42.0",
3738
"oxlint": "^1.56.0",
3839
"pmd-bin": "^2.5.0",
39-
"prettier": "^2.0.5",
4040
"react-native-version": "^4.0.0",
4141
"replace-in-file": "^7.0.1"
4242
},

packages/core/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
"test:tools": "npx jest --config jest.config.tools.js",
3838
"test:watch": "npx jest --watch",
3939
"yalc:add:sentry-javascript": "yalc add @sentry/browser @sentry/core @sentry/react @sentry/types",
40-
"fix": "npx run-s fix:oxlint fix:prettier",
40+
"fix": "npx run-s fix:oxlint fix:fmt",
4141
"fix:oxlint": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint --type-aware --tsconfig tsconfig.lint.json --fix",
42-
"fix:prettier": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --write \"{src,test,scripts,plugin/src}/**/**.ts\"",
43-
"lint": "npx run-s lint:oxlint lint:prettier",
42+
"fix:fmt": "oxfmt \"{src,test,scripts,plugin/src}/**/**.ts\" \"{src,test}/**/**.tsx\"",
43+
"lint": "npx run-s lint:oxlint lint:fmt",
4444
"lint:oxlint": "sh -c 'OUT=$(OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint --type-aware --tsconfig tsconfig.lint.json --deny-warnings 2>&1); echo \"$OUT\"; echo \"$OUT\" | grep -qE \"Found 0 warnings and 0 errors\"'",
45-
"lint:prettier": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --check \"{src,test,scripts,plugin/src}/**/**.ts\""
45+
"lint:fmt": "oxfmt --check \"{src,test,scripts,plugin/src}/**/**.ts\" \"{src,test}/**/**.tsx\""
4646
},
4747
"bin": {
4848
"sentry-eas-build-on-complete": "scripts/eas-build-hook.js",
@@ -105,9 +105,9 @@
105105
"jest-extended": "^4.0.2",
106106
"madge": "^6.1.0",
107107
"metro": "0.83.1",
108+
"oxfmt": "^0.42.0",
108109
"oxlint": "^1.56.0",
109110
"oxlint-tsgolint": "^0.17.4",
110-
"prettier": "^2.0.5",
111111
"react": "19.1.0",
112112
"react-native": "0.80.1",
113113
"react-test-renderer": "19.1.0",

packages/core/plugin/src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* oxlint-disable typescript-eslint(no-unsafe-member-access) */
33
import * as fs from 'fs';
44
import * as path from 'path';
5+
56
import { warnOnce } from './logger';
67

78
export function writeSentryPropertiesTo(filepath: string, sentryProperties: string): void {

packages/core/plugin/src/withSentry.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import type { ExpoConfig } from '@expo/config-types';
22
import type { ConfigPlugin } from 'expo/config-plugins';
3+
34
import { createRunOncePlugin, withDangerousMod } from 'expo/config-plugins';
5+
6+
import type { SentryAndroidGradlePluginOptions } from './withSentryAndroidGradlePlugin';
7+
48
import { bold, warnOnce } from './logger';
59
import { writeSentryOptions } from './utils';
610
import { PLUGIN_NAME, PLUGIN_VERSION } from './version';
711
import { withSentryAndroid } from './withSentryAndroid';
8-
import type { SentryAndroidGradlePluginOptions } from './withSentryAndroidGradlePlugin';
912
import { withSentryAndroidGradlePlugin } from './withSentryAndroidGradlePlugin';
1013
import { withSentryIOS } from './withSentryIOS';
1114

packages/core/plugin/src/withSentryAndroid.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { ExpoConfig } from '@expo/config-types';
22
import type { ConfigPlugin } from 'expo/config-plugins';
3+
34
import { withAppBuildGradle, withDangerousMod, withMainApplication } from 'expo/config-plugins';
45
import * as path from 'path';
6+
57
import { warnOnce } from './logger';
68
import { writeSentryPropertiesTo } from './utils';
79

packages/core/plugin/src/withSentryAndroidGradlePlugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { withAppBuildGradle, withProjectBuildGradle } from '@expo/config-plugins';
21
import type { ExpoConfig } from '@expo/config-types';
2+
3+
import { withAppBuildGradle, withProjectBuildGradle } from '@expo/config-plugins';
4+
35
import { warnOnce } from './logger';
46

57
export interface SentryAndroidGradlePluginOptions {

0 commit comments

Comments
 (0)