Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sdk-trace-web): fix lint warnings #2451

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class StackContextManager implements ContextManager {
* @param context
* @param target Function to be executed within the context
*/
// eslint-disable-next-line @typescript-eslint/ban-types
private _bindFunction<T extends Function>(
context = ROOT_CONTEXT,
target: T
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class WebTracerProvider extends BasicTracerProvider {
*
* @param config Configuration object for SDK registration
*/
override register(config: SDKRegistrationConfig = {}) {
override register(config: SDKRegistrationConfig = {}): void {
if (config.contextManager === undefined) {
config.contextManager = new StackContextManager();
}
Expand Down
18 changes: 9 additions & 9 deletions packages/opentelemetry-sdk-trace-web/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ export function addSpanNetworkEvents(
* sort resources by startTime
* @param filteredResources
*/
export function sortResources(filteredResources: PerformanceResourceTiming[]) {
return filteredResources.slice().sort((a, b) => {
const valueA = a[PTN.FETCH_START];
const valueB = b[PTN.FETCH_START];
export function sortResources(filteredResources: PerformanceResourceTiming[]): PerformanceResourceTiming[] {
return filteredResources.slice().sort((x, y) => {
const valueA = x[PTN.FETCH_START];
dyladan marked this conversation as resolved.
Show resolved Hide resolved
const valueB = y[PTN.FETCH_START];
if (valueA > valueB) {
return 1;
} else if (valueA < valueB) {
Expand Down Expand Up @@ -284,9 +284,9 @@ function filterResourcesForSpan(
* @param url
*/
export function parseUrl(url: string): HTMLAnchorElement {
const a = document.createElement('a');
a.href = url;
return a;
const element = document.createElement('a');
element.href = url;
return element;
}

/**
Expand All @@ -296,7 +296,7 @@ export function parseUrl(url: string): HTMLAnchorElement {
* simplified to contain id
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function getElementXPath(target: any, optimised?: boolean) {
export function getElementXPath(target: any, optimised?: boolean): string {
dyladan marked this conversation as resolved.
Show resolved Hide resolved
if (target.nodeType === Node.DOCUMENT_NODE) {
return '/';
}
Expand Down Expand Up @@ -380,7 +380,7 @@ function getNodeValue(target: HTMLElement, optimised?: boolean): string {
export function shouldPropagateTraceHeaders(
spanUrl: string,
propagateTraceHeaderCorsUrls?: PropagateTraceHeaderCorsUrls
) {
): boolean {
let propagateTraceHeaderUrls = propagateTraceHeaderCorsUrls || [];
if (
typeof propagateTraceHeaderUrls === 'string' ||
Expand Down