diff --git a/sdk/eventhub/event-hubs/eslint.config.mjs b/sdk/eventhub/event-hubs/eslint.config.mjs index 7e3423cb8ba8..8a832e155861 100644 --- a/sdk/eventhub/event-hubs/eslint.config.mjs +++ b/sdk/eventhub/event-hubs/eslint.config.mjs @@ -10,4 +10,20 @@ export default [ "@azure/azure-sdk/ts-package-json-types": "off", }, }, + { + files: ["**/*.ts", "**/*.cts", "**/*.mts"], + languageOptions: { + parserOptions: { + project: ["./tsconfig.src.json", "./tsconfig.tests.json"], + }, + }, + }, + { + files: ["*.md/*.ts"], + languageOptions: { + parserOptions: { + project: null, + }, + }, + }, ]; diff --git a/sdk/eventhub/event-hubs/package.json b/sdk/eventhub/event-hubs/package.json index 862c37f5d36f..4f9f040a48a6 100644 --- a/sdk/eventhub/event-hubs/package.json +++ b/sdk/eventhub/event-hubs/package.json @@ -87,6 +87,7 @@ } }, "tshy": { + "project": "tsconfig.src.json", "exports": { "./package.json": "./package.json", ".": "./src/index.ts" diff --git a/sdk/eventhub/event-hubs/tsconfig.browser.config.json b/sdk/eventhub/event-hubs/tsconfig.browser.config.json index ca3c2e5eb5be..d5abae97d0fe 100644 --- a/sdk/eventhub/event-hubs/tsconfig.browser.config.json +++ b/sdk/eventhub/event-hubs/tsconfig.browser.config.json @@ -1,10 +1,10 @@ { - "extends": "./.tshy/build.json", - "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.ts"], - "exclude": ["./test/**/node/**/*.ts", "./test/stress*"], + "extends": ["./.tshy/build.json", "./tsconfig.tests.json"], + "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.ts", "./test/**/*.mts"], + "exclude": ["./test/**/node/**/*.ts", "./test/stress"], "compilerOptions": { "outDir": "./dist-test/browser", "rootDir": ".", - "skipLibCheck": true + "noEmit": false } } diff --git a/sdk/eventhub/event-hubs/tsconfig.json b/sdk/eventhub/event-hubs/tsconfig.json index 8603a00d6918..dc1db702a3b7 100644 --- a/sdk/eventhub/event-hubs/tsconfig.json +++ b/sdk/eventhub/event-hubs/tsconfig.json @@ -1,20 +1,9 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "module": "NodeNext", - "moduleResolution": "NodeNext", - "resolveJsonModule": true, - "noFallthroughCasesInSwitch": false, - "paths": { - "@azure/event-hubs": ["./src/index"] - } - }, - "exclude": ["test/stress*"], - "include": [ - "./src/**/*.ts", - "./src/**/*.mts", - "./src/**/*.cts", - "./test/**/*.ts", - "./samples-dev/**/*.ts" - ] + "references": [ + { "path": "./tsconfig.src.json" }, + { "path": "./tsconfig.samples.json" }, + { "path": "./tsconfig.tests.json" } + ], + "files": [] } diff --git a/sdk/eventhub/event-hubs/tsconfig.samples.json b/sdk/eventhub/event-hubs/tsconfig.samples.json new file mode 100644 index 000000000000..698d8a2d83d7 --- /dev/null +++ b/sdk/eventhub/event-hubs/tsconfig.samples.json @@ -0,0 +1,14 @@ +{ + "extends": "../../../tsconfig", + "compilerOptions": { + "target": "ES2023", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "paths": { + "@azure/event-hubs": ["./dist/esm"] + }, + "noEmit": true, + "composite": true + }, + "include": ["./samples-dev"] +} diff --git a/sdk/eventhub/event-hubs/tsconfig.src.json b/sdk/eventhub/event-hubs/tsconfig.src.json new file mode 100644 index 000000000000..132f35c591c9 --- /dev/null +++ b/sdk/eventhub/event-hubs/tsconfig.src.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig", + "compilerOptions": { + "module": "NodeNext", + "moduleResolution": "NodeNext", + "noFallthroughCasesInSwitch": false, + "composite": true + }, + "include": ["./src"] +} diff --git a/sdk/eventhub/event-hubs/tsconfig.tests.json b/sdk/eventhub/event-hubs/tsconfig.tests.json new file mode 100644 index 000000000000..bfb69e7d7998 --- /dev/null +++ b/sdk/eventhub/event-hubs/tsconfig.tests.json @@ -0,0 +1,15 @@ +{ + "extends": ["../../../tsconfig", "./tsconfig.src.json"], + "compilerOptions": { + "target": "ES2023", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "lib": ["DOM"], + "resolveJsonModule": true, + "skipLibCheck": true, + "noEmit": true, + "composite": true + }, + "include": ["./test", "./src"], + "exclude": ["./test/stress*"] +} diff --git a/sdk/eventhub/event-hubs/vitest.browser.config.ts b/sdk/eventhub/event-hubs/vitest.browser.config.ts index 70b8a6fb222d..72ddf1a096bc 100644 --- a/sdk/eventhub/event-hubs/vitest.browser.config.ts +++ b/sdk/eventhub/event-hubs/vitest.browser.config.ts @@ -4,6 +4,7 @@ import { defineConfig } from "vitest/config"; import browserMap from "@azure-tools/vite-plugin-browser-test-map"; import inject from "@rollup/plugin-inject"; +import { resolve } from "node:path"; export default defineConfig({ define: { @@ -44,5 +45,10 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage-browser", }, + alias: { + "@azure/event-hubs": resolve("./dist/browser/index.js"), + "../../../src": resolve("./dist/browser"), + "../../src": resolve("./dist/browser"), + }, }, }); diff --git a/sdk/eventhub/event-hubs/vitest.config.ts b/sdk/eventhub/event-hubs/vitest.config.ts index 42d44c862c24..9cb723f3fc9a 100644 --- a/sdk/eventhub/event-hubs/vitest.config.ts +++ b/sdk/eventhub/event-hubs/vitest.config.ts @@ -30,6 +30,11 @@ export default mergeConfig( "Date", ], }, + typecheck: { + enabled: true, + tsconfig: "tsconfig.tests.json", + include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], + } }, }) );