Skip to content

Commit 0d4228b

Browse files
antonisclaude
andauthored
chore: Migrate from ESLint to oxlint (#5867)
* chore(core): Migrate from ESLint to oxlint --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b287e72 commit 0d4228b

File tree

103 files changed

+681
-2805
lines changed

Some content is hidden

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

103 files changed

+681
-2805
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ updates:
1313
react-native-deps:
1414
patterns:
1515
- '@react-native/*'
16-
typescript-eslint-deps:
16+
oxlint:
1717
patterns:
18-
- '@typescript-eslint/*'
18+
- 'oxlint'
1919
ignore:
2020
- dependency-name: '@sentry*'
2121
- package-ecosystem: gradle

.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", "dbaeumer.vscode-eslint"]
4+
"recommendations": ["esbenp.prettier-vscode", "nickelpack.oxlint"]
55
}

package.json

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"google-java-format": "^1.4.0",
3535
"lerna": "^8.1.8",
3636
"npm-run-all2": "^6.2.2",
37+
"oxlint": "^1.56.0",
3738
"pmd-bin": "^2.5.0",
3839
"prettier": "^2.0.5",
3940
"react-native-version": "^4.0.0",
@@ -66,18 +67,8 @@
6667
"front-matter@npm:4.0.2/js-yaml": "^3.14.2",
6768
"js-yaml": "^4.1.1",
6869
"detox@npm:20.46.0/ajv": "^8.18.0",
69-
"@eslint/eslintrc@npm:3.3.3/ajv": "^6.14.0",
70-
"eslint@npm:9.39.4/ajv": "^6.14.0",
71-
"@eslint/config-array@npm:0.21.1/minimatch": "^3.1.3",
72-
"@eslint/eslintrc@npm:3.3.3/minimatch": "^3.1.3",
7370
"@expo/fingerprint@npm:0.6.1/minimatch": "^3.1.3",
7471
"@lerna/create@npm:8.1.8/minimatch": "^3.1.3",
75-
"eslint-plugin-import@npm:2.31.0/minimatch": "^3.1.3",
76-
"eslint-plugin-import@npm:2.32.0/minimatch": "^3.1.3",
77-
"eslint-plugin-node@npm:11.1.0/minimatch": "^3.1.3",
78-
"eslint-plugin-react@npm:7.35.0/minimatch": "^3.1.3",
79-
"eslint-plugin-react@npm:7.37.5/minimatch": "^3.1.3",
80-
"eslint@npm:9.39.4/minimatch": "^3.1.3",
8172
"glob@npm:6.0.4/minimatch": "^3.1.3",
8273
"glob@npm:7.1.6/minimatch": "^3.1.3",
8374
"glob@npm:7.2.3/minimatch": "^3.1.3",
@@ -99,20 +90,13 @@
9990
"@sentry/node@npm:10.31.0/minimatch": "^9.0.7",
10091
"@tufjs/models@npm:2.0.1/minimatch": "^9.0.7",
10192
"@typescript-eslint/typescript-estree@npm:6.21.0/minimatch": "^9.0.7",
102-
"@typescript-eslint/typescript-estree@npm:8.50.0/minimatch": "^9.0.7",
103-
"@typescript-eslint/typescript-estree@npm:8.54.0/minimatch": "^9.0.7",
104-
"@typescript-eslint/typescript-estree@npm:8.56.1/minimatch": "^9.0.7",
105-
"@typescript-eslint/typescript-estree@npm:8.57.0/minimatch": "^9.0.7",
10693
"editorconfig@npm:1.0.4/minimatch": "^9.0.7",
10794
"glob@npm:10.4.5/minimatch": "^9.0.7",
10895
"ignore-walk@npm:6.0.5/minimatch": "^9.0.7",
10996
"npm-run-all2@npm:6.2.2/minimatch": "^9.0.7",
11097
"nx@npm:19.6.4/minimatch": "^9.0.7",
11198
"webdriverio@npm:8.40.5/minimatch": "^9.0.7",
11299
"glob@npm:13.0.0/minimatch": "^10.2.3",
113-
"@sentry-internal/eslint-config-sdk@npm:10.46.0/@typescript-eslint/eslint-plugin": "^8.0.0",
114-
"@sentry-internal/eslint-config-sdk@npm:10.46.0/@typescript-eslint/parser": "^8.0.0",
115-
"eslint-plugin-ft-flow": "^3.0.0",
116100
"axios": "^1.13.5",
117101
"fast-xml-parser": "^5.5.7",
118102
"form-data": "4.0.5",

packages/core/.eslintignore

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

packages/core/.eslintrc.js

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

