1+ /* eslint-disable @typescript-eslint/no-explicit-any */
12import { getCurrentHub , Hub } from '@sentry/browser' ;
23import { Integration , IntegrationClass , Span , Transaction } from '@sentry/types' ;
34import { timestampWithMs } from '@sentry/utils' ;
@@ -12,7 +13,7 @@ const TRACING_GETTER = ({
1213
1314let globalTracingIntegration : Integration | null = null ;
1415/** @deprecated remove when @sentry/apm no longer used */
15- const getTracingIntegration = ( ) => {
16+ const getTracingIntegration = ( ) : Integration | null => {
1617 if ( globalTracingIntegration ) {
1718 return globalTracingIntegration ;
1819 }
@@ -32,7 +33,6 @@ function pushActivity(name: string, op: string): number | null {
3233 return null ;
3334 }
3435
35- // tslint:disable-next-line:no-unsafe-any
3636 return ( globalTracingIntegration as any ) . constructor . pushActivity ( name , {
3737 description : `<${ name } >` ,
3838 op : `react.${ op } ` ,
@@ -50,7 +50,6 @@ function popActivity(activity: number | null): void {
5050 return ;
5151 }
5252
53- // tslint:disable-next-line:no-unsafe-any
5453 ( globalTracingIntegration as any ) . constructor . popActivity ( activity ) ;
5554}
5655
@@ -93,6 +92,7 @@ class Profiler extends React.Component<ProfilerProps> {
9392 // The span of the mount activity
9493 private _mountSpan : Span | undefined = undefined ;
9594
95+ // eslint-disable-next-line @typescript-eslint/member-ordering
9696 public static defaultProps : Partial < ProfilerProps > = {
9797 disabled : false ,
9898 includeRender : true ,
@@ -108,9 +108,9 @@ class Profiler extends React.Component<ProfilerProps> {
108108 }
109109
110110 // If they are using @sentry /apm, we need to push/pop activities
111- // tslint: disable-next-line: deprecation
111+ // eslint- disable-next-line deprecation/ deprecation
112112 if ( getTracingIntegration ( ) ) {
113- // tslint: disable-next-line: deprecation
113+ // eslint- disable-next-line deprecation/ deprecation
114114 this . _mountActivity = pushActivity ( name , 'mount' ) ;
115115 } else {
116116 const activeTransaction = getActiveTransaction ( ) ;
@@ -128,9 +128,9 @@ class Profiler extends React.Component<ProfilerProps> {
128128 if ( this . _mountSpan ) {
129129 this . _mountSpan . finish ( ) ;
130130 } else {
131- // tslint: disable-next-line: deprecation
131+ // eslint- disable-next-line deprecation/ deprecation
132132 this . _mountSpan = getActivitySpan ( this . _mountActivity ) ;
133- // tslint: disable-next-line: deprecation
133+ // eslint- disable-next-line deprecation/ deprecation
134134 popActivity ( this . _mountActivity ) ;
135135 this . _mountActivity = null ;
136136 }
@@ -191,7 +191,7 @@ class Profiler extends React.Component<ProfilerProps> {
191191 * @param WrappedComponent component that is wrapped by Profiler
192192 * @param options the {@link ProfilerProps} you can pass into the Profiler
193193 */
194- function withProfiler < P extends object > (
194+ function withProfiler < P extends Record < string , unknown > > (
195195 WrappedComponent : React . ComponentType < P > ,
196196 // We do not want to have `updateProps` given in options, it is instead filled through the HOC.
197197 options ?: Pick < Partial < ProfilerProps > , Exclude < keyof ProfilerProps , 'updateProps' > > ,
@@ -248,7 +248,7 @@ function useProfiler(
248248 mountSpan . finish ( ) ;
249249 }
250250
251- return ( ) => {
251+ return ( ) : void => {
252252 if ( mountSpan && options . hasRenderSpan ) {
253253 mountSpan . startChild ( {
254254 description : `<${ name } >` ,
@@ -258,6 +258,8 @@ function useProfiler(
258258 } ) ;
259259 }
260260 } ;
261+ // We only want this to run once.
262+ // eslint-disable-next-line react-hooks/exhaustive-deps
261263 } , [ ] ) ;
262264}
263265
0 commit comments