diff --git a/eslint.config.js b/eslint.config.js index a1514132f9..c78e7b660d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -10,6 +10,7 @@ module.exports = { "project": "./tsconfig.json" }, rules: { + "quotes": [2, "single", { "avoidEscape": true }], "@typescript-eslint/no-floating-promises": 2, "@typescript-eslint/no-this-alias": "off", "brace-style": ["error", "1tbs"], diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts b/packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts index 0c14f0063b..1ddac9722d 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts @@ -26,7 +26,7 @@ import { ServiceClientType, } from './types'; import { ServiceClient } from './types'; -import { getEnv, baggageUtils } from "@opentelemetry/core"; +import { getEnv, baggageUtils } from '@opentelemetry/core'; /** * Collector Metric Exporter abstract base class diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts index c909241a73..e1c84942cf 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts @@ -23,7 +23,7 @@ import { CollectorExporterConfigNode, ServiceClientType } from './types'; import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; import { baggageUtils, getEnv } from '@opentelemetry/core'; import { validateAndNormalizeUrl } from './util'; -import { Metadata } from "@grpc/grpc-js"; +import { Metadata } from '@grpc/grpc-js'; const DEFAULT_COLLECTOR_URL = 'localhost:4317'; diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts index f0b63cbb79..cfb147fa39 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts @@ -23,7 +23,7 @@ import { import { CollectorExporterConfigNode, ServiceClientType } from './types'; import { baggageUtils, getEnv } from '@opentelemetry/core'; import { validateAndNormalizeUrl } from './util'; -import { Metadata } from "@grpc/grpc-js"; +import { Metadata } from '@grpc/grpc-js'; const DEFAULT_COLLECTOR_URL = 'localhost:4317'; diff --git a/packages/opentelemetry-exporter-collector-grpc/test/helper.ts b/packages/opentelemetry-exporter-collector-grpc/test/helper.ts index 6e66e5a866..b9346c92d0 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/helper.ts +++ b/packages/opentelemetry-exporter-collector-grpc/test/helper.ts @@ -410,31 +410,31 @@ export function ensureResourceIsCorrect( assert.deepStrictEqual(resource, { attributes: [ { - "key": "service.name", - "value": { - "stringValue": `unknown_service:${process.argv0}`, - "value": "stringValue" + 'key': 'service.name', + 'value': { + 'stringValue': `unknown_service:${process.argv0}`, + 'value': 'stringValue' } }, { - "key": "telemetry.sdk.language", - "value": { - "stringValue": "nodejs", - "value": "stringValue" + 'key': 'telemetry.sdk.language', + 'value': { + 'stringValue': 'nodejs', + 'value': 'stringValue' } }, { - "key": "telemetry.sdk.name", - "value": { - "stringValue": "opentelemetry", - "value": "stringValue" + 'key': 'telemetry.sdk.name', + 'value': { + 'stringValue': 'opentelemetry', + 'value': 'stringValue' } }, { - "key": "telemetry.sdk.version", - "value": { - "stringValue": VERSION, - "value": "stringValue" + 'key': 'telemetry.sdk.version', + 'value': { + 'stringValue': VERSION, + 'value': 'stringValue' } }, { diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index 335767366d..f6514fadd7 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -156,7 +156,7 @@ export class JaegerExporter implements SpanExporter { } const serviceNameTag = span.tags.find(t => t.key === ResourceAttributes.SERVICE_NAME) - const serviceName = serviceNameTag?.vStr || "unknown_service"; + const serviceName = serviceNameTag?.vStr || 'unknown_service'; sender.setProcess({ serviceName, diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts index 0766e5a72a..b18ea08d36 100644 --- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts +++ b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts @@ -93,8 +93,8 @@ describe('JaegerExporter', () => { const process: ThriftProcess = exporter['_getSender']({ tags: [{ - key: "service.name", - vStr: "opentelemetry" + key: 'service.name', + vStr: 'opentelemetry' }] } as any)._process; assert.strictEqual(exporter['_sender']._host, 'remotehost'); @@ -109,8 +109,8 @@ describe('JaegerExporter', () => { const exporter = new JaegerExporter(); const sender = exporter['_getSender']({ tags: [{ - key: "service.name", - vStr: "opentelemetry" + key: 'service.name', + vStr: 'opentelemetry' }] } as any); assert.strictEqual(sender._host, 'localhost'); @@ -121,8 +121,8 @@ describe('JaegerExporter', () => { const exporter = new JaegerExporter(); const sender = exporter['_getSender']({ tags: [{ - key: "service.name", - vStr: "opentelemetry" + key: 'service.name', + vStr: 'opentelemetry' }] } as any); assert.strictEqual(sender._host, 'env-set-host'); @@ -135,8 +135,8 @@ describe('JaegerExporter', () => { }); const sender = exporter['_getSender']({ tags: [{ - key: "service.name", - vStr: "opentelemetry" + key: 'service.name', + vStr: 'opentelemetry' }] } as any); assert.strictEqual(sender._host, 'option-set-host'); diff --git a/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts b/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts index 181eb12c0e..c378f83fe6 100644 --- a/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts +++ b/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts @@ -22,7 +22,7 @@ import { InstrumentationBase, registerInstrumentations } from '../../src'; class DummyTracerProvider implements TracerProvider { getTracer(name: string, version?: string): Tracer { - throw new Error("not implemented"); + throw new Error('not implemented'); } } class FooInstrumentation extends InstrumentationBase { diff --git a/packages/opentelemetry-node/test/registration.test.ts b/packages/opentelemetry-node/test/registration.test.ts index e199898a13..4db2d334b4 100644 --- a/packages/opentelemetry-node/test/registration.test.ts +++ b/packages/opentelemetry-node/test/registration.test.ts @@ -78,7 +78,7 @@ describe('API registration', () => { contextManager: null, }); - assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change"); + assert.strictEqual(context['_getContextManager'](), ctxManager, 'context manager should not change'); assert.ok( propagation['_getGlobalPropagator']() instanceof CompositePropagator diff --git a/packages/opentelemetry-sdk-node/test/sdk.test.ts b/packages/opentelemetry-sdk-node/test/sdk.test.ts index 3f80f61678..931a6845d5 100644 --- a/packages/opentelemetry-sdk-node/test/sdk.test.ts +++ b/packages/opentelemetry-sdk-node/test/sdk.test.ts @@ -113,9 +113,9 @@ describe('Node SDK', () => { await sdk.start(); - assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change"); - assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, "propagator should not change"); - assert.strictEqual((trace.getTracerProvider() as ProxyTracerProvider).getDelegate(), delegate, "tracer provider should not have changed"); + assert.strictEqual(context['_getContextManager'](), ctxManager, 'context manager should not change'); + assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, 'propagator should not change'); + assert.strictEqual((trace.getTracerProvider() as ProxyTracerProvider).getDelegate(), delegate, 'tracer provider should not have changed'); assert.ok(metrics.getMeterProvider() instanceof NoopMeterProvider); }); @@ -173,9 +173,9 @@ describe('Node SDK', () => { await sdk.start(); - assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change"); - assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, "propagator should not change"); - assert.strictEqual((trace.getTracerProvider() as ProxyTracerProvider).getDelegate(), delegate, "tracer provider should not have changed"); + assert.strictEqual(context['_getContextManager'](), ctxManager, 'context manager should not change'); + assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, 'propagator should not change'); + assert.strictEqual((trace.getTracerProvider() as ProxyTracerProvider).getDelegate(), delegate, 'tracer provider should not have changed'); assert.ok(metrics.getMeterProvider() instanceof MeterProvider); }); diff --git a/packages/opentelemetry-shim-opentracing/src/shim.ts b/packages/opentelemetry-shim-opentracing/src/shim.ts index 482fe9c56c..e1423d7e88 100644 --- a/packages/opentelemetry-shim-opentracing/src/shim.ts +++ b/packages/opentelemetry-shim-opentracing/src/shim.ts @@ -17,7 +17,7 @@ import * as api from '@opentelemetry/api'; import { SpanAttributes, SpanAttributeValue, SpanStatusCode, TextMapPropagator } from '@opentelemetry/api'; import * as opentracing from 'opentracing'; -import { SemanticAttributes } from "@opentelemetry/semantic-conventions"; +import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; function translateReferences(references: opentracing.Reference[]): api.Link[] { const links: api.Link[] = []; @@ -301,7 +301,7 @@ export class SpanShim extends opentracing.Span { const entries = Object.entries(attributes); const errorEntry = entries.find(([key]) => key === 'error.object'); const error = errorEntry?.[1]; - if (typeof error === "string") { + if (typeof error === 'string') { this._span.recordException(error, timestamp); return; } @@ -309,15 +309,15 @@ export class SpanShim extends opentracing.Span { const mappedAttributes: api.SpanAttributes = {}; for (const [k, v] of entries) { switch (k) { - case "error.kind": { + case 'error.kind': { mappedAttributes[SemanticAttributes.EXCEPTION_TYPE] = v; break; } - case "message": { + case 'message': { mappedAttributes[SemanticAttributes.EXCEPTION_MESSAGE] = v; break; } - case "stack": { + case 'stack': { mappedAttributes[SemanticAttributes.EXCEPTION_STACKTRACE] = v; break; } diff --git a/packages/opentelemetry-shim-opentracing/test/Shim.test.ts b/packages/opentelemetry-shim-opentracing/test/Shim.test.ts index 882ebe3ca1..321f25359c 100644 --- a/packages/opentelemetry-shim-opentracing/test/Shim.test.ts +++ b/packages/opentelemetry-shim-opentracing/test/Shim.test.ts @@ -36,7 +36,7 @@ import { import { performance } from 'perf_hooks'; import { B3Propagator } from '@opentelemetry/propagator-b3'; import { JaegerPropagator } from '@opentelemetry/propagator-jaeger'; -import { SemanticAttributes } from "@opentelemetry/semantic-conventions"; +import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; describe('OpenTracing Shim', () => { const compositePropagator = new CompositePropagator({ diff --git a/packages/opentelemetry-tracing/test/common/Tracer.test.ts b/packages/opentelemetry-tracing/test/common/Tracer.test.ts index 30180ef468..b0e56c2161 100644 --- a/packages/opentelemetry-tracing/test/common/Tracer.test.ts +++ b/packages/opentelemetry-tracing/test/common/Tracer.test.ts @@ -238,7 +238,7 @@ describe('Tracer', () => { tracerProvider ); - const spy = sinon.spy(tracer, "startSpan"); + const spy = sinon.spy(tracer, 'startSpan'); assert.strictEqual(tracer.startActiveSpan('my-span', span => { try { @@ -259,7 +259,7 @@ describe('Tracer', () => { tracerProvider ); - const spy = sinon.spy(tracer, "startSpan"); + const spy = sinon.spy(tracer, 'startSpan'); assert.strictEqual(tracer.startActiveSpan('my-span', {attributes: {foo: 'bar'}}, span => { try { @@ -283,7 +283,7 @@ describe('Tracer', () => { const ctx = context.active().setValue(ctxKey, 'bar') - const spy = sinon.spy(tracer, "startSpan"); + const spy = sinon.spy(tracer, 'startSpan'); assert.strictEqual(tracer.startActiveSpan('my-span', {attributes: {foo: 'bar'}}, ctx, span => { try { diff --git a/packages/opentelemetry-web/test/registration.test.ts b/packages/opentelemetry-web/test/registration.test.ts index baab6a4d77..e2c497883c 100644 --- a/packages/opentelemetry-web/test/registration.test.ts +++ b/packages/opentelemetry-web/test/registration.test.ts @@ -68,7 +68,7 @@ describe('API registration', () => { contextManager: null, }); - assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change"); + assert.strictEqual(context['_getContextManager'](), ctxManager, 'context manager should not change'); assert.ok( propagation['_getGlobalPropagator']() instanceof CompositePropagator @@ -84,7 +84,7 @@ describe('API registration', () => { propagator: null, }); - assert.strictEqual(propagation["_getGlobalPropagator"](), propagator, "propagator should not change") + assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, 'propagator should not change') assert.ok(context['_getContextManager']() instanceof StackContextManager); const apiTracerProvider = trace.getTracerProvider() as ProxyTracerProvider;