diff --git a/sdk/monitor/monitor-ingestion/eslint.config.mjs b/sdk/monitor/monitor-ingestion/eslint.config.mjs new file mode 100644 index 000000000000..864298dcd2da --- /dev/null +++ b/sdk/monitor/monitor-ingestion/eslint.config.mjs @@ -0,0 +1,12 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, + }, + }, +]); diff --git a/sdk/monitor/monitor-ingestion/package.json b/sdk/monitor/monitor-ingestion/package.json index 91357b604e9a..30a5c41da86b 100644 --- a/sdk/monitor/monitor-ingestion/package.json +++ b/sdk/monitor/monitor-ingestion/package.json @@ -38,7 +38,7 @@ "generate:client": "autorest --typescript ./swagger/README.md", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "integration-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser", - "integration-test:node": "dev-tool run test:vitest", + "integration-test:node": "dev-tool run test:vitest --esm", "lint": "eslint package.json api-extractor.json src test", "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", "pack": "npm pack 2>&1", @@ -125,7 +125,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "exports": { "./package.json": "./package.json", diff --git a/sdk/monitor/monitor-ingestion/tsconfig.browser.config.json b/sdk/monitor/monitor-ingestion/tsconfig.browser.config.json index c909498a9598..75871518e3a0 100644 --- a/sdk/monitor/monitor-ingestion/tsconfig.browser.config.json +++ b/sdk/monitor/monitor-ingestion/tsconfig.browser.config.json @@ -1,10 +1,3 @@ { - "extends": "./.tshy/build.json", - "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts", "./test/**/*.mts"], - "exclude": ["./test/**/node/**/*.ts", "./test/snippets.spec.ts"], - "compilerOptions": { - "outDir": "./dist-test/browser", - "rootDir": ".", - "skipLibCheck": true - } + "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] } diff --git a/sdk/monitor/monitor-ingestion/tsconfig.json b/sdk/monitor/monitor-ingestion/tsconfig.json index 6bfb1c536236..b186a5a177d8 100644 --- a/sdk/monitor/monitor-ingestion/tsconfig.json +++ b/sdk/monitor/monitor-ingestion/tsconfig.json @@ -1,13 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure/monitor-ingestion": ["./src/index"] - }, - "lib": ["DOM"], - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "include": ["src/**/*.ts", "src/**/*.mts", "src/**/*.cts", "samples-dev/**/*.ts", "test/**/*.ts"] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/monitor/monitor-ingestion/tsconfig.samples.json b/sdk/monitor/monitor-ingestion/tsconfig.samples.json new file mode 100644 index 000000000000..332b3b161dd1 --- /dev/null +++ b/sdk/monitor/monitor-ingestion/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/monitor-ingestion": ["./dist/esm"] + } + } +} diff --git a/sdk/monitor/monitor-ingestion/tsconfig.src.json b/sdk/monitor/monitor-ingestion/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/monitor/monitor-ingestion/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/monitor/monitor-ingestion/tsconfig.test.json b/sdk/monitor/monitor-ingestion/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/monitor/monitor-ingestion/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/monitor/monitor-ingestion/vitest.config.ts b/sdk/monitor/monitor-ingestion/vitest.config.ts index 49798d657fbf..7ce75713ef99 100644 --- a/sdk/monitor/monitor-ingestion/vitest.config.ts +++ b/sdk/monitor/monitor-ingestion/vitest.config.ts @@ -10,6 +10,11 @@ export default mergeConfig( test: { include: ["test/**/*.spec.ts"], exclude: ["test/snippets.spec.ts"], + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/monitor/monitor-ingestion/vitest.esm.config.ts b/sdk/monitor/monitor-ingestion/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/monitor/monitor-ingestion/vitest.esm.config.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { mergeConfig } from "vitest/config"; +import vitestConfig from "./vitest.config.ts"; +import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; + +export default mergeConfig( + vitestConfig, + vitestEsmConfig +); diff --git a/sdk/monitor/monitor-opentelemetry-exporter/eslint.config.mjs b/sdk/monitor/monitor-opentelemetry-exporter/eslint.config.mjs index 3e901378c5df..864298dcd2da 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/eslint.config.mjs +++ b/sdk/monitor/monitor-opentelemetry-exporter/eslint.config.mjs @@ -1,28 +1,12 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - { ignores: ["src/Declarations"] }, - ...azsdkEslint.configs.recommendedTypeChecked, +export default azsdkEslint.config([ { - "rules": { - "@typescript-eslint/no-unsafe-member-access": "warn", - "@typescript-eslint/no-unsafe-assignment": "warn", - "@typescript-eslint/no-unsafe-call": "warn", - "@typescript-eslint/no-unsafe-argument": "warn", - "@typescript-eslint/restrict-template-expressions": "warn", - "@typescript-eslint/no-floating-promises": "warn", - "no-underscore-dangle": [ - "error", - { - "allowAfterThis": true - } - ], - "n/no-unsupported-features/es-syntax": [ - "error", - { - "ignores": ["modules"] - } - ] - } + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, + }, }, -]; +]); diff --git a/sdk/monitor/monitor-opentelemetry-exporter/package.json b/sdk/monitor/monitor-opentelemetry-exporter/package.json index 1abf1ca9556e..b5dcf6bd302a 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/package.json +++ b/sdk/monitor/monitor-opentelemetry-exporter/package.json @@ -125,7 +125,8 @@ "esm", "commonjs" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "browser": "./dist/browser/index.js", "exports": { diff --git a/sdk/monitor/monitor-opentelemetry-exporter/src/export/log.ts b/sdk/monitor/monitor-opentelemetry-exporter/src/export/log.ts index 77e88006299c..e35a474c5b8c 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/src/export/log.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/src/export/log.ts @@ -43,7 +43,6 @@ export class AzureMonitorLogExporter extends AzureMonitorBaseExporter implements * @param logs - Logs to export. * @param resultCallback - Result callback. */ - // eslint-disable-next-line @typescript-eslint/no-misused-promises public async export( logs: ReadableLogRecord[], resultCallback: (result: ExportResult) => void, diff --git a/sdk/monitor/monitor-opentelemetry-exporter/src/export/metric.ts b/sdk/monitor/monitor-opentelemetry-exporter/src/export/metric.ts index ffd5e49c15d6..472fa56868bd 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/src/export/metric.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/src/export/metric.ts @@ -46,7 +46,6 @@ export class AzureMonitorMetricExporter * @param metrics - Resource metrics to export. * @param resultCallback - Result callback. */ - // eslint-disable-next-line @typescript-eslint/no-misused-promises async export( metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void, diff --git a/sdk/monitor/monitor-opentelemetry-exporter/src/export/statsbeat/longIntervalStatsbeatMetrics.ts b/sdk/monitor/monitor-opentelemetry-exporter/src/export/statsbeat/longIntervalStatsbeatMetrics.ts index 6c2c8bca0d7c..a2a7b89217fa 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/src/export/statsbeat/longIntervalStatsbeatMetrics.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/src/export/statsbeat/longIntervalStatsbeatMetrics.ts @@ -116,7 +116,7 @@ class LongIntervalStatsbeatMetrics extends StatsbeatMetrics { }; } - private async initialize() { + private async initialize(): Promise { try { await this.getResourceProvider(); @@ -141,7 +141,7 @@ class LongIntervalStatsbeatMetrics extends StatsbeatMetrics { } } - private getEnvironmentStatus(observableResult: BatchObservableResult) { + private getEnvironmentStatus(observableResult: BatchObservableResult): void { this.setFeatures(); let attributes; if (this.instrumentation) { @@ -163,7 +163,7 @@ class LongIntervalStatsbeatMetrics extends StatsbeatMetrics { } } - private setFeatures() { + private setFeatures(): void { const statsbeatFeatures = process.env.AZURE_MONITOR_STATSBEAT_FEATURES; if (statsbeatFeatures) { try { @@ -177,7 +177,7 @@ class LongIntervalStatsbeatMetrics extends StatsbeatMetrics { } } - private attachCallback(observableResult: ObservableResult) { + private attachCallback(observableResult: ObservableResult): void { const attributes = { ...this.commonProperties, ...this.attachProperties }; observableResult.observe(1, attributes); } diff --git a/sdk/monitor/monitor-opentelemetry-exporter/src/export/statsbeat/statsbeatExporter.ts b/sdk/monitor/monitor-opentelemetry-exporter/src/export/statsbeat/statsbeatExporter.ts index 51baceb4298f..c2dbd4342ce3 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/src/export/statsbeat/statsbeatExporter.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/src/export/statsbeat/statsbeatExporter.ts @@ -41,7 +41,6 @@ export class AzureMonitorStatsbeatExporter /** * Export Statsbeat metrics. */ - // eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-misused-promises async export( metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void, diff --git a/sdk/monitor/monitor-opentelemetry-exporter/src/export/trace.ts b/sdk/monitor/monitor-opentelemetry-exporter/src/export/trace.ts index 736f564b5c6a..377de8bd753f 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/src/export/trace.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/src/export/trace.ts @@ -44,7 +44,6 @@ export class AzureMonitorTraceExporter extends AzureMonitorBaseExporter implemen * @param spans - Spans to export. * @param resultCallback - Result callback. */ - // eslint-disable-next-line @typescript-eslint/no-misused-promises async export( spans: ReadableSpan[], resultCallback: (result: ExportResult) => void, diff --git a/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/baseSender.ts b/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/baseSender.ts index bc0cd85e8f86..d56e9d9ad336 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/baseSender.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/baseSender.ts @@ -231,7 +231,7 @@ export abstract class BaseSender { /** * Disable collection of statsbeat metrics after max failures */ - private incrementStatsbeatFailure() { + private incrementStatsbeatFailure(): void { this.statsbeatFailureCount++; if (this.statsbeatFailureCount > MAX_STATSBEAT_FAILURES) { this.shutdownStatsbeat(); @@ -241,7 +241,7 @@ export abstract class BaseSender { /** * Shutdown statsbeat metrics */ - private shutdownStatsbeat() { + private shutdownStatsbeat(): void { this.networkStatsbeatMetrics?.shutdown(); this.longIntervalStatsbeatMetrics?.shutdown(); this.networkStatsbeatMetrics = undefined; diff --git a/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/httpSender.ts b/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/httpSender.ts index 02c2423cb051..5df41a4566d6 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/httpSender.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/httpSender.ts @@ -80,7 +80,6 @@ export class HttpSender extends BaseSender { * Shutdown sender * @internal */ - // eslint-disable-next-line @typescript-eslint/require-await async shutdown(): Promise { diag.info("HttpSender shutting down"); } diff --git a/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/persist/fileSystemPersist.ts b/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/persist/fileSystemPersist.ts index 68a4a3b1a88c..3b38aec036f5 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/persist/fileSystemPersist.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/persist/fileSystemPersist.ts @@ -191,7 +191,6 @@ export class FileSystemPersist implements PersistentStorage { if (files.length === 0) { return false; } else { - // eslint-disable-next-line @typescript-eslint/no-misused-promises files.forEach(async (file) => { // Check expiration const fileCreationDate: Date = new Date( diff --git a/sdk/monitor/monitor-opentelemetry-exporter/src/utils/eventhub.ts b/sdk/monitor/monitor-opentelemetry-exporter/src/utils/eventhub.ts index f57084b33f8b..c55522ffa0b4 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/src/utils/eventhub.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/src/utils/eventhub.ts @@ -13,7 +13,7 @@ import { AzNamespace, MessageBusDestination } from "./constants/span/azAttribute /** * Average span.links[].attributes.enqueuedTime */ -const getTimeSinceEnqueued = (span: ReadableSpan) => { +const getTimeSinceEnqueued = (span: ReadableSpan): number => { let countEnqueueDiffs = 0; let sumEnqueueDiffs = 0; const startTimeMs = hrTimeToMilliseconds(span.startTime); diff --git a/sdk/monitor/monitor-opentelemetry-exporter/src/utils/logUtils.ts b/sdk/monitor/monitor-opentelemetry-exporter/src/utils/logUtils.ts index 7663b048e246..fd8ee8b9507c 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/src/utils/logUtils.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/src/utils/logUtils.ts @@ -60,7 +60,6 @@ export function logToEnvelope(log: ReadableLogRecord, ikey: string): Envelope | name = ApplicationInsightsExceptionName; baseType = ApplicationInsightsExceptionBaseType; const exceptionDetails: TelemetryExceptionDetails = { - // eslint-disable-next-line @typescript-eslint/no-base-to-string typeName: String(exceptionType), message: String(exceptionMessage), hasFullStack: exceptionStacktrace ? true : false, @@ -84,7 +83,6 @@ export function logToEnvelope(log: ReadableLogRecord, ikey: string): Envelope | } } else { // If Legacy Application Insights Log - // eslint-disable-next-line @typescript-eslint/no-base-to-string baseType = String(log.attributes[ApplicationInsightsBaseType]); name = getLegacyApplicationInsightsName(log); baseData = getLegacyApplicationInsightsBaseData(log); @@ -100,7 +98,6 @@ export function logToEnvelope(log: ReadableLogRecord, ikey: string): Envelope | } if (properties) { for (const key of Object.keys(properties)) { - // eslint-disable-next-line @typescript-eslint/no-base-to-string properties[key] = String(properties[key]).substring(0, MaxPropertyLengths.THIRTEEN_BIT); } } diff --git a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/connectionStringParser.spec.ts b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/connectionStringParser.spec.ts index 63576e7fa82b..b87d8c8679c2 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/connectionStringParser.spec.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/connectionStringParser.spec.ts @@ -57,7 +57,7 @@ describe("ConnectionStringParser", () => { expectedInstrumentationKey?: string; expectedBreezeEndpoint: string; expectedLiveMetricsEndpoint: string; - }) => { + }): void => { const result = ConnectionStringParser.parse(options.connectionString); if (options.expectedAuthorization) { diff --git a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/log.test.ts b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/log.test.ts index b78320c9493f..a10f52b03c93 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/log.test.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/log.test.ts @@ -36,7 +36,6 @@ describe("Log Exporter Scenarios", () => { it("should work", async () => { await scenario.run(); // promisify doesn't work on this, so use callbacks/done for now - // eslint-disable-next-line promise/always-return await scenario.flush(); setTimeout(() => { assertLogExpectation(ingest, scenario.expectation); diff --git a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/metric.test.ts b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/metric.test.ts index 79cfb1bc8e3b..5573471e7704 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/metric.test.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/metric.test.ts @@ -34,7 +34,6 @@ describe("Metric Exporter Scenarios", () => { it("should work", async () => { await scenario.run(); // promisify doesn't work on this, so use callbacks/done for now - // eslint-disable-next-line promise/always-return await scenario.flush(); assertMetricExpectation(ingest, scenario.expectation); assertCount(ingest, scenario.expectation); diff --git a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/httpSender.spec.ts b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/httpSender.spec.ts index dc7324741bef..cdb393abceac 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/httpSender.spec.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/httpSender.spec.ts @@ -27,7 +27,6 @@ class TestTokenCredential implements TokenCredential { this.expiresOn = expiresOn || new Date(); } - // eslint-disable-next-line @typescript-eslint/require-await async getToken(): Promise { this.numberOfRefreshs++; return { @@ -71,7 +70,6 @@ describe("HttpSender", () => { exporterOptions: {}, }); scope.reply(200, JSON.stringify(successfulBreezeResponse(1))); - // eslint-disable-next-line @typescript-eslint/no-misused-promises setTimeout(async () => { const { result, statusCode } = await sender.send([envelope]); assert.strictEqual(statusCode, 200); @@ -104,7 +102,6 @@ describe("HttpSender", () => { exporterOptions: {}, }); scope.reply(206, JSON.stringify(partialBreezeResponse([200, 408, 408]))); - // eslint-disable-next-line @typescript-eslint/no-misused-promises setTimeout(async () => { const { result, statusCode } = await sender.send([envelope, envelope]); assert.strictEqual(statusCode, 206); diff --git a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/metricUtil.spec.ts b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/metricUtil.spec.ts index d74cec20eb2a..187bd9f05f15 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/metricUtil.spec.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/metricUtil.spec.ts @@ -37,7 +37,6 @@ class TestExporter extends AzureMonitorMetricExporter { constructor(options: AzureMonitorExporterOptions = {}) { super(options); } - // eslint-disable-next-line @typescript-eslint/require-await async export(metrics: ResourceMetrics): Promise { testMetrics = metrics; testMetrics.resource = new Resource({ diff --git a/sdk/monitor/monitor-opentelemetry-exporter/test/utils/basic.ts b/sdk/monitor/monitor-opentelemetry-exporter/test/utils/basic.ts index 515ff3a93053..6bec64ee8386 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/test/utils/basic.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/test/utils/basic.ts @@ -50,7 +50,6 @@ export class TraceBasicScenario implements Scenario { provider.register(); } - // eslint-disable-next-line @typescript-eslint/no-misused-promises async run(): Promise { const tracer = opentelemetry.trace.getTracer("basic"); const root = tracer.startSpan(`${this.constructor.name}.Root`, { @@ -93,7 +92,6 @@ export class TraceBasicScenario implements Scenario { } flush(): Promise { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return return this._processor.forceFlush(); } @@ -290,7 +288,6 @@ export class MetricBasicScenario implements Scenario { this._provider.addMetricReader(metricReader); } - // eslint-disable-next-line @typescript-eslint/no-misused-promises async run(): Promise { const meter = this._provider.getMeter("basic"); const counter = meter.createCounter("testCounter"); @@ -479,7 +476,6 @@ export class LogBasicScenario implements Scenario { this._provider.addLogRecordProcessor(this._processor); } - // eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-misused-promises async run(): Promise { const logger = this._provider.getLogger("basic"); @@ -507,7 +503,6 @@ export class LogBasicScenario implements Scenario { } flush(): Promise { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return return this._processor.forceFlush(); } diff --git a/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.browser.config.json b/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.browser.config.json new file mode 100644 index 000000000000..75871518e3a0 --- /dev/null +++ b/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.browser.config.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] +} diff --git a/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.json b/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.json index 45489856fd33..b186a5a177d8 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.json +++ b/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.json @@ -1,12 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure/monitor-opentelemetry-exporter": ["./src/index"] - }, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "include": ["src/**/*.ts", "src/**/*.mts", "src/**/*.cts", "samples-dev/**/*.ts", "test/**/*.ts"] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.samples.json b/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.samples.json new file mode 100644 index 000000000000..a7e0652420a9 --- /dev/null +++ b/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/monitor-opentelemetry-exporter": ["./dist/esm"] + } + } +} diff --git a/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.src.json b/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.test.json b/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/monitor/monitor-opentelemetry-exporter/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/monitor/monitor-opentelemetry-exporter/vitest.config.ts b/sdk/monitor/monitor-opentelemetry-exporter/vitest.config.ts index 39267dd2f56f..0149e8b85f90 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/vitest.config.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/vitest.config.ts @@ -10,6 +10,11 @@ export default mergeConfig( defineConfig({ test: { include: ["test/**/*.spec.ts"], + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/monitor/monitor-query/eslint.config.mjs b/sdk/monitor/monitor-query/eslint.config.mjs new file mode 100644 index 000000000000..864298dcd2da --- /dev/null +++ b/sdk/monitor/monitor-query/eslint.config.mjs @@ -0,0 +1,12 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, + }, + }, +]); diff --git a/sdk/monitor/monitor-query/package.json b/sdk/monitor/monitor-query/package.json index 217889267021..b837f2c4db74 100644 --- a/sdk/monitor/monitor-query/package.json +++ b/sdk/monitor/monitor-query/package.json @@ -139,7 +139,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "exports": { "./package.json": "./package.json", diff --git a/sdk/monitor/monitor-query/src/internal/modelConverters.ts b/sdk/monitor/monitor-query/src/internal/modelConverters.ts index 9422b7cca9e8..3e702d0d63de 100644 --- a/sdk/monitor/monitor-query/src/internal/modelConverters.ts +++ b/sdk/monitor/monitor-query/src/internal/modelConverters.ts @@ -273,7 +273,6 @@ export function convertResponseForMetrics( return metricObject; }); - // eslint-disable-next-line @typescript-eslint/no-unused-vars -- eslint doesn't recognize that the extracted variables are prefixed with '_' and are purposefully unused. const { resourceregion, value: _ignoredValue, interval, timespan, ...rest } = generatedResponse; const obj: Omit = { diff --git a/sdk/monitor/monitor-query/test/internal/unit/modelConverters.unittest.spec.ts b/sdk/monitor/monitor-query/test/internal/unit/modelConverters.unittest.spec.ts index ffb22e152d4e..0a71a8df4412 100644 --- a/sdk/monitor/monitor-query/test/internal/unit/modelConverters.unittest.spec.ts +++ b/sdk/monitor/monitor-query/test/internal/unit/modelConverters.unittest.spec.ts @@ -244,7 +244,6 @@ describe("Model unit tests", () => { // NOTE: _response is not returned as part of our track 2 response. }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { getMetricByName, ...rest } = actualConvertedResponse; assert.deepEqual( { ...rest } as Omit, diff --git a/sdk/monitor/monitor-query/test/public/logsQueryClient.spec.ts b/sdk/monitor/monitor-query/test/public/logsQueryClient.spec.ts index 255c2ae1ea1e..37ce21e49156 100644 --- a/sdk/monitor/monitor-query/test/public/logsQueryClient.spec.ts +++ b/sdk/monitor/monitor-query/test/public/logsQueryClient.spec.ts @@ -48,7 +48,6 @@ describe("LogsQueryClient live tests", function () { }); assert.fail("Should have thrown an exception"); } catch (err: any) { - // eslint-disable-next-line @typescript-eslint/no-unused-vars -- eslint doesn't recognize that the extracted variables are prefixed with '_' and are purposefully unused. const { request: _request, response: _response, ...stringizableError }: any = err; const innermostError = getInnermostErrorDetails(err); @@ -319,7 +318,6 @@ describe("LogsQueryClient live tests", function () { }); assert.fail("Should have thrown an exception"); } catch (err: any) { - // eslint-disable-next-line @typescript-eslint/no-unused-vars -- eslint doesn't recognize that the extracted variables are prefixed with '_' and are purposefully unused. const { request: _request, response: _response, ...stringizableError }: any = err; const innermostError = getInnermostErrorDetails(err); @@ -546,7 +544,6 @@ describe("LogsQueryClient live tests - server timeout", function () { ); assert.fail("Should have thrown a RestError for a GatewayTimeout"); } catch (err: any) { - // eslint-disable-next-line @typescript-eslint/no-unused-vars -- eslint doesn't recognize that the extracted variables are prefixed with '_' and are purposefully unused. const { request: _request, response: _response, ...stringizableError }: any = err; const innermostError = getInnermostErrorDetails(err); diff --git a/sdk/monitor/monitor-query/tsconfig.browser.config.json b/sdk/monitor/monitor-query/tsconfig.browser.config.json index f772e6eb3b76..75871518e3a0 100644 --- a/sdk/monitor/monitor-query/tsconfig.browser.config.json +++ b/sdk/monitor/monitor-query/tsconfig.browser.config.json @@ -1,10 +1,3 @@ { - "extends": "./.tshy/build.json", - "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts", "./test/**/*.mts"], - "exclude": ["./test/**/node/**/*.ts"], - "compilerOptions": { - "outDir": "./dist-test/browser", - "rootDir": ".", - "skipLibCheck": true - } + "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] } diff --git a/sdk/monitor/monitor-query/tsconfig.json b/sdk/monitor/monitor-query/tsconfig.json index f7578a235554..b186a5a177d8 100644 --- a/sdk/monitor/monitor-query/tsconfig.json +++ b/sdk/monitor/monitor-query/tsconfig.json @@ -1,12 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure/monitor-query": ["./src/index"] - }, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "include": ["src/**/*.ts", "src/**/*.mts", "src/**/*.cts", "samples-dev/**/*.ts", "test/**/*.ts"] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/monitor/monitor-query/tsconfig.samples.json b/sdk/monitor/monitor-query/tsconfig.samples.json new file mode 100644 index 000000000000..707089189d95 --- /dev/null +++ b/sdk/monitor/monitor-query/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/monitor-query": ["./dist/esm"] + } + } +} diff --git a/sdk/monitor/monitor-query/tsconfig.src.json b/sdk/monitor/monitor-query/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/monitor/monitor-query/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/monitor/monitor-query/tsconfig.test.json b/sdk/monitor/monitor-query/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/monitor/monitor-query/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/monitor/monitor-query/vitest.config.ts b/sdk/monitor/monitor-query/vitest.config.ts index 39267dd2f56f..0149e8b85f90 100644 --- a/sdk/monitor/monitor-query/vitest.config.ts +++ b/sdk/monitor/monitor-query/vitest.config.ts @@ -10,6 +10,11 @@ export default mergeConfig( defineConfig({ test: { include: ["test/**/*.spec.ts"], + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), );