Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: lint on shadowing in non-test sources, fix a few of them #1922

Merged
merged 5 commits into from
Feb 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ module.exports = {
"leadingUnderscore": "require"
}
],
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["warn"],
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_", "args": "after-used"}],
"@typescript-eslint/no-inferrable-types": ["error", { ignoreProperties: true }],
"arrow-parens": ["error", "as-needed"],
Expand All @@ -43,7 +45,8 @@ module.exports = {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off"
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-shadow": ["off"],
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ export class HttpBaggage implements TextMapPropagator {
pairs.forEach(entry => {
const keyPair = this._parsePairKeyValue(entry);
if (keyPair) {
const entry: BaggageEntry = { value: keyPair.value };
const baggageEntry: BaggageEntry = { value: keyPair.value };
if (keyPair.metadata) {
entry.metadata = keyPair.metadata;
baggageEntry.metadata = keyPair.metadata;
}
baggage[keyPair.key] = entry;
baggage[keyPair.key] = baggageEntry;
}
});
if (Object.entries(baggage).length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ export function sendWithHttp<ExportItem, ServiceRequest>(
const request = parsedUrl.protocol === 'http:' ? http.request : https.request;

const req = request(options, (res: http.IncomingMessage) => {
let data = '';
res.on('data', chunk => (data += chunk));
let responseData = '';
res.on('data', chunk => (responseData += chunk));
res.on('end', () => {
if (res.statusCode && res.statusCode < 299) {
collector.logger.debug(`statusCode: ${res.statusCode}`, data);
collector.logger.debug(`statusCode: ${res.statusCode}`, responseData);
onSuccess();
} else {
const error = new collectorTypes.CollectorExporterError(
res.statusMessage,
res.statusCode,
data
responseData
);
onError(error);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-instrumentation-http/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,11 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {
request.on(
'response',
(response: http.IncomingMessage & { aborted?: boolean }) => {
const attributes = utils.getOutgoingRequestAttributesOnResponse(
const responseAttributes = utils.getOutgoingRequestAttributesOnResponse(
response,
{ hostname }
);
span.setAttributes(attributes);
span.setAttributes(responseAttributes);
if (this._getConfig().responseHook) {
this._callResponseHook(span, response);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-metrics/src/Meter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ export class Meter implements api.Meter {
});

await Promise.all(metrics).then(records => {
records.forEach(metrics => {
metrics.forEach(metric => this._processor.process(metric));
records.forEach(record => {
obecny marked this conversation as resolved.
Show resolved Hide resolved
record.forEach(metric => this._processor.process(metric));
});
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-plugin-http/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ export class HttpPlugin extends BasePlugin<Http> {
request.on(
'response',
(response: IncomingMessage & { aborted?: boolean }) => {
const attributes = utils.getOutgoingRequestAttributesOnResponse(
const responseAttributes = utils.getOutgoingRequestAttributesOnResponse(
response,
{ hostname }
);
span.setAttributes(attributes);
span.setAttributes(responseAttributes);
if (this._config.responseHook) {
this._callResponseHook(span, response);
}
Expand Down