Skip to content

Commit

Permalink
[Event Hubs] Precise Typechecking (#32056)
Browse files Browse the repository at this point in the history
  • Loading branch information
deyaaeldeen authored Dec 4, 2024
1 parent ec3cb6b commit 361b8cd
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 21 deletions.
16 changes: 16 additions & 0 deletions sdk/eventhub/event-hubs/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
];
1 change: 1 addition & 0 deletions sdk/eventhub/event-hubs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
}
},
"tshy": {
"project": "tsconfig.src.json",
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
Expand Down
8 changes: 4 additions & 4 deletions sdk/eventhub/event-hubs/tsconfig.browser.config.json
Original file line number Diff line number Diff line change
@@ -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
}
}
23 changes: 6 additions & 17 deletions sdk/eventhub/event-hubs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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": []
}
14 changes: 14 additions & 0 deletions sdk/eventhub/event-hubs/tsconfig.samples.json
Original file line number Diff line number Diff line change
@@ -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"]
}
10 changes: 10 additions & 0 deletions sdk/eventhub/event-hubs/tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../../tsconfig",
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noFallthroughCasesInSwitch": false,
"composite": true
},
"include": ["./src"]
}
15 changes: 15 additions & 0 deletions sdk/eventhub/event-hubs/tsconfig.tests.json
Original file line number Diff line number Diff line change
@@ -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*"]
}
6 changes: 6 additions & 0 deletions sdk/eventhub/event-hubs/vitest.browser.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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"),
},
},
});
5 changes: 5 additions & 0 deletions sdk/eventhub/event-hubs/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export default mergeConfig(
"Date",
],
},
typecheck: {
enabled: true,
tsconfig: "tsconfig.tests.json",
include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"],
}
},
})
);

0 comments on commit 361b8cd

Please sign in to comment.