Skip to content

Commit 3718dd1

Browse files
Qardclaude
andcommitted
lib: fix lint errors after rebase
- Add missing Promise primordials to diagnostics_channel.js - Fix JSDoc @returns and @param issues in metrics.js and object_identity.js - Wrap setImmediate/Promise.then callbacks in mustCall in tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5fd8c22 commit 3718dd1

5 files changed

Lines changed: 16 additions & 10 deletions

File tree

lib/diagnostics_channel.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ const {
1111
ObjectGetPrototypeOf,
1212
ObjectKeys,
1313
ObjectSetPrototypeOf,
14+
Promise,
15+
PromisePrototypeThen,
16+
PromiseReject,
17+
PromiseResolve,
1418
ReflectApply,
1519
SafeFinalizationRegistry,
1620
SafeMap,

lib/internal/perf/metrics.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ class MetricDescriptor {
216216
/**
217217
* Get the diagnostics_channel for this metric (lazily created).
218218
* Used by DiagnosticsChannelConsumer for efficient publishing.
219+
* @returns {object}
219220
*/
220221
get channel() {
221222
if (!this.#channel) {
@@ -764,6 +765,7 @@ const builtinAggregators = {
764765

765766
/**
766767
* Get an aggregator by name or return custom aggregator object.
768+
* @returns {object}
767769
*/
768770
function getAggregator(aggregation) {
769771
if (typeof aggregation === 'string') {
@@ -1234,10 +1236,10 @@ class Consumer {
12341236

12351237
/**
12361238
* @param {object} config
1237-
* @param {string} [config.defaultAggregation='sum']
1238-
* @param {string} [config.defaultTemporality='cumulative']
1239-
* @param {boolean} [config.groupByAttributes=false] - Enable attribute differentiation
1240-
* @param {object} [config.metrics] - Per-metric configuration
1239+
* @param {string} [config.defaultAggregation] Default aggregation type.
1240+
* @param {string} [config.defaultTemporality] Default temporality mode.
1241+
* @param {boolean} [config.groupByAttributes] Enable attribute differentiation.
1242+
* @param {object} [config.metrics] Per-metric configuration.
12411243
*/
12421244
constructor(config = kEmptyObject) {
12431245
validateObject(config, 'config');

lib/internal/util/object_identity.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class ObjectIdentity {
214214
/**
215215
* Create a new ObjectIdentity instance with configurable cache size.
216216
* @param {object} [options]
217-
* @param {number} [options.sortedKeysCacheSize=1000] - Max sorted keys cache entries
217+
* @param {number} [options.sortedKeysCacheSize] Max sorted keys cache entries.
218218
*/
219219
constructor(options = kEmptyObject) {
220220
this.#sortedKeysCache = new SafeMap();

test/parallel/test-metrics-exemplar-asynclocalstorage.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Flags: --expose-internals
22
'use strict';
3-
require('../common');
3+
const common = require('../common');
44
const assert = require('node:assert');
55
const { AsyncLocalStorage } = require('node:async_hooks');
66
const { create, createConsumer, ReservoirSampler } = require('internal/perf/metrics');
@@ -205,7 +205,7 @@ function extractTraceContext(attributes) {
205205
promises.push(promise);
206206
}
207207

208-
Promise.all(promises).then(() => {
208+
Promise.all(promises).then(common.mustCall(() => {
209209
const snapshot = consumer.collect();
210210
const dataPoints = snapshot[0].dataPoints;
211211

@@ -220,5 +220,5 @@ function extractTraceContext(attributes) {
220220

221221
consumer.close();
222222
metric.close();
223-
});
223+
}));
224224
}

test/parallel/test-metrics-observable-exception.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ throwOnCall = false;
5252
normalValue = 200;
5353

5454
// Give nextTick a chance to fire the uncaughtException
55-
setImmediate(() => {
55+
setImmediate(common.mustCall(() => {
5656
// Second collect - both should work now
5757
const result2 = consumer.collect();
5858
assert.strictEqual(result2.length, 2);
@@ -64,4 +64,4 @@ setImmediate(() => {
6464
assert.strictEqual(normalMetric.dataPoints[0].value, 200);
6565

6666
consumer.close();
67-
});
67+
}));

0 commit comments

Comments
 (0)