@@ -29,13 +29,13 @@ import {
29
29
import { SemanticAttributes } from '@opentelemetry/semantic-conventions' ;
30
30
31
31
// Used to normalize relative URLs
32
- let a : HTMLAnchorElement | undefined ;
32
+ let urlNormalizingAnchor : HTMLAnchorElement | undefined ;
33
33
export function getUrlNormalizingAnchor ( ) : HTMLAnchorElement {
34
- if ( ! a ) {
35
- a = document . createElement ( 'a' ) ;
34
+ if ( ! urlNormalizingAnchor ) {
35
+ urlNormalizingAnchor = document . createElement ( 'a' ) ;
36
36
}
37
37
38
- return a ;
38
+ return urlNormalizingAnchor ;
39
39
}
40
40
41
41
/**
@@ -108,7 +108,7 @@ export function addSpanNetworkEvents(
108
108
* sort resources by startTime
109
109
* @param filteredResources
110
110
*/
111
- export function sortResources ( filteredResources : PerformanceResourceTiming [ ] ) {
111
+ export function sortResources ( filteredResources : PerformanceResourceTiming [ ] ) : PerformanceResourceTiming [ ] {
112
112
return filteredResources . slice ( ) . sort ( ( a , b ) => {
113
113
const valueA = a [ PTN . FETCH_START ] ;
114
114
const valueB = b [ PTN . FETCH_START ] ;
@@ -284,9 +284,9 @@ function filterResourcesForSpan(
284
284
* @param url
285
285
*/
286
286
export function parseUrl ( url : string ) : HTMLAnchorElement {
287
- const a = document . createElement ( 'a' ) ;
288
- a . href = url ;
289
- return a ;
287
+ const element = document . createElement ( 'a' ) ;
288
+ element . href = url ;
289
+ return element ;
290
290
}
291
291
292
292
/**
@@ -295,8 +295,8 @@ export function parseUrl(url: string): HTMLAnchorElement {
295
295
* @param optimised - when id attribute of element is present the xpath can be
296
296
* simplified to contain id
297
297
*/
298
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
299
- export function getElementXPath ( target : any , optimised ?: boolean ) {
298
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
299
+ export function getElementXPath ( target : any , optimised ?: boolean ) : string {
300
300
if ( target . nodeType === Node . DOCUMENT_NODE ) {
301
301
return '/' ;
302
302
}
@@ -380,7 +380,7 @@ function getNodeValue(target: HTMLElement, optimised?: boolean): string {
380
380
export function shouldPropagateTraceHeaders (
381
381
spanUrl : string ,
382
382
propagateTraceHeaderCorsUrls ?: PropagateTraceHeaderCorsUrls
383
- ) {
383
+ ) : boolean {
384
384
let propagateTraceHeaderUrls = propagateTraceHeaderCorsUrls || [ ] ;
385
385
if (
386
386
typeof propagateTraceHeaderUrls === 'string' ||
0 commit comments