From 0606f8387f1b02af26b4cba9cbd472c3a09f004d Mon Sep 17 00:00:00 2001 From: Seth Maxwell Date: Wed, 12 Aug 2020 16:45:58 +0000 Subject: [PATCH] Fix linting issues --- package.json | 2 +- src/publisher/index.ts | 7 ++++--- src/subscriber.ts | 4 +++- test/publisher/index.ts | 16 ++++++++++------ test/subscriber.ts | 4 ++-- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 50a7b8d93..f916a6696 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "presystem-test": "npm run compile", "system-test": "mocha build/system-test --timeout 600000", "samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../", - "test": "c8 mocha build/test", + "test": "c8 mocha build/test --recursive", "lint": "gts check", "predocs": "npm run compile", "docs": "jsdoc -c .jsdoc.js", diff --git a/src/publisher/index.ts b/src/publisher/index.ts index cbe046767..2ae9c5ff1 100644 --- a/src/publisher/index.ts +++ b/src/publisher/index.ts @@ -81,9 +81,10 @@ export class Publisher { this.topic = topic; this.queue = new Queue(this); this.orderedQueues = new Map(); - this.tracing = this.settings && this.settings.enableOpenTelemetryTracing - ? new OpenTelemetryTracer() - : undefined; + this.tracing = + this.settings && this.settings.enableOpenTelemetryTracing + ? new OpenTelemetryTracer() + : undefined; } flush(): Promise; diff --git a/src/subscriber.ts b/src/subscriber.ts index 300f79bec..194443a25 100644 --- a/src/subscriber.ts +++ b/src/subscriber.ts @@ -426,7 +426,9 @@ export class Subscriber extends EventEmitter { this.maxMessages ); } - this._tracing = (options.enableOpenTelemetryTracing) ? new OpenTelemetryTracer() : undefined; + this._tracing = options.enableOpenTelemetryTracing + ? new OpenTelemetryTracer() + : undefined; } /** diff --git a/test/publisher/index.ts b/test/publisher/index.ts index d4d9df190..40b26d617 100644 --- a/test/publisher/index.ts +++ b/test/publisher/index.ts @@ -36,7 +36,11 @@ const fakePromisify = Object.assign({}, pfy, { } promisified = true; assert.ok(options.singular); - assert.deepStrictEqual(options.exclude, ['publish', 'setOptions', 'constructSpan']); + assert.deepStrictEqual(options.exclude, [ + 'publish', + 'setOptions', + 'constructSpan', + ]); }, }); @@ -147,9 +151,9 @@ describe('Publisher', () => { }); describe('OpenTelemetry tracing', () => { - let tracingPublisher: any = {}; + let tracingPublisher: p.Publisher = {} as p.Publisher; const enableTracing: p.PublishOptions = { - enableOpenTelemetryTracing: true + enableOpenTelemetryTracing: true, }; beforeEach(() => { // Declare tracingPublisher as type any and pre-define _tracing @@ -295,7 +299,7 @@ describe('Publisher', () => { }; const fakeMessageWithOTKey = {data, attributes}; const publisherTracing = new Publisher(topic, { - enableOpenTelemetryTracing: true + enableOpenTelemetryTracing: true, }); publisherTracing.publishMessage(fakeMessageWithOTKey, warnSpy); assert.ok(warnSpy.called); @@ -334,7 +338,7 @@ describe('Publisher', () => { gaxOpts: { isBundling: false, }, - enableOpenTelemetryTracing: false + enableOpenTelemetryTracing: false, }); }); @@ -349,7 +353,7 @@ describe('Publisher', () => { gaxOpts: { isBundling: true, }, - enableOpenTelemetryTracing: true + enableOpenTelemetryTracing: true, }; publisher.setOptions(options); diff --git a/test/subscriber.ts b/test/subscriber.ts index 970320970..622e1d0dc 100644 --- a/test/subscriber.ts +++ b/test/subscriber.ts @@ -632,9 +632,9 @@ describe('Subscriber', () => { }); describe('OpenTelemetry tracing', () => { - let tracingSubscriber: any = {}; + let tracingSubscriber: s.Subscriber = {} as s.Subscriber; const enableTracing: s.SubscriberOptions = { - enableOpenTelemetryTracing: true + enableOpenTelemetryTracing: true, }; beforeEach(() => { // Declare tracingSubscriber as type any and pre-define _tracing