From 2680455337838214c2b2fd6c83bcdcba3f1bb489 Mon Sep 17 00:00:00 2001 From: Deyaaeldeen Almahallawi Date: Tue, 10 Dec 2024 14:19:21 -0800 Subject: [PATCH] [ai] Precise Typechecking --- sdk/ai/ai-inference-rest/eslint.config.mjs | 15 +++++---- sdk/ai/ai-inference-rest/package.json | 7 +++- sdk/ai/ai-inference-rest/src/tracingHelper.ts | 2 +- .../test/public/browser/streamingChat.spec.ts | 1 - .../test/public/node/imageChat.spec.ts | 2 +- .../test/public/tracing.spec.ts | 11 +++++-- .../tsconfig.browser.config.json | 9 +----- sdk/ai/ai-inference-rest/tsconfig.json | 14 ++++---- .../ai-inference-rest/tsconfig.samples.json | 9 ++++++ sdk/ai/ai-inference-rest/tsconfig.src.json | 3 ++ sdk/ai/ai-inference-rest/tsconfig.test.json | 3 ++ sdk/ai/ai-inference-rest/vitest.config.ts | 7 +++- sdk/ai/ai-inference-rest/vitest.esm.config.ts | 11 +++++++ .../eslint.config.mjs | 12 +++++++ .../ai-language-conversations/package.json | 5 +-- .../test/public/utils/recordedClient.ts | 4 +-- .../tsconfig.browser.config.json | 9 +----- .../ai-language-conversations/tsconfig.json | 23 ++++--------- .../tsconfig.samples.json | 8 +++++ .../tsconfig.src.json | 3 ++ .../tsconfig.test.json | 3 ++ .../vitest.config.ts | 5 +++ .../vitest.esm.config.ts | 11 +++++++ .../ai-language-text/eslint.config.mjs | 12 +++++++ .../ai-language-text/package.json | 5 +-- .../tsconfig.browser.config.json | 9 +----- .../ai-language-text/tsconfig.json | 23 ++++--------- .../ai-language-text/tsconfig.samples.json | 8 +++++ .../ai-language-text/tsconfig.src.json | 3 ++ .../ai-language-text/tsconfig.test.json | 3 ++ .../ai-language-text/vitest.config.ts | 5 +++ .../ai-language-text/vitest.esm.config.ts | 11 +++++++ .../eslint.config.mjs | 12 ++++--- .../ai-language-textauthoring/package.json | 3 +- .../tsconfig.browser.config.json | 9 +----- .../ai-language-textauthoring/tsconfig.json | 23 ++++--------- .../tsconfig.samples.json | 8 +++++ .../tsconfig.src.json | 3 ++ .../tsconfig.test.json | 3 ++ .../vitest.config.ts | 5 +++ .../ai-content-safety-rest/eslint.config.mjs | 12 +++---- .../ai-content-safety-rest/package.json | 5 +-- .../review/ai-content-safety.api.md | 5 ++- .../test/public/contentSafety.spec.ts | 7 ++-- .../tsconfig.browser.config.json | 15 +-------- .../ai-content-safety-rest/tsconfig.json | 24 ++++---------- .../tsconfig.samples.json | 8 +++++ .../ai-content-safety-rest/tsconfig.src.json | 3 ++ .../ai-content-safety-rest/tsconfig.test.json | 3 ++ .../ai-content-safety-rest/vitest.config.ts | 5 +++ .../vitest.esm.config.ts | 11 +++++++ .../eslint.config.mjs | 15 +++++---- .../package.json | 3 +- .../samples-dev/buildModel.ts | 5 ++- .../samples-dev/composeModel.ts | 9 ++++-- .../test/public/analysis.spec.ts | 6 ++-- .../test/public/training.spec.ts | 17 +++++----- .../tsconfig.browser.config.json | 9 +----- .../tsconfig.json | 12 +++---- .../tsconfig.samples.json | 8 +++++ .../tsconfig.src.json | 3 ++ .../tsconfig.test.json | 3 ++ .../vitest.config.ts | 5 +++ .../vitest.esm.config.ts | 11 +++++++ .../eslint.config.mjs | 9 +++--- .../ai-document-translator-rest/package.json | 5 +-- .../tsconfig.browser.config.json | 9 +----- .../ai-document-translator-rest/tsconfig.json | 15 ++++----- .../tsconfig.samples.json | 8 +++++ .../tsconfig.src.json | 3 ++ .../tsconfig.test.json | 3 ++ .../vitest.config.ts | 5 +++ .../vitest.esm.config.ts | 11 +++++++ .../ai-vision-face-rest/eslint.config.mjs | 11 +++++-- sdk/face/ai-vision-face-rest/package.json | 3 +- .../samples-dev/livenessSession.ts | 2 +- .../samples-dev/livenessSessionWithVerify.ts | 2 +- ...ivenessSessionWithVerifyWithVerifyImage.ts | 2 +- .../tsconfig.browser.config.json | 9 +----- sdk/face/ai-vision-face-rest/tsconfig.json | 21 ++++-------- .../ai-vision-face-rest/tsconfig.samples.json | 8 +++++ .../ai-vision-face-rest/tsconfig.src.json | 3 ++ .../ai-vision-face-rest/tsconfig.test.json | 3 ++ sdk/face/ai-vision-face-rest/vitest.config.ts | 5 +++ .../ai-vision-face-rest/vitest.esm.config.ts | 11 +++++++ .../ai-metrics-advisor/eslint.config.mjs | 12 +++++++ .../ai-metrics-advisor/package.json | 5 +-- .../tsconfig.browser.config.json | 9 +----- .../ai-metrics-advisor/tsconfig.json | 32 +++---------------- .../ai-metrics-advisor/tsconfig.samples.json | 8 +++++ .../ai-metrics-advisor/tsconfig.src.json | 3 ++ .../ai-metrics-advisor/tsconfig.test.json | 3 ++ .../ai-metrics-advisor/vitest.config.ts | 5 +++ .../ai-metrics-advisor/vitest.esm.config.ts | 11 +++++++ .../ai-text-analytics/eslint.config.mjs | 12 +++++++ .../ai-text-analytics/package.json | 5 +-- .../tsconfig.browser.config.json | 9 +----- .../ai-text-analytics/tsconfig.json | 23 ++++--------- .../ai-text-analytics/tsconfig.samples.json | 8 +++++ .../ai-text-analytics/tsconfig.src.json | 3 ++ .../ai-text-analytics/tsconfig.test.json | 3 ++ .../ai-text-analytics/vitest.config.ts | 5 +++ .../ai-text-analytics/vitest.esm.config.ts | 11 +++++++ .../eslint.config.mjs | 11 +++---- .../ai-translation-text-rest/package.json | 5 +-- .../tsconfig.browser.config.json | 9 +----- .../ai-translation-text-rest/tsconfig.json | 15 ++++----- .../tsconfig.samples.json | 8 +++++ .../tsconfig.src.json | 3 ++ .../tsconfig.test.json | 3 ++ .../ai-translation-text-rest/vitest.config.ts | 5 +++ .../vitest.esm.config.ts | 11 +++++++ .../eslint.config.mjs | 11 +++---- .../package.json | 5 +-- .../tsconfig.browser.config.json | 9 +----- .../tsconfig.json | 23 ++++--------- .../tsconfig.samples.json | 8 +++++ .../tsconfig.src.json | 3 ++ .../tsconfig.test.json | 3 ++ .../vitest.config.ts | 5 +++ .../vitest.esm.config.ts | 11 +++++++ 121 files changed, 614 insertions(+), 375 deletions(-) create mode 100644 sdk/ai/ai-inference-rest/tsconfig.samples.json create mode 100644 sdk/ai/ai-inference-rest/tsconfig.src.json create mode 100644 sdk/ai/ai-inference-rest/tsconfig.test.json create mode 100644 sdk/ai/ai-inference-rest/vitest.esm.config.ts create mode 100644 sdk/cognitivelanguage/ai-language-conversations/eslint.config.mjs create mode 100644 sdk/cognitivelanguage/ai-language-conversations/tsconfig.samples.json create mode 100644 sdk/cognitivelanguage/ai-language-conversations/tsconfig.src.json create mode 100644 sdk/cognitivelanguage/ai-language-conversations/tsconfig.test.json create mode 100644 sdk/cognitivelanguage/ai-language-conversations/vitest.esm.config.ts create mode 100644 sdk/cognitivelanguage/ai-language-text/eslint.config.mjs create mode 100644 sdk/cognitivelanguage/ai-language-text/tsconfig.samples.json create mode 100644 sdk/cognitivelanguage/ai-language-text/tsconfig.src.json create mode 100644 sdk/cognitivelanguage/ai-language-text/tsconfig.test.json create mode 100644 sdk/cognitivelanguage/ai-language-text/vitest.esm.config.ts create mode 100644 sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.samples.json create mode 100644 sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.src.json create mode 100644 sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.test.json create mode 100644 sdk/contentsafety/ai-content-safety-rest/tsconfig.samples.json create mode 100644 sdk/contentsafety/ai-content-safety-rest/tsconfig.src.json create mode 100644 sdk/contentsafety/ai-content-safety-rest/tsconfig.test.json create mode 100644 sdk/contentsafety/ai-content-safety-rest/vitest.esm.config.ts create mode 100644 sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.samples.json create mode 100644 sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.src.json create mode 100644 sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.test.json create mode 100644 sdk/documentintelligence/ai-document-intelligence-rest/vitest.esm.config.ts create mode 100644 sdk/documenttranslator/ai-document-translator-rest/tsconfig.samples.json create mode 100644 sdk/documenttranslator/ai-document-translator-rest/tsconfig.src.json create mode 100644 sdk/documenttranslator/ai-document-translator-rest/tsconfig.test.json create mode 100644 sdk/documenttranslator/ai-document-translator-rest/vitest.esm.config.ts create mode 100644 sdk/face/ai-vision-face-rest/tsconfig.samples.json create mode 100644 sdk/face/ai-vision-face-rest/tsconfig.src.json create mode 100644 sdk/face/ai-vision-face-rest/tsconfig.test.json create mode 100644 sdk/face/ai-vision-face-rest/vitest.esm.config.ts create mode 100644 sdk/metricsadvisor/ai-metrics-advisor/eslint.config.mjs create mode 100644 sdk/metricsadvisor/ai-metrics-advisor/tsconfig.samples.json create mode 100644 sdk/metricsadvisor/ai-metrics-advisor/tsconfig.src.json create mode 100644 sdk/metricsadvisor/ai-metrics-advisor/tsconfig.test.json create mode 100644 sdk/metricsadvisor/ai-metrics-advisor/vitest.esm.config.ts create mode 100644 sdk/textanalytics/ai-text-analytics/eslint.config.mjs create mode 100644 sdk/textanalytics/ai-text-analytics/tsconfig.samples.json create mode 100644 sdk/textanalytics/ai-text-analytics/tsconfig.src.json create mode 100644 sdk/textanalytics/ai-text-analytics/tsconfig.test.json create mode 100644 sdk/textanalytics/ai-text-analytics/vitest.esm.config.ts create mode 100644 sdk/translation/ai-translation-text-rest/tsconfig.samples.json create mode 100644 sdk/translation/ai-translation-text-rest/tsconfig.src.json create mode 100644 sdk/translation/ai-translation-text-rest/tsconfig.test.json create mode 100644 sdk/translation/ai-translation-text-rest/vitest.esm.config.ts create mode 100644 sdk/vision/ai-vision-image-analysis-rest/tsconfig.samples.json create mode 100644 sdk/vision/ai-vision-image-analysis-rest/tsconfig.src.json create mode 100644 sdk/vision/ai-vision-image-analysis-rest/tsconfig.test.json create mode 100644 sdk/vision/ai-vision-image-analysis-rest/vitest.esm.config.ts diff --git a/sdk/ai/ai-inference-rest/eslint.config.mjs b/sdk/ai/ai-inference-rest/eslint.config.mjs index 91a2b5a50cd0..b06f66efdd82 100644 --- a/sdk/ai/ai-inference-rest/eslint.config.mjs +++ b/sdk/ai/ai-inference-rest/eslint.config.mjs @@ -4,13 +4,14 @@ export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-apiextractor-json-types": "warn", - "@azure/azure-sdk/ts-package-json-types": "warn", - "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "tsdoc/syntax": "warn", - "@azure/azure-sdk/ts-package-json-module": "off", - "@azure/azure-sdk/ts-package-json-files-required": "off", - "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + } + }, + { + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, }, }, ]); diff --git a/sdk/ai/ai-inference-rest/package.json b/sdk/ai/ai-inference-rest/package.json index 517cb89e6bf9..7dc3f5efc269 100644 --- a/sdk/ai/ai-inference-rest/package.json +++ b/sdk/ai/ai-inference-rest/package.json @@ -38,7 +38,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "type": "module", "files": [ @@ -94,7 +95,11 @@ "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", "@azure/identity": "^4.3.0", + "@azure/monitor-opentelemetry-exporter": "1.0.0-beta.27", + "@opentelemetry/instrumentation": "0.56.0", + "@azure/opentelemetry-instrumentation-azure-sdk": "1.0.0-beta.7", "@opentelemetry/api": "^1.9.0", + "@opentelemetry/sdk-trace-node": "1.29.0", "@types/node": "^18.0.0", "@vitest/browser": "^2.0.5", "@vitest/coverage-istanbul": "^2.0.5", diff --git a/sdk/ai/ai-inference-rest/src/tracingHelper.ts b/sdk/ai/ai-inference-rest/src/tracingHelper.ts index af47efd2c2e6..0e6623d255fb 100644 --- a/sdk/ai/ai-inference-rest/src/tracingHelper.ts +++ b/sdk/ai/ai-inference-rest/src/tracingHelper.ts @@ -18,7 +18,7 @@ import { isError } from "@azure/core-util"; import type { PipelineRequest, PipelineResponse } from "@azure/core-rest-pipeline"; const INFERENCE_GEN_AI_SYSTEM_NAME = "az.ai.inference"; -const isContentRecordingEnabled = () => +const isContentRecordingEnabled = (): boolean => envVarToBoolean("AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED"); enum TracingAttributesEnum { diff --git a/sdk/ai/ai-inference-rest/test/public/browser/streamingChat.spec.ts b/sdk/ai/ai-inference-rest/test/public/browser/streamingChat.spec.ts index 428f9ef29a72..d4469c7da852 100644 --- a/sdk/ai/ai-inference-rest/test/public/browser/streamingChat.spec.ts +++ b/sdk/ai/ai-inference-rest/test/public/browser/streamingChat.spec.ts @@ -54,7 +54,6 @@ describe("chat test suite", () => { const reader = (readableStream as any).getReader(); const buffers: Uint8Array[] = []; try { - // eslint-disable-next-line no-constant-condition while (true) { const { value, done } = await reader.read(); if (done) { diff --git a/sdk/ai/ai-inference-rest/test/public/node/imageChat.spec.ts b/sdk/ai/ai-inference-rest/test/public/node/imageChat.spec.ts index fca26ab5d1d2..dc2ce60494bd 100644 --- a/sdk/ai/ai-inference-rest/test/public/node/imageChat.spec.ts +++ b/sdk/ai/ai-inference-rest/test/public/node/imageChat.spec.ts @@ -18,7 +18,7 @@ function getImageDataUrl(imageFile: string, imageFormat: string): string { } catch (error) { console.error(`Could not read '${imageFile}'.`); console.error("Set the correct path to the image file before running this sample."); - process.exit(1); + throw error; } } diff --git a/sdk/ai/ai-inference-rest/test/public/tracing.spec.ts b/sdk/ai/ai-inference-rest/test/public/tracing.spec.ts index 356733537fe8..44941112ef87 100644 --- a/sdk/ai/ai-inference-rest/test/public/tracing.spec.ts +++ b/sdk/ai/ai-inference-rest/test/public/tracing.spec.ts @@ -57,7 +57,7 @@ describe("tracing test suite", () => { return `The temperature in ${location} is 72 degrees ${unit}`; }; - const updateToolCalls = (toolCallArray: Array, functionArray: Array) => { + const updateToolCalls = (toolCallArray: Array, functionArray: Array): void => { const dummyFunction = { name: "", arguments: "", id: "" }; while (functionArray.length < toolCallArray.length) { functionArray.push(dummyFunction); @@ -78,7 +78,14 @@ describe("tracing test suite", () => { } }; - const handleToolCalls = (functionArray: Array) => { + const handleToolCalls = ( + functionArray: Array, + ): { + role: string; + content: string; + tool_call_id: any; + name: any; + }[] => { const messageArray = []; for (const func of functionArray) { const funcArgs = JSON.parse(func.arguments); diff --git a/sdk/ai/ai-inference-rest/tsconfig.browser.config.json b/sdk/ai/ai-inference-rest/tsconfig.browser.config.json index 1b37aebc5457..75871518e3a0 100644 --- a/sdk/ai/ai-inference-rest/tsconfig.browser.config.json +++ b/sdk/ai/ai-inference-rest/tsconfig.browser.config.json @@ -1,10 +1,3 @@ { - "extends": "./.tshy/build.json", - "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts"], - "exclude": ["./test/**/node/**/*.ts"], - "compilerOptions": { - "outDir": "./dist-test/browser", - "rootDir": ".", - "skipLibCheck": true - } + "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] } diff --git a/sdk/ai/ai-inference-rest/tsconfig.json b/sdk/ai/ai-inference-rest/tsconfig.json index 29a57f0c8df0..b186a5a177d8 100644 --- a/sdk/ai/ai-inference-rest/tsconfig.json +++ b/sdk/ai/ai-inference-rest/tsconfig.json @@ -1,11 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { "@azure-rest/ai-inference": ["./src/index"] }, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "ts-node": { "esm": true }, - "include": ["./src/**/*.ts", "test/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/ai/ai-inference-rest/tsconfig.samples.json b/sdk/ai/ai-inference-rest/tsconfig.samples.json new file mode 100644 index 000000000000..8379ce9af394 --- /dev/null +++ b/sdk/ai/ai-inference-rest/tsconfig.samples.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure-rest/ai-inference": ["./dist/esm"] + }, + "lib": ["DOM"] + } +} diff --git a/sdk/ai/ai-inference-rest/tsconfig.src.json b/sdk/ai/ai-inference-rest/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/ai/ai-inference-rest/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/ai/ai-inference-rest/tsconfig.test.json b/sdk/ai/ai-inference-rest/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/ai/ai-inference-rest/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/ai/ai-inference-rest/vitest.config.ts b/sdk/ai/ai-inference-rest/vitest.config.ts index ea78b9c797c4..217a92f8cbbd 100644 --- a/sdk/ai/ai-inference-rest/vitest.config.ts +++ b/sdk/ai/ai-inference-rest/vitest.config.ts @@ -9,7 +9,12 @@ export default mergeConfig( defineConfig({ test: { testTimeout: 50000, - include: ["test/internal/**/*.spec.ts", "test/public/**/*.spec.ts"], + include: ["test/**/*.spec.ts"], + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/ai/ai-inference-rest/vitest.esm.config.ts b/sdk/ai/ai-inference-rest/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/ai/ai-inference-rest/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/cognitivelanguage/ai-language-conversations/eslint.config.mjs b/sdk/cognitivelanguage/ai-language-conversations/eslint.config.mjs new file mode 100644 index 000000000000..864298dcd2da --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-conversations/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/cognitivelanguage/ai-language-conversations/package.json b/sdk/cognitivelanguage/ai-language-conversations/package.json index cdc517dd943c..2db7b53c0662 100644 --- a/sdk/cognitivelanguage/ai-language-conversations/package.json +++ b/sdk/cognitivelanguage/ai-language-conversations/package.json @@ -69,7 +69,7 @@ "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", "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", @@ -115,7 +115,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "browser": "./dist/browser/index.js", "exports": { diff --git a/sdk/cognitivelanguage/ai-language-conversations/test/public/utils/recordedClient.ts b/sdk/cognitivelanguage/ai-language-conversations/test/public/utils/recordedClient.ts index d09ae89d25cc..1c24276d20e0 100644 --- a/sdk/cognitivelanguage/ai-language-conversations/test/public/utils/recordedClient.ts +++ b/sdk/cognitivelanguage/ai-language-conversations/test/public/utils/recordedClient.ts @@ -3,7 +3,7 @@ import type { ConversationAnalysisOptions } from "../../../src/index.js"; import { ConversationAnalysisClient } from "../../../src/index.js"; -import type { RecorderStartOptions } from "@azure-tools/test-recorder"; +import type { RecorderStartOptions, TestInfo } from "@azure-tools/test-recorder"; import { Recorder, assertEnvironmentVariable } from "@azure-tools/test-recorder"; import { AzureKeyCredential } from "@azure/core-auth"; import { createTestCredential } from "@azure-tools/test-credential"; @@ -64,7 +64,7 @@ export function createClient(options: { * Should be called first in the test suite to make sure environment variables are * read before they are being used. */ -export async function startRecorder(currentTest?: Test): Promise { +export async function startRecorder(currentTest?: TestInfo): Promise { const recorder = new Recorder(currentTest); await recorder.start(recorderStartOptions); await recorder.setMatcher("CustomDefaultMatcher", { excludedHeaders: ["Accept-Language"] }); diff --git a/sdk/cognitivelanguage/ai-language-conversations/tsconfig.browser.config.json b/sdk/cognitivelanguage/ai-language-conversations/tsconfig.browser.config.json index f772e6eb3b76..75871518e3a0 100644 --- a/sdk/cognitivelanguage/ai-language-conversations/tsconfig.browser.config.json +++ b/sdk/cognitivelanguage/ai-language-conversations/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/cognitivelanguage/ai-language-conversations/tsconfig.json b/sdk/cognitivelanguage/ai-language-conversations/tsconfig.json index c14580ca2ef4..b186a5a177d8 100644 --- a/sdk/cognitivelanguage/ai-language-conversations/tsconfig.json +++ b/sdk/cognitivelanguage/ai-language-conversations/tsconfig.json @@ -1,20 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure/ai-language-conversations": ["./src/index"] - }, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "include": [ - "src/**/*.ts", - "src/**/*.mts", - "src/**/*.cts", - "samples-dev/**/*.ts", - "test/**/*.ts", - "test/**/*.mts", - "test/**/*.cts" - ] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/cognitivelanguage/ai-language-conversations/tsconfig.samples.json b/sdk/cognitivelanguage/ai-language-conversations/tsconfig.samples.json new file mode 100644 index 000000000000..fde6ffffe665 --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-conversations/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/ai-language-conversations": ["./dist/esm"] + } + } +} diff --git a/sdk/cognitivelanguage/ai-language-conversations/tsconfig.src.json b/sdk/cognitivelanguage/ai-language-conversations/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-conversations/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/cognitivelanguage/ai-language-conversations/tsconfig.test.json b/sdk/cognitivelanguage/ai-language-conversations/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-conversations/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/cognitivelanguage/ai-language-conversations/vitest.config.ts b/sdk/cognitivelanguage/ai-language-conversations/vitest.config.ts index d01fdec8ac69..3e9caaad8e0c 100644 --- a/sdk/cognitivelanguage/ai-language-conversations/vitest.config.ts +++ b/sdk/cognitivelanguage/ai-language-conversations/vitest.config.ts @@ -11,6 +11,11 @@ export default mergeConfig( include: ["test/**/*.spec.ts"], hookTimeout: 5000000, testTimeout: 5000000, + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/cognitivelanguage/ai-language-conversations/vitest.esm.config.ts b/sdk/cognitivelanguage/ai-language-conversations/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-conversations/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/cognitivelanguage/ai-language-text/eslint.config.mjs b/sdk/cognitivelanguage/ai-language-text/eslint.config.mjs new file mode 100644 index 000000000000..864298dcd2da --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-text/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/cognitivelanguage/ai-language-text/package.json b/sdk/cognitivelanguage/ai-language-text/package.json index c04e342a8c6b..efa37100af59 100644 --- a/sdk/cognitivelanguage/ai-language-text/package.json +++ b/sdk/cognitivelanguage/ai-language-text/package.json @@ -71,7 +71,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", @@ -132,7 +132,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "browser": "./dist/browser/index.js", "exports": { diff --git a/sdk/cognitivelanguage/ai-language-text/tsconfig.browser.config.json b/sdk/cognitivelanguage/ai-language-text/tsconfig.browser.config.json index f772e6eb3b76..75871518e3a0 100644 --- a/sdk/cognitivelanguage/ai-language-text/tsconfig.browser.config.json +++ b/sdk/cognitivelanguage/ai-language-text/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/cognitivelanguage/ai-language-text/tsconfig.json b/sdk/cognitivelanguage/ai-language-text/tsconfig.json index 74661df60b0d..b186a5a177d8 100644 --- a/sdk/cognitivelanguage/ai-language-text/tsconfig.json +++ b/sdk/cognitivelanguage/ai-language-text/tsconfig.json @@ -1,20 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure/ai-language-text": ["./src/index"] - }, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "include": [ - "src/**/*.ts", - "src/**/*.mts", - "src/**/*.cts", - "samples-dev/**/*.ts", - "test/**/*.ts", - "test/**/*.mts", - "test/**/*.cts" - ] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/cognitivelanguage/ai-language-text/tsconfig.samples.json b/sdk/cognitivelanguage/ai-language-text/tsconfig.samples.json new file mode 100644 index 000000000000..29cb6bb309bd --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-text/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/ai-language-text": ["./dist/esm"] + } + } +} diff --git a/sdk/cognitivelanguage/ai-language-text/tsconfig.src.json b/sdk/cognitivelanguage/ai-language-text/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-text/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/cognitivelanguage/ai-language-text/tsconfig.test.json b/sdk/cognitivelanguage/ai-language-text/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-text/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/cognitivelanguage/ai-language-text/vitest.config.ts b/sdk/cognitivelanguage/ai-language-text/vitest.config.ts index d01fdec8ac69..3e9caaad8e0c 100644 --- a/sdk/cognitivelanguage/ai-language-text/vitest.config.ts +++ b/sdk/cognitivelanguage/ai-language-text/vitest.config.ts @@ -11,6 +11,11 @@ export default mergeConfig( include: ["test/**/*.spec.ts"], hookTimeout: 5000000, testTimeout: 5000000, + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/cognitivelanguage/ai-language-text/vitest.esm.config.ts b/sdk/cognitivelanguage/ai-language-text/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-text/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/cognitivelanguage/ai-language-textauthoring/eslint.config.mjs b/sdk/cognitivelanguage/ai-language-textauthoring/eslint.config.mjs index 699816467a91..b06f66efdd82 100644 --- a/sdk/cognitivelanguage/ai-language-textauthoring/eslint.config.mjs +++ b/sdk/cognitivelanguage/ai-language-textauthoring/eslint.config.mjs @@ -4,10 +4,14 @@ export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-apiextractor-json-types": "warn", - "@azure/azure-sdk/ts-package-json-types": "warn", - "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "tsdoc/syntax": "warn", + } + }, + { + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, }, }, ]); diff --git a/sdk/cognitivelanguage/ai-language-textauthoring/package.json b/sdk/cognitivelanguage/ai-language-textauthoring/package.json index d5dada8ce845..421059b35aa7 100644 --- a/sdk/cognitivelanguage/ai-language-textauthoring/package.json +++ b/sdk/cognitivelanguage/ai-language-textauthoring/package.json @@ -114,7 +114,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "browser": "./dist/browser/index.js", "exports": { diff --git a/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.browser.config.json b/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.browser.config.json index f772e6eb3b76..75871518e3a0 100644 --- a/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.browser.config.json +++ b/sdk/cognitivelanguage/ai-language-textauthoring/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/cognitivelanguage/ai-language-textauthoring/tsconfig.json b/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.json index 8ccbb8e2f243..b186a5a177d8 100644 --- a/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.json +++ b/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.json @@ -1,20 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure/ai-language-textauthoring": ["./src/index"] - }, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "include": [ - "src/**/*.ts", - "src/**/*.mts", - "src/**/*.cts", - "samples-dev/**/*.ts", - "test/**/*.ts", - "test/**/*.mts", - "test/**/*.cts" - ] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.samples.json b/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.samples.json new file mode 100644 index 000000000000..bb94790e505b --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/ai-language-textauthoring": ["./dist/esm"] + } + } +} diff --git a/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.src.json b/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.test.json b/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/cognitivelanguage/ai-language-textauthoring/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/cognitivelanguage/ai-language-textauthoring/vitest.config.ts b/sdk/cognitivelanguage/ai-language-textauthoring/vitest.config.ts index 39267dd2f56f..0149e8b85f90 100644 --- a/sdk/cognitivelanguage/ai-language-textauthoring/vitest.config.ts +++ b/sdk/cognitivelanguage/ai-language-textauthoring/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/contentsafety/ai-content-safety-rest/eslint.config.mjs b/sdk/contentsafety/ai-content-safety-rest/eslint.config.mjs index 80f15c3acfe9..864298dcd2da 100644 --- a/sdk/contentsafety/ai-content-safety-rest/eslint.config.mjs +++ b/sdk/contentsafety/ai-content-safety-rest/eslint.config.mjs @@ -2,13 +2,11 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; export default azsdkEslint.config([ { - rules: { - "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-apiextractor-json-types": "warn", - "@azure/azure-sdk/ts-package-json-types": "warn", - "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "@typescript-eslint/no-redeclare": "warn", - "tsdoc/syntax": "warn", + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, }, }, ]); diff --git a/sdk/contentsafety/ai-content-safety-rest/package.json b/sdk/contentsafety/ai-content-safety-rest/package.json index 8243d04bcc97..e11eefa5a88e 100644 --- a/sdk/contentsafety/ai-content-safety-rest/package.json +++ b/sdk/contentsafety/ai-content-safety-rest/package.json @@ -43,7 +43,7 @@ "generate:client": "echo skipped", "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", @@ -122,7 +122,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "exports": { "./package.json": "./package.json", diff --git a/sdk/contentsafety/ai-content-safety-rest/review/ai-content-safety.api.md b/sdk/contentsafety/ai-content-safety-rest/review/ai-content-safety.api.md index 32ddc49df2d7..e384c5744f99 100644 --- a/sdk/contentsafety/ai-content-safety-rest/review/ai-content-safety.api.md +++ b/sdk/contentsafety/ai-content-safety-rest/review/ai-content-safety.api.md @@ -99,7 +99,7 @@ export interface AnalyzeImageDefaultResponse extends HttpResponse { // @public export interface AnalyzeImageOptions { categories?: string[]; - image: ImageData_2; + image: ImageData; outputType?: string; } @@ -335,11 +335,10 @@ export interface ImageCategoriesAnalysisOutput { } // @public -interface ImageData_2 { +export interface ImageData { blobUrl?: string; content?: string; } -export { ImageData_2 as ImageData } // @public export interface ImageDataOutput { diff --git a/sdk/contentsafety/ai-content-safety-rest/test/public/contentSafety.spec.ts b/sdk/contentsafety/ai-content-safety-rest/test/public/contentSafety.spec.ts index 29bff673d55b..d4ab827fa23a 100644 --- a/sdk/contentsafety/ai-content-safety-rest/test/public/contentSafety.spec.ts +++ b/sdk/contentsafety/ai-content-safety-rest/test/public/contentSafety.spec.ts @@ -9,15 +9,12 @@ import { isUnexpected, paginate } from "../../src/index.js"; import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import fs from "node:fs"; import path from "node:path"; -import { isBrowser } from "@azure/core-util"; +import { isBrowser, delay } from "@azure/core-util"; import { describe, it, assert, beforeEach, afterEach } from "vitest"; describe("Content Safety Client Test", () => { let recorder: Recorder; let client: ContentSafetyClient; - function sleep(time: number): Promise { - return new Promise((resolve) => setTimeout(resolve, time)); - } function uint8ArrayToBase64(binary: Uint8Array): string { let binaryString = ""; binary.forEach((byte) => { @@ -130,7 +127,7 @@ describe("Content Safety Client Test", () => { assert.isArray(addBlockItemsResponse.body.blocklistItems); if (!isPlaybackMode()) { - await sleep(30000); + await delay(30000); } }); diff --git a/sdk/contentsafety/ai-content-safety-rest/tsconfig.browser.config.json b/sdk/contentsafety/ai-content-safety-rest/tsconfig.browser.config.json index d1145edb4e72..75871518e3a0 100644 --- a/sdk/contentsafety/ai-content-safety-rest/tsconfig.browser.config.json +++ b/sdk/contentsafety/ai-content-safety-rest/tsconfig.browser.config.json @@ -1,16 +1,3 @@ { - "extends": "./.tshy/build.json", - "include": [ - "./src/**/*.ts", - "./src/**/*.mts", - "./samples-dev/**/*.ts", - "./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/contentsafety/ai-content-safety-rest/tsconfig.json b/sdk/contentsafety/ai-content-safety-rest/tsconfig.json index d8f4dd007142..b186a5a177d8 100644 --- a/sdk/contentsafety/ai-content-safety-rest/tsconfig.json +++ b/sdk/contentsafety/ai-content-safety-rest/tsconfig.json @@ -1,21 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "lib": ["dom"], - "paths": { - "@azure-rest/ai-content-safety": ["./src/index"] - }, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "include": [ - "src/**/*.ts", - "src/**/*.mts", - "src/**/*.cts", - "samples-dev/**/*.ts", - "test/**/*.ts", - "test/**/*.mts", - "test/**/*.cts" - ] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/contentsafety/ai-content-safety-rest/tsconfig.samples.json b/sdk/contentsafety/ai-content-safety-rest/tsconfig.samples.json new file mode 100644 index 000000000000..d2c26025e3a7 --- /dev/null +++ b/sdk/contentsafety/ai-content-safety-rest/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure-rest/ai-content-safety": ["./dist/esm"] + } + } +} diff --git a/sdk/contentsafety/ai-content-safety-rest/tsconfig.src.json b/sdk/contentsafety/ai-content-safety-rest/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/contentsafety/ai-content-safety-rest/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/contentsafety/ai-content-safety-rest/tsconfig.test.json b/sdk/contentsafety/ai-content-safety-rest/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/contentsafety/ai-content-safety-rest/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/contentsafety/ai-content-safety-rest/vitest.config.ts b/sdk/contentsafety/ai-content-safety-rest/vitest.config.ts index d01fdec8ac69..3e9caaad8e0c 100644 --- a/sdk/contentsafety/ai-content-safety-rest/vitest.config.ts +++ b/sdk/contentsafety/ai-content-safety-rest/vitest.config.ts @@ -11,6 +11,11 @@ export default mergeConfig( include: ["test/**/*.spec.ts"], hookTimeout: 5000000, testTimeout: 5000000, + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/contentsafety/ai-content-safety-rest/vitest.esm.config.ts b/sdk/contentsafety/ai-content-safety-rest/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/contentsafety/ai-content-safety-rest/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/documentintelligence/ai-document-intelligence-rest/eslint.config.mjs b/sdk/documentintelligence/ai-document-intelligence-rest/eslint.config.mjs index 91a2b5a50cd0..52be04401c47 100644 --- a/sdk/documentintelligence/ai-document-intelligence-rest/eslint.config.mjs +++ b/sdk/documentintelligence/ai-document-intelligence-rest/eslint.config.mjs @@ -4,13 +4,14 @@ export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-apiextractor-json-types": "warn", - "@azure/azure-sdk/ts-package-json-types": "warn", - "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "tsdoc/syntax": "warn", - "@azure/azure-sdk/ts-package-json-module": "off", - "@azure/azure-sdk/ts-package-json-files-required": "off", - "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + }, + }, + { + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, }, }, ]); diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/package.json b/sdk/documentintelligence/ai-document-intelligence-rest/package.json index c65e11e165ed..2747bf16dadf 100644 --- a/sdk/documentintelligence/ai-document-intelligence-rest/package.json +++ b/sdk/documentintelligence/ai-document-intelligence-rest/package.json @@ -20,7 +20,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "type": "module", "keywords": [ diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/samples-dev/buildModel.ts b/sdk/documentintelligence/ai-document-intelligence-rest/samples-dev/buildModel.ts index a50eaa0e4a3e..c6edbc8d4c3b 100644 --- a/sdk/documentintelligence/ai-document-intelligence-rest/samples-dev/buildModel.ts +++ b/sdk/documentintelligence/ai-document-intelligence-rest/samples-dev/buildModel.ts @@ -65,7 +65,10 @@ async function main() { // For simplicity, this example will only show top-level field names console.log(" Fields:"); - + if (!schema) { + console.log(" "); + continue; + } for (const [fieldName, fieldSchema] of Object.entries(schema)) { console.log(` - "${fieldName}" (${fieldSchema.type})`); console.log(` ${fieldSchema.description || ""}`); diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/samples-dev/composeModel.ts b/sdk/documentintelligence/ai-document-intelligence-rest/samples-dev/composeModel.ts index d16fca04a898..94e0ef13c850 100644 --- a/sdk/documentintelligence/ai-document-intelligence-rest/samples-dev/composeModel.ts +++ b/sdk/documentintelligence/ai-document-intelligence-rest/samples-dev/composeModel.ts @@ -77,8 +77,7 @@ async function main() { description: "A composed model that classifies purchase order documents and extracts data from them.", componentModels: modelIds, modelId: composedModelId, - - }, + } as any, }); if (isUnexpected(initialResponse)) { @@ -107,7 +106,11 @@ async function main() { // For simplicity, this example will only show top-level field names console.log(" Fields:"); - + if (!schema) { + console.log(" "); + continue; + } + for (const [fieldName, fieldSchema] of Object.entries(schema)) { console.log(` - "${fieldName}" (${fieldSchema.type})`); console.log(` ${fieldSchema.description || ""}`); diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/test/public/analysis.spec.ts b/sdk/documentintelligence/ai-document-intelligence-rest/test/public/analysis.spec.ts index 8d086d962058..94ea9148bbc3 100644 --- a/sdk/documentintelligence/ai-document-intelligence-rest/test/public/analysis.spec.ts +++ b/sdk/documentintelligence/ai-document-intelligence-rest/test/public/analysis.spec.ts @@ -993,7 +993,7 @@ describe("DocumentIntelligenceClient", () => { await poller.pollUntilDone(); - const output = await client + await client .path( "/documentModels/{modelId}/analyzeResults/{resultId}", "prebuilt-read", @@ -1063,7 +1063,9 @@ describe("DocumentIntelligenceClient", () => { assert.isArray(figures); assert.isNotEmpty(figures?.[0]); const figureId = figures?.[0].id; - assert.isDefined(figureId); + if (!figureId) { + throw new Error("Expected a figure ID."); + } const output = await client .path( diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/test/public/training.spec.ts b/sdk/documentintelligence/ai-document-intelligence-rest/test/public/training.spec.ts index 8542ee730cc2..332bb44e2679 100644 --- a/sdk/documentintelligence/ai-document-intelligence-rest/test/public/training.spec.ts +++ b/sdk/documentintelligence/ai-document-intelligence-rest/test/public/training.spec.ts @@ -5,7 +5,7 @@ import type { Recorder } from "@azure-tools/test-recorder"; import { assertEnvironmentVariable, testPollingOptions } from "@azure-tools/test-recorder"; import { createRecorder } from "./utils/recorderUtils.js"; import DocumentIntelligence from "../../src/documentIntelligence.js"; -import { assert, describe, beforeEach, afterEach, it, Context } from "vitest"; +import { assert, describe, beforeEach, afterEach, it } from "vitest"; import { getRandomNumber, containerSasUrl } from "./utils/utils.js"; import type { DocumentIntelligenceClient } from "../../src/clientDefinitions.js"; import type { @@ -231,11 +231,11 @@ describe("model management", () => { it.skip(`compose model`, async function () { // Helper function to train/validate single model async function makeModel(prefix: string): Promise> { - const modelId = recorder.variable(prefix, `${prefix}${getRandomNumber()}`); + const testModelId = recorder.variable(prefix, `${prefix}${getRandomNumber()}`); const initialResponse = await client.path("/documentModels:build").post({ body: { buildMode: "template", - modelId: modelId, + modelId: testModelId, azureBlobSource: { containerUrl: containerSasUrl(), }, @@ -245,15 +245,16 @@ describe("model management", () => { throw initialResponse.body.error; } const poller = getLongRunningPoller(client, initialResponse); - const model = ( + const { modelId, docTypes } = ( (await (await poller).pollUntilDone()).body as DocumentModelBuildOperationDetailsOutput ).result!; - assert.equal(model.modelId, modelId); - assert.equal(model.modelId, modelId); - assert.ok(model.docTypes); + assert.equal(modelId, modelId); + if (!docTypes) { + throw new Error("Expected docTypes to be defined"); + } - return { modelId: model.docTypes }; + return { modelId: docTypes }; } const modelIdDoctypeMap = await Promise.all([makeModel("input1"), makeModel("input2")]); diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.browser.config.json b/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.browser.config.json index 1b37aebc5457..75871518e3a0 100644 --- a/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.browser.config.json +++ b/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.browser.config.json @@ -1,10 +1,3 @@ { - "extends": "./.tshy/build.json", - "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts"], - "exclude": ["./test/**/node/**/*.ts"], - "compilerOptions": { - "outDir": "./dist-test/browser", - "rootDir": ".", - "skipLibCheck": true - } + "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] } diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.json b/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.json index a10f22a54c88..b186a5a177d8 100644 --- a/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.json +++ b/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.json @@ -1,9 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "include": ["./src/**/*.ts", "./src/**/*.mts", "./src/**/*.cts", "test/**/*.ts", "./test/**/*.ts"] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.samples.json b/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.samples.json new file mode 100644 index 000000000000..65c3a478e40c --- /dev/null +++ b/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure-rest/ai-document-intelligence": ["./dist/esm"] + } + } +} diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.src.json b/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.test.json b/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/documentintelligence/ai-document-intelligence-rest/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/vitest.config.ts b/sdk/documentintelligence/ai-document-intelligence-rest/vitest.config.ts index c7a030e63be0..76700c6113ec 100644 --- a/sdk/documentintelligence/ai-document-intelligence-rest/vitest.config.ts +++ b/sdk/documentintelligence/ai-document-intelligence-rest/vitest.config.ts @@ -29,5 +29,10 @@ export default defineConfig({ reportsDirectory: "coverage", }, testTimeout: 1200000, + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }); diff --git a/sdk/documentintelligence/ai-document-intelligence-rest/vitest.esm.config.ts b/sdk/documentintelligence/ai-document-intelligence-rest/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/documentintelligence/ai-document-intelligence-rest/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/documenttranslator/ai-document-translator-rest/eslint.config.mjs b/sdk/documenttranslator/ai-document-translator-rest/eslint.config.mjs index d532c7bd57d3..864298dcd2da 100644 --- a/sdk/documenttranslator/ai-document-translator-rest/eslint.config.mjs +++ b/sdk/documenttranslator/ai-document-translator-rest/eslint.config.mjs @@ -2,10 +2,11 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; export default azsdkEslint.config([ { - rules: { - "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-apiextractor-json-types": "warn", - "@azure/azure-sdk/ts-package-json-types": "warn", + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, }, }, ]); diff --git a/sdk/documenttranslator/ai-document-translator-rest/package.json b/sdk/documenttranslator/ai-document-translator-rest/package.json index ed38e7610b62..2970b0ce7909 100644 --- a/sdk/documenttranslator/ai-document-translator-rest/package.json +++ b/sdk/documenttranslator/ai-document-translator-rest/package.json @@ -67,7 +67,7 @@ "generate:client": "autorest --typescript swagger/README.md && npm run format", "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", @@ -118,7 +118,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "browser": "./dist/browser/index.js", "exports": { diff --git a/sdk/documenttranslator/ai-document-translator-rest/tsconfig.browser.config.json b/sdk/documenttranslator/ai-document-translator-rest/tsconfig.browser.config.json index f772e6eb3b76..75871518e3a0 100644 --- a/sdk/documenttranslator/ai-document-translator-rest/tsconfig.browser.config.json +++ b/sdk/documenttranslator/ai-document-translator-rest/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/documenttranslator/ai-document-translator-rest/tsconfig.json b/sdk/documenttranslator/ai-document-translator-rest/tsconfig.json index b0c6bdad9067..b186a5a177d8 100644 --- a/sdk/documenttranslator/ai-document-translator-rest/tsconfig.json +++ b/sdk/documenttranslator/ai-document-translator-rest/tsconfig.json @@ -1,12 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure-rest/ai-document-translator": ["./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/documenttranslator/ai-document-translator-rest/tsconfig.samples.json b/sdk/documenttranslator/ai-document-translator-rest/tsconfig.samples.json new file mode 100644 index 000000000000..8c537e8aedab --- /dev/null +++ b/sdk/documenttranslator/ai-document-translator-rest/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure-rest/ai-document-translator": ["./dist/esm"] + } + } +} diff --git a/sdk/documenttranslator/ai-document-translator-rest/tsconfig.src.json b/sdk/documenttranslator/ai-document-translator-rest/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/documenttranslator/ai-document-translator-rest/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/documenttranslator/ai-document-translator-rest/tsconfig.test.json b/sdk/documenttranslator/ai-document-translator-rest/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/documenttranslator/ai-document-translator-rest/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/documenttranslator/ai-document-translator-rest/vitest.config.ts b/sdk/documenttranslator/ai-document-translator-rest/vitest.config.ts index d01fdec8ac69..3e9caaad8e0c 100644 --- a/sdk/documenttranslator/ai-document-translator-rest/vitest.config.ts +++ b/sdk/documenttranslator/ai-document-translator-rest/vitest.config.ts @@ -11,6 +11,11 @@ export default mergeConfig( include: ["test/**/*.spec.ts"], hookTimeout: 5000000, testTimeout: 5000000, + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/documenttranslator/ai-document-translator-rest/vitest.esm.config.ts b/sdk/documenttranslator/ai-document-translator-rest/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/documenttranslator/ai-document-translator-rest/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/face/ai-vision-face-rest/eslint.config.mjs b/sdk/face/ai-vision-face-rest/eslint.config.mjs index c62755dd5fae..bbdf14373db4 100644 --- a/sdk/face/ai-vision-face-rest/eslint.config.mjs +++ b/sdk/face/ai-vision-face-rest/eslint.config.mjs @@ -3,9 +3,16 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; export default azsdkEslint.config([ { rules: { - "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-apiextractor-json-types": "warn", "tsdoc/syntax": "warn", + "@azure/azure-sdk/ts-modules-only-named": "warn", + }, + }, + { + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, }, }, ]); diff --git a/sdk/face/ai-vision-face-rest/package.json b/sdk/face/ai-vision-face-rest/package.json index ecccc62edf42..b1abe641de03 100644 --- a/sdk/face/ai-vision-face-rest/package.json +++ b/sdk/face/ai-vision-face-rest/package.json @@ -20,7 +20,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "type": "module", "keywords": [ diff --git a/sdk/face/ai-vision-face-rest/samples-dev/livenessSession.ts b/sdk/face/ai-vision-face-rest/samples-dev/livenessSession.ts index 47984a1cbcb3..55dd366cf36a 100644 --- a/sdk/face/ai-vision-face-rest/samples-dev/livenessSession.ts +++ b/sdk/face/ai-vision-face-rest/samples-dev/livenessSession.ts @@ -30,7 +30,7 @@ const waitForLivenessRequest = async () => { // Wait for request from client device. }; -const sendTokenToClientDevices = async (token: string) => { +const sendTokenToClientDevices = async (_token: string) => { // Send the token to client devices. }; diff --git a/sdk/face/ai-vision-face-rest/samples-dev/livenessSessionWithVerify.ts b/sdk/face/ai-vision-face-rest/samples-dev/livenessSessionWithVerify.ts index a23d5ae26baa..7d4c76242f3b 100644 --- a/sdk/face/ai-vision-face-rest/samples-dev/livenessSessionWithVerify.ts +++ b/sdk/face/ai-vision-face-rest/samples-dev/livenessSessionWithVerify.ts @@ -30,7 +30,7 @@ const waitForLivenessRequest = async () => { // Wait for request from client device. }; -const sendTokenToClientDevices = async (token: string) => { +const sendTokenToClientDevices = async (_token: string) => { // Send the token to client devices. }; diff --git a/sdk/face/ai-vision-face-rest/samples-dev/livenessSessionWithVerifyWithVerifyImage.ts b/sdk/face/ai-vision-face-rest/samples-dev/livenessSessionWithVerifyWithVerifyImage.ts index c79c8807fbd2..b2325dc463ae 100644 --- a/sdk/face/ai-vision-face-rest/samples-dev/livenessSessionWithVerifyWithVerifyImage.ts +++ b/sdk/face/ai-vision-face-rest/samples-dev/livenessSessionWithVerifyWithVerifyImage.ts @@ -31,7 +31,7 @@ const waitForLivenessRequest = async () => { // Wait for request from client device. }; -const sendTokenToClientDevices = async (token: string) => { +const sendTokenToClientDevices = async (_token: string) => { // Send the token to client devices. }; diff --git a/sdk/face/ai-vision-face-rest/tsconfig.browser.config.json b/sdk/face/ai-vision-face-rest/tsconfig.browser.config.json index 1b37aebc5457..75871518e3a0 100644 --- a/sdk/face/ai-vision-face-rest/tsconfig.browser.config.json +++ b/sdk/face/ai-vision-face-rest/tsconfig.browser.config.json @@ -1,10 +1,3 @@ { - "extends": "./.tshy/build.json", - "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts"], - "exclude": ["./test/**/node/**/*.ts"], - "compilerOptions": { - "outDir": "./dist-test/browser", - "rootDir": ".", - "skipLibCheck": true - } + "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] } diff --git a/sdk/face/ai-vision-face-rest/tsconfig.json b/sdk/face/ai-vision-face-rest/tsconfig.json index f4fd69464783..b186a5a177d8 100644 --- a/sdk/face/ai-vision-face-rest/tsconfig.json +++ b/sdk/face/ai-vision-face-rest/tsconfig.json @@ -1,18 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": ".", - "paths": { "@azure-rest/ai-vision-face": ["./src/index"] }, - "skipLibCheck": true - }, - "include": [ - "./src/**/*.ts", - "./src/**/*.mts", - "./src/**/*.cts", - "test/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" - ] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/face/ai-vision-face-rest/tsconfig.samples.json b/sdk/face/ai-vision-face-rest/tsconfig.samples.json new file mode 100644 index 000000000000..af8c542fcf6c --- /dev/null +++ b/sdk/face/ai-vision-face-rest/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure-rest/ai-vision-face": ["./dist/esm"] + } + } +} diff --git a/sdk/face/ai-vision-face-rest/tsconfig.src.json b/sdk/face/ai-vision-face-rest/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/face/ai-vision-face-rest/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/face/ai-vision-face-rest/tsconfig.test.json b/sdk/face/ai-vision-face-rest/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/face/ai-vision-face-rest/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/face/ai-vision-face-rest/vitest.config.ts b/sdk/face/ai-vision-face-rest/vitest.config.ts index b488baf19d82..a8054a252b72 100644 --- a/sdk/face/ai-vision-face-rest/vitest.config.ts +++ b/sdk/face/ai-vision-face-rest/vitest.config.ts @@ -28,5 +28,10 @@ export default defineConfig({ reportsDirectory: "coverage", }, testTimeout: 1200000, + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }); diff --git a/sdk/face/ai-vision-face-rest/vitest.esm.config.ts b/sdk/face/ai-vision-face-rest/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/face/ai-vision-face-rest/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/metricsadvisor/ai-metrics-advisor/eslint.config.mjs b/sdk/metricsadvisor/ai-metrics-advisor/eslint.config.mjs new file mode 100644 index 000000000000..864298dcd2da --- /dev/null +++ b/sdk/metricsadvisor/ai-metrics-advisor/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/metricsadvisor/ai-metrics-advisor/package.json b/sdk/metricsadvisor/ai-metrics-advisor/package.json index cd418e7b8308..93b259b66fe0 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/package.json +++ b/sdk/metricsadvisor/ai-metrics-advisor/package.json @@ -60,7 +60,7 @@ "generate:client": "autorest --typescript ./swagger/README.md && dev-tool admin migrate-source && rushx format", "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 README.md src test", "lint:fix": "eslint package.json api-extractor.json README.md src test --fix --fix-type [problem,suggestion]", "pack": "npm pack 2>&1", @@ -142,7 +142,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "exports": { "./package.json": "./package.json", diff --git a/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.browser.config.json b/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.browser.config.json index f772e6eb3b76..75871518e3a0 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.browser.config.json +++ b/sdk/metricsadvisor/ai-metrics-advisor/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/metricsadvisor/ai-metrics-advisor/tsconfig.json b/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.json index df3ba837c6e2..b186a5a177d8 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.json +++ b/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.json @@ -1,31 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure/ai-metrics-advisor": ["./src/index"] - }, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "exclude": [ - "node_modules", - "types", - "temp", - "browser", - "dist", - "dist-esm", - "./samples/**/*.ts", - "./dist-samples/**/*.ts", - "./dom-shims.d.ts" + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } ], - "include": [ - "src/**/*.ts", - "src/**/*.mts", - "src/**/*.cts", - "samples-dev/**/*.ts", - "test/**/*.ts", - "test/**/*.mts", - "test/**/*.cts" - ] + "files": [] } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.samples.json b/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.samples.json new file mode 100644 index 000000000000..6ee65625934b --- /dev/null +++ b/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/ai-metrics-advisor": ["./dist/esm"] + } + } +} diff --git a/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.src.json b/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.test.json b/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/metricsadvisor/ai-metrics-advisor/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/metricsadvisor/ai-metrics-advisor/vitest.config.ts b/sdk/metricsadvisor/ai-metrics-advisor/vitest.config.ts index f6f64e402758..a9334fc5eea4 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/vitest.config.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/vitest.config.ts @@ -12,6 +12,11 @@ export default mergeConfig( include: ["test/**/*.spec.ts"], hookTimeout: 5000000, testTimeout: 5000000, + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/metricsadvisor/ai-metrics-advisor/vitest.esm.config.ts b/sdk/metricsadvisor/ai-metrics-advisor/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/metricsadvisor/ai-metrics-advisor/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/textanalytics/ai-text-analytics/eslint.config.mjs b/sdk/textanalytics/ai-text-analytics/eslint.config.mjs new file mode 100644 index 000000000000..864298dcd2da --- /dev/null +++ b/sdk/textanalytics/ai-text-analytics/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/textanalytics/ai-text-analytics/package.json b/sdk/textanalytics/ai-text-analytics/package.json index 0227363dbd2b..032ac26270fe 100644 --- a/sdk/textanalytics/ai-text-analytics/package.json +++ b/sdk/textanalytics/ai-text-analytics/package.json @@ -71,7 +71,7 @@ "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", "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", @@ -126,7 +126,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "exports": { "./package.json": "./package.json", diff --git a/sdk/textanalytics/ai-text-analytics/tsconfig.browser.config.json b/sdk/textanalytics/ai-text-analytics/tsconfig.browser.config.json index f772e6eb3b76..75871518e3a0 100644 --- a/sdk/textanalytics/ai-text-analytics/tsconfig.browser.config.json +++ b/sdk/textanalytics/ai-text-analytics/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/textanalytics/ai-text-analytics/tsconfig.json b/sdk/textanalytics/ai-text-analytics/tsconfig.json index 0b505e82726e..b186a5a177d8 100644 --- a/sdk/textanalytics/ai-text-analytics/tsconfig.json +++ b/sdk/textanalytics/ai-text-analytics/tsconfig.json @@ -1,20 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure/ai-text-analytics": ["./src/index"] - }, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "include": [ - "src/**/*.ts", - "src/**/*.mts", - "src/**/*.cts", - "samples-dev/**/*.ts", - "test/**/*.ts", - "test/**/*.mts", - "test/**/*.cts" - ] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/textanalytics/ai-text-analytics/tsconfig.samples.json b/sdk/textanalytics/ai-text-analytics/tsconfig.samples.json new file mode 100644 index 000000000000..a8cc0e033ca0 --- /dev/null +++ b/sdk/textanalytics/ai-text-analytics/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/ai-text-analytics": ["./dist/esm"] + } + } +} diff --git a/sdk/textanalytics/ai-text-analytics/tsconfig.src.json b/sdk/textanalytics/ai-text-analytics/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/textanalytics/ai-text-analytics/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/textanalytics/ai-text-analytics/tsconfig.test.json b/sdk/textanalytics/ai-text-analytics/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/textanalytics/ai-text-analytics/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/textanalytics/ai-text-analytics/vitest.config.ts b/sdk/textanalytics/ai-text-analytics/vitest.config.ts index d01fdec8ac69..3e9caaad8e0c 100644 --- a/sdk/textanalytics/ai-text-analytics/vitest.config.ts +++ b/sdk/textanalytics/ai-text-analytics/vitest.config.ts @@ -11,6 +11,11 @@ export default mergeConfig( include: ["test/**/*.spec.ts"], hookTimeout: 5000000, testTimeout: 5000000, + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/textanalytics/ai-text-analytics/vitest.esm.config.ts b/sdk/textanalytics/ai-text-analytics/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/textanalytics/ai-text-analytics/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/translation/ai-translation-text-rest/eslint.config.mjs b/sdk/translation/ai-translation-text-rest/eslint.config.mjs index 699816467a91..864298dcd2da 100644 --- a/sdk/translation/ai-translation-text-rest/eslint.config.mjs +++ b/sdk/translation/ai-translation-text-rest/eslint.config.mjs @@ -2,12 +2,11 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; export default azsdkEslint.config([ { - rules: { - "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-apiextractor-json-types": "warn", - "@azure/azure-sdk/ts-package-json-types": "warn", - "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "tsdoc/syntax": "warn", + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, }, }, ]); diff --git a/sdk/translation/ai-translation-text-rest/package.json b/sdk/translation/ai-translation-text-rest/package.json index 96328a06c0ef..6d7b111f051c 100644 --- a/sdk/translation/ai-translation-text-rest/package.json +++ b/sdk/translation/ai-translation-text-rest/package.json @@ -57,7 +57,7 @@ "generate:client": "echo skipped", "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", @@ -117,7 +117,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "browser": "./dist/browser/index.js", "exports": { diff --git a/sdk/translation/ai-translation-text-rest/tsconfig.browser.config.json b/sdk/translation/ai-translation-text-rest/tsconfig.browser.config.json index f772e6eb3b76..75871518e3a0 100644 --- a/sdk/translation/ai-translation-text-rest/tsconfig.browser.config.json +++ b/sdk/translation/ai-translation-text-rest/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/translation/ai-translation-text-rest/tsconfig.json b/sdk/translation/ai-translation-text-rest/tsconfig.json index 1280d8197838..b186a5a177d8 100644 --- a/sdk/translation/ai-translation-text-rest/tsconfig.json +++ b/sdk/translation/ai-translation-text-rest/tsconfig.json @@ -1,12 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure-rest/ai-translation-text": ["./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/translation/ai-translation-text-rest/tsconfig.samples.json b/sdk/translation/ai-translation-text-rest/tsconfig.samples.json new file mode 100644 index 000000000000..9f564fe96538 --- /dev/null +++ b/sdk/translation/ai-translation-text-rest/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure-rest/ai-translation-text": ["./dist/esm"] + } + } +} diff --git a/sdk/translation/ai-translation-text-rest/tsconfig.src.json b/sdk/translation/ai-translation-text-rest/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/translation/ai-translation-text-rest/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/translation/ai-translation-text-rest/tsconfig.test.json b/sdk/translation/ai-translation-text-rest/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/translation/ai-translation-text-rest/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/translation/ai-translation-text-rest/vitest.config.ts b/sdk/translation/ai-translation-text-rest/vitest.config.ts index d01fdec8ac69..3e9caaad8e0c 100644 --- a/sdk/translation/ai-translation-text-rest/vitest.config.ts +++ b/sdk/translation/ai-translation-text-rest/vitest.config.ts @@ -11,6 +11,11 @@ export default mergeConfig( include: ["test/**/*.spec.ts"], hookTimeout: 5000000, testTimeout: 5000000, + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/translation/ai-translation-text-rest/vitest.esm.config.ts b/sdk/translation/ai-translation-text-rest/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/translation/ai-translation-text-rest/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/vision/ai-vision-image-analysis-rest/eslint.config.mjs b/sdk/vision/ai-vision-image-analysis-rest/eslint.config.mjs index 699816467a91..864298dcd2da 100644 --- a/sdk/vision/ai-vision-image-analysis-rest/eslint.config.mjs +++ b/sdk/vision/ai-vision-image-analysis-rest/eslint.config.mjs @@ -2,12 +2,11 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; export default azsdkEslint.config([ { - rules: { - "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-apiextractor-json-types": "warn", - "@azure/azure-sdk/ts-package-json-types": "warn", - "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "tsdoc/syntax": "warn", + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.test.json"], + }, }, }, ]); diff --git a/sdk/vision/ai-vision-image-analysis-rest/package.json b/sdk/vision/ai-vision-image-analysis-rest/package.json index ab2df31d416b..839d97a562b9 100644 --- a/sdk/vision/ai-vision-image-analysis-rest/package.json +++ b/sdk/vision/ai-vision-image-analysis-rest/package.json @@ -44,7 +44,7 @@ "generate:client": "echo skipped", "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", @@ -105,7 +105,8 @@ "browser", "react-native" ], - "selfLink": false + "selfLink": false, + "project": "./tsconfig.src.json" }, "exports": { "./package.json": "./package.json", diff --git a/sdk/vision/ai-vision-image-analysis-rest/tsconfig.browser.config.json b/sdk/vision/ai-vision-image-analysis-rest/tsconfig.browser.config.json index f772e6eb3b76..75871518e3a0 100644 --- a/sdk/vision/ai-vision-image-analysis-rest/tsconfig.browser.config.json +++ b/sdk/vision/ai-vision-image-analysis-rest/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/vision/ai-vision-image-analysis-rest/tsconfig.json b/sdk/vision/ai-vision-image-analysis-rest/tsconfig.json index 06f7ae3c1385..b186a5a177d8 100644 --- a/sdk/vision/ai-vision-image-analysis-rest/tsconfig.json +++ b/sdk/vision/ai-vision-image-analysis-rest/tsconfig.json @@ -1,20 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "paths": { - "@azure-rest/ai-vision-image-analysis": ["./src/index"] - }, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "rootDir": "." - }, - "include": [ - "src/**/*.ts", - "src/**/*.mts", - "src/**/*.cts", - "samples-dev/**/*.ts", - "test/**/*.ts", - "test/**/*.mts", - "test/**/*.cts" - ] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.test.json" } + ], + "files": [] } diff --git a/sdk/vision/ai-vision-image-analysis-rest/tsconfig.samples.json b/sdk/vision/ai-vision-image-analysis-rest/tsconfig.samples.json new file mode 100644 index 000000000000..94666c1b5d05 --- /dev/null +++ b/sdk/vision/ai-vision-image-analysis-rest/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure-rest/ai-vision-image-analysis": ["./dist/esm"] + } + } +} diff --git a/sdk/vision/ai-vision-image-analysis-rest/tsconfig.src.json b/sdk/vision/ai-vision-image-analysis-rest/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/vision/ai-vision-image-analysis-rest/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/vision/ai-vision-image-analysis-rest/tsconfig.test.json b/sdk/vision/ai-vision-image-analysis-rest/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/vision/ai-vision-image-analysis-rest/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/vision/ai-vision-image-analysis-rest/vitest.config.ts b/sdk/vision/ai-vision-image-analysis-rest/vitest.config.ts index d01fdec8ac69..3e9caaad8e0c 100644 --- a/sdk/vision/ai-vision-image-analysis-rest/vitest.config.ts +++ b/sdk/vision/ai-vision-image-analysis-rest/vitest.config.ts @@ -11,6 +11,11 @@ export default mergeConfig( include: ["test/**/*.spec.ts"], hookTimeout: 5000000, testTimeout: 5000000, + typecheck: { + enabled: true, + tsconfig: "tsconfig.test.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + }, }, }), ); diff --git a/sdk/vision/ai-vision-image-analysis-rest/vitest.esm.config.ts b/sdk/vision/ai-vision-image-analysis-rest/vitest.esm.config.ts new file mode 100644 index 000000000000..2f6e757a54f7 --- /dev/null +++ b/sdk/vision/ai-vision-image-analysis-rest/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 +);