Skip to content

Commit 593f6d8

Browse files
jj22eepxaws
andauthored
Update Lint Config to remove untyped Const warnings, run npm run lint:fix (#66)
*Issue #, if available:* - ~~Align with upstream, no need for typings for constants.~~ - ~~See [upstream's `eslint.config.js`](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/b41797b2b8a11a7db4d3ec13c2452d824f45f82d/eslint.config.js#L43-L44)~~ - Not everyone adds typings for constants (which isn't required). This introduces many lint warnings. *Description of changes:* 1. Update `eslint.config.js` typedef config 2. Run `npm run lint:fix` and generate new linted files - Reduce lint warnings from 260 down to 6. - Before: [260 warnings](https://github.com/aws-observability/aws-otel-js-instrumentation/actions/runs/10888963104/job/30214566328#step:5:328) - After: [6 warnings](https://github.com/aws-observability/aws-otel-js-instrumentation/actions/runs/10913282764/job/30289505410#step:5:36) By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --------- Co-authored-by: Ping Xiang <[email protected]>
1 parent 561c847 commit 593f6d8

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

aws-distro-opentelemetry-node-autoinstrumentation/src/aws-batch-unsampled-span-processor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
suppressTracing,
1212
unrefTimer,
1313
} from '@opentelemetry/core';
14-
import { ReadableSpan, BufferConfig, Span, SpanProcessor, SpanExporter } from '@opentelemetry/sdk-trace-base';
14+
import { BufferConfig, ReadableSpan, Span, SpanExporter, SpanProcessor } from '@opentelemetry/sdk-trace-base';
1515
import { AWS_ATTRIBUTE_KEYS } from './aws-attribute-keys';
1616

1717
/**
@@ -47,7 +47,7 @@ export class AwsBatchUnsampledSpanProcessor implements SpanProcessor {
4747
private readonly _scheduledDelayMillis: number;
4848
private readonly _exportTimeoutMillis: number;
4949

50-
private _isExporting = false;
50+
private _isExporting: boolean = false;
5151
private _finishedSpans: ReadableSpan[] = [];
5252
private _timer: NodeJS.Timeout | undefined;
5353
private _shutdownOnce: BindOnceFuture<void>;

aws-distro-opentelemetry-node-autoinstrumentation/src/aws-opentelemetry-configurator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ export class AwsSpanProcessorProvider {
461461
}
462462
}
463463

464-
protected static _registeredExporters = new Map<string, () => SpanExporter>([
464+
protected static _registeredExporters: Map<string, () => SpanExporter> = new Map<string, () => SpanExporter>([
465465
['otlp', () => this.configureOtlp()],
466466
['zipkin', () => new ZipkinExporter()],
467467
['jaeger', () => this.configureJaeger()],

aws-distro-opentelemetry-node-autoinstrumentation/src/aws-span-processing-util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class AwsSpanProcessingUtil {
3535
// The current longest command word is DATETIME_INTERVAL_PRECISION at 27 characters.
3636
// If we add a longer keyword to the sql dialect keyword list, need to update the constant below.
3737
static MAX_KEYWORD_LENGTH: number = 27;
38-
static SQL_DIALECT_PATTERN = '^(?:' + AwsSpanProcessingUtil.getDialectKeywords().join('|') + ')\\b';
38+
static SQL_DIALECT_PATTERN: string = '^(?:' + AwsSpanProcessingUtil.getDialectKeywords().join('|') + ')\\b';
3939

4040
static getDialectKeywords(): string[] {
4141
return SQL_DIALECT_KEYWORDS_JSON.keywords;

eslint.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ module.exports = {
4141
],
4242
"@typescript-eslint/no-var-requires": "off",
4343
"@typescript-eslint/no-inferrable-types": 0,
44-
"@typescript-eslint/typedef": ["warn", {
45-
"variableDeclaration": true
44+
"@typescript-eslint/typedef": ["error", {
45+
"variableDeclaration": false,
46+
"parameter": true,
47+
"propertyDeclaration": true,
48+
"memberVariableDeclaration": true,
49+
"variableDeclarationIgnoreFunction": true
4650
}],
4751
"@typescript-eslint/no-empty-function": ["off"],
4852
"@typescript-eslint/ban-types": ["warn", {

0 commit comments

Comments
 (0)