Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@
"detox@npm:20.46.0/ajv": "^8.18.0",
"@eslint/eslintrc@npm:2.1.4/ajv": "^6.14.0",
"@eslint/eslintrc@npm:3.3.3/ajv": "^6.14.0",
"eslint@npm:8.57.0/ajv": "^6.14.0",
"eslint@npm:8.57.1/ajv": "^6.14.0",
"eslint@npm:9.39.2/ajv": "^6.14.0",
"eslint@npm:9.39.4/ajv": "^6.14.0",
"express@npm:4.19.2/path-to-regexp": "0.1.12",
"@eslint/config-array@npm:0.21.1/minimatch": "^3.1.3",
"@eslint/eslintrc@npm:2.1.4/minimatch": "^3.1.3",
Expand All @@ -86,9 +84,7 @@
"eslint-plugin-node@npm:11.1.0/minimatch": "^3.1.3",
"eslint-plugin-react@npm:7.35.0/minimatch": "^3.1.3",
"eslint-plugin-react@npm:7.37.5/minimatch": "^3.1.3",
"eslint@npm:8.57.0/minimatch": "^3.1.3",
"eslint@npm:8.57.1/minimatch": "^3.1.3",
"eslint@npm:9.39.2/minimatch": "^3.1.3",
"eslint@npm:9.39.4/minimatch": "^3.1.3",
"glob@npm:6.0.4/minimatch": "^3.1.3",
"glob@npm:7.1.6/minimatch": "^3.1.3",
"glob@npm:7.2.3/minimatch": "^3.1.3",
Expand All @@ -110,9 +106,10 @@
"@sentry/node@npm:10.31.0/minimatch": "^9.0.7",
"@tufjs/models@npm:2.0.1/minimatch": "^9.0.7",
"@typescript-eslint/typescript-estree@npm:6.21.0/minimatch": "^9.0.7",
"@typescript-eslint/typescript-estree@npm:7.18.0/minimatch": "^9.0.7",
"@typescript-eslint/typescript-estree@npm:8.50.0/minimatch": "^9.0.7",
"@typescript-eslint/typescript-estree@npm:8.54.0/minimatch": "^9.0.7",
"@typescript-eslint/typescript-estree@npm:8.56.1/minimatch": "^9.0.7",
"@typescript-eslint/typescript-estree@npm:8.57.0/minimatch": "^9.0.7",
"editorconfig@npm:1.0.4/minimatch": "^9.0.7",
"glob@npm:10.4.1/minimatch": "^9.0.7",
"glob@npm:10.4.5/minimatch": "^9.0.7",
Expand All @@ -121,6 +118,9 @@
"nx@npm:19.6.4/minimatch": "^9.0.7",
"webdriverio@npm:8.40.5/minimatch": "^9.0.7",
"glob@npm:13.0.0/minimatch": "^10.2.3",
"@sentry-internal/eslint-config-sdk@npm:10.43.0/@typescript-eslint/eslint-plugin": "^8.0.0",
"@sentry-internal/eslint-config-sdk@npm:10.43.0/@typescript-eslint/parser": "^8.0.0",
"eslint-plugin-ft-flow": "^3.0.0",
"axios": "^1.13.5",
"fast-xml-parser": "^5.3.6",
"form-data": "4.0.5",
Expand Down
16 changes: 15 additions & 1 deletion packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,27 @@ module.exports = {
files: ['*.ts', '*.tsx'],
extends: ['plugin:react/recommended'],
plugins: ['react', 'react-native'],
parserOptions: {
project: './tsconfig.json',
},
rules: {
'@typescript-eslint/typedef': ['error', { arrowParameter: false, variableDeclarationIgnoreFunction: true }],
// @typescript-eslint/ban-types was removed in v8, replaced by more specific rules.
// no-empty-object-type was 'off' under ban-types, keep it off.
'@typescript-eslint/no-empty-object-type': 'off',
// no-explicit-any was 'warn' in v5 recommended, keep it as 'warn' (v8 defaults to 'error')
'@typescript-eslint/no-explicit-any': 'warn',
// Allow require() in React Native code (dynamic requires are a common RN pattern)
'@typescript-eslint/no-require-imports': 'off',
// In @typescript-eslint v8, caughtErrors defaults to 'all' (was 'none' in v5).
// The codebase commonly uses catch(e) {} without using the error variable.
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', caughtErrors: 'none' }],
},
},
{
// Test Files
files: ['*.test.ts', '*.test.tsx', '*.test.js', '*.test.jsx'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/unbound-method': 'off',
Expand All @@ -51,6 +63,8 @@ module.exports = {
},
rules: {
'no-console': 'off',
// In ESLint 9, no-unused-vars reports catch clause variables by default
'no-unused-vars': ['error', { argsIgnorePattern: '^_', caughtErrors: 'none' }],
},
},
{
Expand Down
10 changes: 5 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
"test:watch": "npx jest --watch",
"yalc:add:sentry-javascript": "yalc add @sentry/browser @sentry/core @sentry/react @sentry/types",
"fix": "npx run-s fix:eslint fix:prettier",
"fix:eslint": "eslint --config .eslintrc.js --fix .",
"fix:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint --config .eslintrc.js --fix .",
"fix:prettier": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --write \"{src,test,scripts,plugin/src}/**/**.ts\"",
"lint": "npx run-s lint:eslint lint:prettier",
"lint:eslint": "eslint --config .eslintrc.js .",
"lint:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint --config .eslintrc.js .",
"lint:prettier": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --check \"{src,test,scripts,plugin/src}/**/**.ts\""
},
"bin": {
Expand Down Expand Up @@ -95,13 +95,13 @@
"@types/uglify-js": "^3.17.2",
"@types/uuid": "^9.0.4",
"@types/xmlhttprequest": "^1.8.2",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"babel-jest": "^29.6.3",
"babel-plugin-module-resolver": "^5.0.0",
"babel-preset-fbjs": "^3.4.0",
"downlevel-dts": "^0.11.0",
"eslint": "^8.57.0",
"eslint": "^9.0.0",
"eslint-plugin-react": "^7.37.0",
"eslint-plugin-react-native": "^3.8.1",
"expo": "^53.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/plugin/src/withSentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const withSentryPlugin: ConfigPlugin<PluginProps | void> = (config, props) => {
warnOnce(`There was a problem with configuring your native Android project: ${e}`);
}
// if `enableAndroidGradlePlugin` is provided configure the Sentry Android Gradle Plugin
if (props?.experimental_android && props?.experimental_android?.enableAndroidGradlePlugin) {
if (props?.experimental_android?.enableAndroidGradlePlugin) {
try {
cfg = withSentryAndroidGradlePlugin(cfg, props.experimental_android);
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/js/integrations/debugsymbolicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ async function symbolicate(rawStack: string, skipFirstFrames: number = 0): Promi
: newStack;

const stackWithoutInternalCallsites = stackWithoutPoppedFrames.filter(
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- keep falsy check for empty string file paths
(frame: { file?: string }) => frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null,
);

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function isHardCrash(payload: EnvelopeItemPayload): boolean {
const values: Exception[] =
typeof payload !== 'string' && 'exception' in payload && payload.exception?.values ? payload.exception.values : [];
for (const exception of values) {
if (exception.mechanism && exception.mechanism.handled === false && exception.mechanism.type === 'onerror') {
if (exception.mechanism?.handled === false && exception.mechanism.type === 'onerror') {
return true;
}
}
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/js/tools/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@ export function prependModule(
module: Module<VirtualJSOutput>,
): Module<MixedOutput>[] {
const modifiedPreModules = [...modules];
if (
modifiedPreModules.length > 0 &&
modifiedPreModules[0] !== undefined &&
modifiedPreModules[0].path === PRELUDE_MODULE_PATH
) {
if (modifiedPreModules.length > 0 && modifiedPreModules[0]?.path === PRELUDE_MODULE_PATH) {
// prelude module must be first as it measures the bundle startup time
modifiedPreModules.unshift(modules[0] as Module<VirtualJSOutput>);
modifiedPreModules[1] = module;
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/js/tracing/integrations/nativeFrames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ export const nativeFramesIntegration = (): Integration => {
if (
event.type !== 'transaction' ||
!event.transaction ||
!event.contexts ||
!event.contexts.trace ||
!event.contexts?.trace ||
!event.timestamp ||
!event.contexts.trace.span_id
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const timeToDisplayIntegration = (): Integration => {
enableTimeToInitialDisplayForPreloadedRoutes =
getReactNavigationIntegration(client)?.options.enableTimeToInitialDisplayForPreloadedRoutes ?? false;
},
// eslint-disable-next-line complexity
processEvent: async event => {
if (event.type !== 'transaction') {
// TimeToDisplay data is only relevant for transactions
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/tracing/reactnativenavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const reactNativeNavigationIntegration = ({
}

// We ignore actions that pertain to the same screen.
const isSameComponent = prevComponentEvent && event.componentId === prevComponentEvent.componentId;
const isSameComponent = event.componentId === prevComponentEvent?.componentId;
if (isSameComponent) {
discardLatestNavigationSpan();
return;
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/js/tracing/reactnavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export const reactNavigationIntegration = ({
* @param unknownEvent - The event object that contains navigation action data
* @param isAppRestart - Whether this span is being started due to an app restart rather than a normal navigation action
*/
// eslint-disable-next-line complexity
const startIdleNavigationSpan = (unknownEvent?: unknown, isAppRestart = false): void => {
const event = unknownEvent as UnsafeAction | undefined;
if (useDispatchedActionData && event?.data.noop) {
Expand Down Expand Up @@ -414,6 +415,7 @@ export const reactNavigationIntegration = ({
/**
* To be called AFTER the state has been changed to populate the transaction with the current route.
*/
// eslint-disable-next-line complexity
const updateLatestNavigationSpanWithCurrentRoute = (): void => {
const stateChangedTimestamp = timestampInSeconds();
const previousRoute = latestRoute;
Expand All @@ -438,7 +440,7 @@ export const reactNavigationIntegration = ({

addTimeToInitialDisplayFallback(latestNavigationSpan.spanContext().spanId, NATIVE.getNewScreenTimeToDisplay());

if (previousRoute && previousRoute.key === route.key) {
if (previousRoute?.key === route.key) {
debug.log(`[${INTEGRATION_NAME}] Navigation state changed, but route is the same as previous.`);
pushRecentRouteKey(route.key);
latestRoute = route;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/utils/ignorerequirecyclelogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface ReactNativeVersion {
* This is a workaround for using fetch on RN, this is a known issue in react-native and only generates a warning.
*/
export function ignoreRequireCycleLogs(version?: ReactNativeVersion): void {
if (version && version.major === 0 && version.minor < 70) {
if (version?.major === 0 && version.minor < 70) {
// Do not ignore require cycle logs on React Native versions >= 0.70
// https://github.com/getsentry/sentry-react-native/issues/3484#issuecomment-1877034820
LogBox.ignoreLogs(['Require cycle:']);
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/js/utils/safe.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { debug } from '@sentry/core';
import type { ReactNativeOptions } from '../options';

type DangerTypesWithoutCallSignature =
// eslint-disable-next-line @typescript-eslint/ban-types
Object | null | undefined;
type DangerTypesWithoutCallSignature = object | null | undefined;

/**
* Returns callback factory wrapped with try/catch
Expand Down
4 changes: 1 addition & 3 deletions packages/core/test/tools/metroconfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,7 @@ describe('metroconfig', () => {
context.resolveRequest = resolver;
return resolver(context, `real${moduleName}`, platform, moduleName);
}
return (
metroConfig.resolver?.resolveRequest && metroConfig.resolver.resolveRequest(context, moduleName, platform)
);
return metroConfig.resolver?.resolveRequest?.(context, moduleName, platform);
}

function ExpectToBeCalledWithMetroParameters(
Expand Down
3 changes: 1 addition & 2 deletions packages/core/test/tracing/reactnavigation.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable deprecation/deprecation */
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { SentrySpan } from '@sentry/core';
import type { Event, Measurements, StartSpanOptions } from '@sentry/core';
import type { Event, Measurements, SentrySpan, StartSpanOptions } from '@sentry/core';
import {
getActiveSpan,
getCurrentScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ describe('SentryEventEmitterFallback', () => {
jest.useFakeTimers();

// Capture the callback passed to addListener
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-unsafe-function-type
let callback: Function = () => {};
const mockOnce = jest.fn().mockImplementationOnce((eventName, cb) => {
if (eventName === NewFrameEventName) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare global {
interface ObjectConstructor {
freeze<T>(o: T): Readonly<T>;

// eslint-disable-next-line @typescript-eslint/ban-types -- Matching TypeScript's official Object.freeze signature from lib.es5.d.ts
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- Matching TypeScript's official Object.freeze signature from lib.es5.d.ts
freeze<T extends Function>(f: T): T;

freeze<T extends {[idx: string]: U | null | undefined | object}, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>;
Expand Down
4 changes: 2 additions & 2 deletions performance-tests/TestAppPlain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
"@react-native-community/cli-platform-android": "19.1.1",
"@react-native-community/cli-platform-ios": "19.1.1",
"@react-native/babel-preset": "0.80.2",
"@react-native/eslint-config": "0.80.2",
"@react-native/eslint-config": "0.84.1",
"@react-native/metro-config": "0.80.2",
"@react-native/typescript-config": "0.80.2",
"@types/jest": "^29.5.13",
"@types/react": "^19.1.0",
"@types/react-test-renderer": "^19.1.0",
"eslint": "^8.19.0",
"eslint": "^9.0.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "19.1.0",
Expand Down
4 changes: 2 additions & 2 deletions performance-tests/TestAppSentry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
"@react-native-community/cli-platform-android": "19.1.1",
"@react-native-community/cli-platform-ios": "19.1.1",
"@react-native/babel-preset": "0.80.2",
"@react-native/eslint-config": "0.80.2",
"@react-native/eslint-config": "0.84.1",
"@react-native/metro-config": "0.80.2",
"@react-native/typescript-config": "0.80.2",
"@types/jest": "^29.5.13",
"@types/react": "^19.1.0",
"@types/react-test-renderer": "^19.1.0",
"eslint": "^8.19.0",
"eslint": "^9.0.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "19.1.0",
Expand Down
8 changes: 4 additions & 4 deletions samples/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"android": "expo run:android",
"ios": "expo run:ios",
"ts:check": "tsc",
"lint": "npx eslint . --ext .js,.jsx,.ts,.tsx",
"fix": "npx eslint . --ext .js,.jsx,.ts,.tsx --fix && prettier --write \"**/*.{js,jsx,ts,tsx,json}\"",
"lint": "ESLINT_USE_FLAT_CONFIG=false npx eslint . --ext .js,.jsx,.ts,.tsx",
"fix": "ESLINT_USE_FLAT_CONFIG=false npx eslint . --ext .js,.jsx,.ts,.tsx --fix && prettier --write \"**/*.{js,jsx,ts,tsx,json}\"",
"export": "expo export --source-maps --clear --platform all",
"export:web": "expo export --source-maps --clear --platform web",
"prebuild": "expo prebuild --clean --no-install",
Expand Down Expand Up @@ -47,12 +47,12 @@
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@react-native/eslint-config": "0.83.2",
"@react-native/eslint-config": "0.84.1",
"@sentry/babel-plugin-component-annotate": "5.1.1",
"@types/node": "20.10.4",
"@typescript-eslint/eslint-plugin": "^8.50.0",
"@typescript-eslint/parser": "^8.50.0",
"eslint": "^8.57.0",
"eslint": "^9.0.0",
"eslint-config-expo": "~55.0.0",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
Expand Down
2 changes: 2 additions & 0 deletions samples/react-native-macos/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module.exports = {
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/no-shadow': ['error'],
// In @typescript-eslint v8, caughtErrors defaults to 'all' (was 'none' in v5).
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', caughtErrors: 'none' }],
'no-shadow': 'off',
'no-undef': 'off',
quotes: [2, 'single', { avoidEscape: true }],
Expand Down
13 changes: 7 additions & 6 deletions samples/react-native-macos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"scripts": {
"start": "react-native start --experimental-debugger",
"lint": "npx eslint . --ext .js,.jsx,.ts,.tsx",
"fix": "npx eslint . --ext .js,.jsx,.ts,.tsx --fix",
"lint": "ESLINT_USE_FLAT_CONFIG=false npx eslint . --ext .js,.jsx,.ts,.tsx",
"fix": "ESLINT_USE_FLAT_CONFIG=false npx eslint . --ext .js,.jsx,.ts,.tsx --fix",
"type-check": "tsc --noEmit",
"pod-install-legacy": "cd macos; bundle exec pod install; cd ..",
"pod-install-legacy-production": "cd macos; PRODUCTION=1 bundle exec pod install; cd ..",
Expand Down Expand Up @@ -37,15 +37,16 @@
"@babel/preset-env": "^7.22.5",
"@babel/runtime": "^7.22.5",
"@react-native/babel-preset": "0.73.21",
"@react-native/eslint-config": "0.73.2",
"@react-native/eslint-config": "0.84.1",
"@react-native/metro-config": "0.73.5",
"@react-native/typescript-config": "0.73.1",
"@types/react": "^18.2.65",
"@types/react-native-vector-icons": "^6.4.18",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"babel-plugin-module-resolver": "^5.0.0",
"eslint": "^8.19.0",
"eslint": "^9.0.0",
"eslint-plugin-jest": "^29.0.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"sentry-react-native-samples-utils": "workspace:^",
Expand Down
2 changes: 2 additions & 0 deletions samples/react-native/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module.exports = {
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/no-shadow': ['error'],
// In @typescript-eslint v8, caughtErrors defaults to 'all' (was 'none' in v5).
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', caughtErrors: 'none' }],
'no-shadow': 'off',
'no-undef': 'off',
quotes: [2, 'single', { avoidEscape: true }],
Expand Down
Loading
Loading