From d807bbcb70b9d188b721259f2d79b78c890e98e6 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Thu, 4 Jul 2024 16:04:06 +0300 Subject: [PATCH] fix prettier and lint issues --- .eslintrc.js | 2 +- .prettierrc.json | 1 + src/instrumentations/external/sequelize/sequelize.ts | 1 + src/instrumentations/external/typeorm/typeorm.ts | 2 ++ src/instrumentations/http.ts | 1 - src/tracing/index.ts | 1 + src/tracing/options.ts | 1 - src/utils.ts | 3 +++ 8 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4db88a85..de589831 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -35,7 +35,7 @@ module.exports = { "singleQuote": true, "arrowParens": "always" }], - "node/no-deprecated-api": ["warn"], + "n/no-deprecated-api": ["warn"], "header/header": [2, "block", [ "", " * Copyright Splunk Inc.", diff --git a/.prettierrc.json b/.prettierrc.json index 2bcad54d..39c8be7b 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,4 +1,5 @@ { "arrowParens": "always", + "trailingComma": "es5", "singleQuote": true } diff --git a/src/instrumentations/external/sequelize/sequelize.ts b/src/instrumentations/external/sequelize/sequelize.ts index 4586d382..6e9f5948 100644 --- a/src/instrumentations/external/sequelize/sequelize.ts +++ b/src/instrumentations/external/sequelize/sequelize.ts @@ -167,6 +167,7 @@ export class SequelizeInstrumentation extends InstrumentationBase { else tableName = extractTableFromQuery(statement); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any const attributes: Record = { [SemanticAttributes.DB_SYSTEM]: sequelizeInstance.getDialect(), [SemanticAttributes.DB_USER]: config?.username, diff --git a/src/instrumentations/external/typeorm/typeorm.ts b/src/instrumentations/external/typeorm/typeorm.ts index d37daac5..0e2e1254 100644 --- a/src/instrumentations/external/typeorm/typeorm.ts +++ b/src/instrumentations/external/typeorm/typeorm.ts @@ -216,6 +216,7 @@ export class TypeormInstrumentation extends InstrumentationBase { return original.apply(this, args); } const connectionOptions = this?.connection?.options ?? {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any const attributes: Record = { [SemanticAttributes.DB_SYSTEM]: connectionOptions.type, [SemanticAttributes.DB_USER]: connectionOptions.username, @@ -294,6 +295,7 @@ export class TypeormInstrumentation extends InstrumentationBase { const operation = this.expressionMap.queryType; // eslint-disable-next-line @typescript-eslint/no-explicit-any const connectionOptions: any = this.connection?.options; + // eslint-disable-next-line @typescript-eslint/no-explicit-any const attributes: Record = { [SemanticAttributes.DB_SYSTEM]: connectionOptions.type, [SemanticAttributes.DB_USER]: connectionOptions.username, diff --git a/src/instrumentations/http.ts b/src/instrumentations/http.ts index 33c3392c..df3d231b 100644 --- a/src/instrumentations/http.ts +++ b/src/instrumentations/http.ts @@ -45,7 +45,6 @@ function parseUrlParams(request: IncomingMessage) { try { // As long as Node <11 is supported, need to use the legacy API. - // eslint-disable-next-line node/no-deprecated-api return Url.parse(request.url || '', true).query; } catch (err) { diag.debug(`error parsing url '${request.url}`, err); diff --git a/src/tracing/index.ts b/src/tracing/index.ts index c692ba60..8c3b0f50 100644 --- a/src/tracing/index.ts +++ b/src/tracing/index.ts @@ -187,6 +187,7 @@ interface ShutDownableTracerProvider extends TracerProvider { function isShutDownable( tracerProvider: TracerProvider ): tracerProvider is ShutDownableTracerProvider { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return typeof (tracerProvider as any).shutdown === 'function'; } diff --git a/src/tracing/options.ts b/src/tracing/options.ts index 69aeaf5c..fbbdc3e2 100644 --- a/src/tracing/options.ts +++ b/src/tracing/options.ts @@ -24,7 +24,6 @@ import { B3Propagator, B3InjectEncoding } from '@opentelemetry/propagator-b3'; import { getInstrumentations } from '../instrumentations'; import { OTLPTraceExporter as OTLPHttpTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto'; -// eslint-disable-next-line node/no-extraneous-import import type * as OtlpGrpc from '@opentelemetry/exporter-trace-otlp-grpc'; import type * as grpc from '@grpc/grpc-js'; import { detect as detectResource } from '../resource'; diff --git a/src/utils.ts b/src/utils.ts index 60aad97a..9a3072cb 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -154,6 +154,7 @@ const formatStringSet = (set: Set | string[]) => { }; export function assertNoExtraneousProperties( + // eslint-disable-next-line @typescript-eslint/no-explicit-any obj: Record, expectedProps: string[] ) { @@ -206,10 +207,12 @@ export function parseLogLevel(value: string | undefined): DiagLogLevel { return DiagLogLevel.NONE; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any export function pick, K extends string>( obj: T, keys: readonly K[] ): { [P in keyof T as P extends K ? P : never]: T[P] } { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const result = {} as any; for (let i = 0; i < keys.length; i++) { const key = keys[i];