Skip to content

Commit 38d1ee2

Browse files
johnbleydyladanvmarchaud
authored
chore: lint on shadowing in non-test sources, fix a few of them (#1922)
Co-authored-by: Daniel Dyla <[email protected]> Co-authored-by: Valentin Marchaud <[email protected]>
1 parent 16c941d commit 38d1ee2

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ module.exports = {
2323
"leadingUnderscore": "require"
2424
}
2525
],
26+
"no-shadow": "off",
27+
"@typescript-eslint/no-shadow": ["warn"],
2628
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_", "args": "after-used"}],
2729
"@typescript-eslint/no-inferrable-types": ["error", { ignoreProperties: true }],
2830
"arrow-parens": ["error", "as-needed"],
@@ -43,7 +45,8 @@ module.exports = {
4345
"@typescript-eslint/no-empty-function": "off",
4446
"@typescript-eslint/no-explicit-any": "off",
4547
"@typescript-eslint/no-unused-vars": "off",
46-
"@typescript-eslint/no-var-requires": "off"
48+
"@typescript-eslint/no-var-requires": "off",
49+
"@typescript-eslint/no-shadow": ["off"],
4750
}
4851
}
4952
]

packages/opentelemetry-core/src/baggage/propagation/HttpBaggage.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ export class HttpBaggage implements TextMapPropagator {
8888
pairs.forEach(entry => {
8989
const keyPair = this._parsePairKeyValue(entry);
9090
if (keyPair) {
91-
const entry: BaggageEntry = { value: keyPair.value };
91+
const baggageEntry: BaggageEntry = { value: keyPair.value };
9292
if (keyPair.metadata) {
93-
entry.metadata = keyPair.metadata;
93+
baggageEntry.metadata = keyPair.metadata;
9494
}
95-
baggage[keyPair.key] = entry;
95+
baggage[keyPair.key] = baggageEntry;
9696
}
9797
});
9898
if (Object.entries(baggage).length === 0) {

packages/opentelemetry-exporter-collector/src/platform/node/util.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ export function sendWithHttp<ExportItem, ServiceRequest>(
5454
const request = parsedUrl.protocol === 'http:' ? http.request : https.request;
5555

5656
const req = request(options, (res: http.IncomingMessage) => {
57-
let data = '';
58-
res.on('data', chunk => (data += chunk));
57+
let responseData = '';
58+
res.on('data', chunk => (responseData += chunk));
5959
res.on('end', () => {
6060
if (res.statusCode && res.statusCode < 299) {
61-
diag.debug(`statusCode: ${res.statusCode}`, data);
61+
diag.debug(`statusCode: ${res.statusCode}`, responseData);
6262
onSuccess();
6363
} else {
6464
const error = new collectorTypes.CollectorExporterError(
6565
res.statusMessage,
6666
res.statusCode,
67-
data
67+
responseData
6868
);
6969
onError(error);
7070
}

packages/opentelemetry-instrumentation-http/src/http.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,11 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {
294294
request.on(
295295
'response',
296296
(response: http.IncomingMessage & { aborted?: boolean }) => {
297-
const attributes = utils.getOutgoingRequestAttributesOnResponse(
297+
const responseAttributes = utils.getOutgoingRequestAttributesOnResponse(
298298
response,
299299
{ hostname }
300300
);
301-
span.setAttributes(attributes);
301+
span.setAttributes(responseAttributes);
302302
if (this._getConfig().responseHook) {
303303
this._callResponseHook(span, response);
304304
}

packages/opentelemetry-metrics/src/Meter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,11 @@ export class Meter implements api.Meter {
284284
await Promise.all(observations);
285285

286286
// after this all remaining metrics can be run
287-
const metrics = Array.from(this._metrics.values()).map(metric => {
287+
const metricsRecords = Array.from(this._metrics.values()).map(metric => {
288288
return metric.getMetricRecord();
289289
});
290290

291-
await Promise.all(metrics).then(records => {
291+
await Promise.all(metricsRecords).then(records => {
292292
records.forEach(metrics => {
293293
metrics.forEach(metric => this._processor.process(metric));
294294
});

packages/opentelemetry-plugin-http/src/http.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ export class HttpPlugin extends BasePlugin<Http> {
197197
request.on(
198198
'response',
199199
(response: IncomingMessage & { aborted?: boolean }) => {
200-
const attributes = utils.getOutgoingRequestAttributesOnResponse(
200+
const responseAttributes = utils.getOutgoingRequestAttributesOnResponse(
201201
response,
202202
{ hostname }
203203
);
204-
span.setAttributes(attributes);
204+
span.setAttributes(responseAttributes);
205205
if (this._config.responseHook) {
206206
this._callResponseHook(span, response);
207207
}

0 commit comments

Comments
 (0)