packages/core/.oxlintrc.json

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["typescript", "react", "import", "jsdoc"],
4+
"jsPlugins": [
5+
{
6+
"name": "sdk",
7+
"specifier": "@sentry-internal/eslint-plugin-sdk"
8+
}
9+
],
10+
"categories": {},
11+
"rules": {
12+
"no-unused-vars": [
13+
"warn",
14+
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" }
15+
],
16+
17+
// === Base rules (ported from @sentry-internal/eslint-config-sdk) ===
18+
"no-console": "error",
19+
"no-alert": "error",
20+
"no-param-reassign": "error",
21+
"prefer-template": "error",
22+
"no-bitwise": "error",
23+
"complexity": "error",
24+
"no-unused-expressions": ["error", { "allowShortCircuit": true }],
25+
"guard-for-in": "error",
26+
"array-callback-return": ["error", { "allowImplicit": true }],
27+
"quotes": ["error", "single", { "avoidEscape": true }],
28+
"no-return-await": "error",
29+
"max-lines": ["error", { "max": 300, "skipComments": true, "skipBlankLines": true }],
30+
31+
// === Import rules ===
32+
"import/namespace": "off",
33+
"import/no-unresolved": "off",
34+
35+
// === Rules turned off (not needed or causing false positives) ===
36+
"no-control-regex": "off",
37+
"jsdoc/check-tag-names": "off",
38+
"jsdoc/require-yields": "off",
39+
"no-shadow": "off",
40+
"no-unsafe-optional-chaining": "off",
41+
// Not in original ESLint config — auto-enabled by --type-aware, produces false positives on mocked functions
42+
"typescript/await-thenable": "off",
43+
44+
// === Custom SDK rules (via JS plugin) ===
45+
"sdk/no-eq-empty": "error"
46+
},
47+
"overrides": [
48+
{
49+
"files": ["**/*.ts", "**/*.tsx", "**/*.d.ts"],
50+
"rules": {
51+
"typescript/ban-ts-comment": "error",
52+
"typescript/consistent-type-imports": "error",
53+
"typescript/no-unnecessary-type-assertion": "error",
54+
"typescript/prefer-for-of": "error",
55+
"typescript/explicit-function-return-type": ["error", { "allowExpressions": true }],
56+
"typescript/no-floating-promises": ["error", { "ignoreVoid": false }],
57+
"typescript/no-dynamic-delete": "error",
58+
"typescript/unified-signatures": "error",
59+
"typescript/no-unsafe-member-access": "error",
60+
"typescript/unbound-method": "error",
61+
"typescript/no-explicit-any": "warn",
62+
"typescript/no-empty-function": "off",
63+
"typescript/no-empty-object-type": "off",
64+
"typescript/no-require-imports": "off",
65+
"typescript/prefer-optional-chain": "error",
66+
"typescript/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "caughtErrors": "none" }],
67+
"typescript/no-redundant-type-constituents": "off",
68+
"typescript/restrict-template-expressions": "off",
69+
"typescript/no-base-to-string": "off"
70+
}
71+
},
72+
{
73+
"files": ["**/*.js", "**/*.mjs", "**/*.cjs"],
74+
"rules": {
75+
"typescript/ban-ts-comment": "off",
76+
"typescript/consistent-type-imports": "off",
77+
"typescript/prefer-optional-chain": "off",
78+
"typescript/no-unnecessary-type-assertion": "off",
79+
"typescript/prefer-for-of": "off",
80+
"typescript/no-floating-promises": "off",
81+
"typescript/no-dynamic-delete": "off",
82+
"typescript/no-unsafe-member-access": "off",
83+
"typescript/unbound-method": "off",
84+
"typescript/no-explicit-any": "off",
85+
"typescript/explicit-function-return-type": "off"
86+
}
87+
},
88+
{
89+
"files": [
90+
"**/*.test.ts",
91+
"**/*.test.tsx",
92+
"**/*.test.js",
93+
"**/*.test.jsx",
94+
"test/**/*.ts",
95+
"test/**/*.js"
96+
],
97+
"rules": {
98+
"typescript/explicit-function-return-type": "off",
99+
"typescript/no-empty-function": "off",
100+
"typescript/no-explicit-any": "off",
101+
"typescript/no-unsafe-member-access": "off",
102+
"typescript/no-floating-promises": "off",
103+
"typescript/no-non-null-assertion": "off",
104+
"typescript/unbound-method": "off",
105+
"no-unused-expressions": "off",
106+
"typescript/no-unused-expressions": "off",
107+
"max-lines": "off",
108+
"complexity": "off",
109+
"import/first": "off",
110+
"typescript/prefer-optional-chain": "off",
111+
"typescript/no-misused-spread": "off",
112+
"sdk/no-focused-tests": "error",
113+
"sdk/no-skipped-tests": "error"
114+
}
115+
},
116+
{
117+
"files": ["**/*.tsx"],
118+
"rules": {
119+
"jsdoc/require-jsdoc": "off"
120+
}
121+
},
122+
{
123+
"files": ["scripts/*"],
124+
"rules": {
125+
"no-console": "off"
126+
}
127+
},
128+
{
129+
"files": ["**/src/**"],
130+
"rules": {
131+
"no-restricted-globals": ["error", "window", "document", "location", "navigator"],
132+
// Bundle size isn't a concern for React Native
133+
"sdk/no-class-field-initializers": "off",
134+
// TODO: Re-enable once oxlint supports inline disable for jsPlugin rules
135+
// Only 2 intentional uses exist (debugsymbolicator.ts, sentryMetroSerializer.ts)
136+
"sdk/no-regexp-constructor": "off"
137+
}
138+
}
139+
],
140+
"ignorePatterns": [
141+
"dist/**",
142+
"dangerfile.js",
143+
"RNSentryAndroidTester/**",
144+
"test/react-native/versions/**",
145+
"coverage/**",
146+
"test/typescript/**",
147+
"metro.d.ts",
148+
"plugin/build/**",
149+
"expo.d.ts",
150+
"playground.js",
151+
"playground.d.ts",
152+
"node_modules/**"
153+
]
154+
}

packages/core/package.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
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:eslint fix:prettier",
41-
"fix:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint --config .eslintrc.js --fix .",
40+
"fix": "npx run-s fix:oxlint fix:prettier",
41+
"fix:oxlint": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint --type-aware --tsconfig tsconfig.lint.json --fix",
4242
"fix:prettier": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --write \"{src,test,scripts,plugin/src}/**/**.ts\"",
43-
"lint": "npx run-s lint:eslint lint:prettier",
44-
"lint:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint --config .eslintrc.js .",
43+
"lint": "npx run-s lint:oxlint lint:prettier",
44+
"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\"'",
4545
"lint:prettier": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --check \"{src,test,scripts,plugin/src}/**/**.ts\""
4646
},
4747
"bin": {
@@ -83,7 +83,6 @@
8383
"@expo/metro-config": "~0.20.0",
8484
"@mswjs/interceptors": "^0.25.15",
8585
"@react-native/babel-preset": "0.80.0",
86-
"@sentry-internal/eslint-config-sdk": "10.46.0",
8786
"@sentry-internal/eslint-plugin-sdk": "10.46.0",
8887
"@sentry-internal/typescript": "10.46.0",
8988
"@sentry/wizard": "6.12.0",
@@ -95,22 +94,19 @@
9594
"@types/uglify-js": "^3.17.2",
9695
"@types/uuid": "^9.0.4",
9796
"@types/xmlhttprequest": "^1.8.2",
98-
"@typescript-eslint/eslint-plugin": "^8.0.0",
99-
"@typescript-eslint/parser": "^8.0.0",
10097
"babel-jest": "^29.6.3",
10198
"babel-plugin-module-resolver": "^5.0.0",
10299
"babel-preset-fbjs": "^3.4.0",
103100
"downlevel-dts": "^0.11.0",
104-
"eslint": "^9.0.0",
105-
"eslint-plugin-react": "^7.37.0",
106-
"eslint-plugin-react-native": "^3.8.1",
107101
"expo": "^53.0.0",
108102
"expo-module-scripts": "3.1.0",
109103
"jest": "^29.6.3",
110104
"jest-environment-jsdom": "^29.6.2",
111105
"jest-extended": "^4.0.2",
112106
"madge": "^6.1.0",
113107
"metro": "0.83.1",
108+
"oxlint": "^1.56.0",
109+
"oxlint-tsgolint": "^0.17.4",
114110
"prettier": "^2.0.5",
115111
"react": "19.1.0",
116112
"react-native": "0.80.1",

packages/core/plugin/src/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const warningMap = new Map<string, boolean>();
77
export function warnOnce(message: string): void {
88
if (!warningMap.has(message)) {
99
warningMap.set(message, true);
10-
// eslint-disable-next-line no-console
10+
// oxlint-disable-next-line eslint(no-console), typescript-eslint(no-unsafe-member-access)
1111
console.warn(yellow(prefix(message)));
1212
}
1313
}

packages/core/plugin/src/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// tsgolint incorrectly types `fs` as `error` — false positive with DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS
2+
/* oxlint-disable typescript-eslint(no-unsafe-member-access) */
13
import * as fs from 'fs';
24
import * as path from 'path';
35
import { warnOnce } from './logger';

packages/core/plugin/src/version.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const packageJson: {
22
name: string;
33
version: string;
4-
// eslint-disable-next-line @typescript-eslint/no-var-requires
54
} = require('../../package.json');
65

76
export const PLUGIN_NAME = `${packageJson.name}/expo`;

0 commit comments

Comments
 (0)