diff --git a/sdk/attestation/attestation/eslint.config.mjs b/sdk/attestation/attestation/eslint.config.mjs
new file mode 100644
index 000000000000..864298dcd2da
--- /dev/null
+++ b/sdk/attestation/attestation/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/attestation/attestation/package.json b/sdk/attestation/attestation/package.json
index 1c15937c8678..65b0ef0c72c9 100644
--- a/sdk/attestation/attestation/package.json
+++ b/sdk/attestation/attestation/package.json
@@ -34,7 +34,7 @@
"generate:client": "autorest --typescript ./swagger/README.md",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:browser": "dev-tool run test:vitest --browser",
- "integration-test:node": "dev-tool run test:vitest -- --test-timeout 5000000",
+ "integration-test:node": "dev-tool run test:vitest --esm -- --test-timeout 5000000",
"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/attestation/attestation/samples-dev/modifyPolicyManagementCertificates.ts b/sdk/attestation/attestation/samples-dev/modifyPolicyManagementCertificates.ts
index 3bab4208e766..e045b838dd5b 100644
--- a/sdk/attestation/attestation/samples-dev/modifyPolicyManagementCertificates.ts
+++ b/sdk/attestation/attestation/samples-dev/modifyPolicyManagementCertificates.ts
@@ -37,9 +37,12 @@ import { X509 } from "jsrsasign";
// Load environment from a .env file if it exists.
import * as dotenv from "dotenv";
import { writeBanner } from "./utils/helpers.js";
-import { byteArrayToHex } from "../src/utils/base64.js";
dotenv.config();
+function byteArrayToHex(value: Uint8Array): string {
+ return value.reduce((str, byte) => str + byte.toString(16).padStart(2, "0"), "");
+}
+
async function modifyPolicyManagementCertificates() {
writeBanner("Get Current Attestation Policy Management Certificates.");
diff --git a/sdk/attestation/attestation/samples-dev/utils/cryptoUtils.ts b/sdk/attestation/attestation/samples-dev/utils/cryptoUtils.ts
index 16d52e84cf8b..bbe7a9d34dd8 100644
--- a/sdk/attestation/attestation/samples-dev/utils/cryptoUtils.ts
+++ b/sdk/attestation/attestation/samples-dev/utils/cryptoUtils.ts
@@ -5,7 +5,16 @@
///
import * as jsrsasign from "jsrsasign";
-import { hexToByteArray } from "../../src/utils/base64.js";
+function hexToByteArray(value: string): Uint8Array {
+ if (value.length % 2 !== 0) {
+ throw new Error("base64FromHex: Input must be a multiple of 2 characters");
+ }
+ const byteArray = new Array();
+ for (let i = 0; i < value.length; i += 2) {
+ byteArray.push(parseInt(value.substr(i, 2), 16));
+ }
+ return Uint8Array.from(byteArray);
+}
export function createECDSKey(): [string, string] {
const keyPair = jsrsasign.KEYUTIL.generateKeypair("EC", "secp256r1");
diff --git a/sdk/attestation/attestation/src/attestationAdministrationClient.ts b/sdk/attestation/attestation/src/attestationAdministrationClient.ts
index 73b26ece9c01..28df7c769e9c 100644
--- a/sdk/attestation/attestation/src/attestationAdministrationClient.ts
+++ b/sdk/attestation/attestation/src/attestationAdministrationClient.ts
@@ -29,7 +29,6 @@ import type { TokenCredential } from "@azure/core-auth";
import { TypeDeserializer } from "./utils/typeDeserializer.js";
import * as Mappers from "./generated/models/mappers.js";
-// eslint-disable-next-line @typescript-eslint/triple-slash-reference
///
import * as jsrsasign from "jsrsasign";
import { hexToBase64 } from "./utils/helpers.js";
diff --git a/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts b/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts
index 51c1c280b706..73ac9b1cdd58 100644
--- a/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts
+++ b/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts
@@ -4,7 +4,6 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
///
import * as jsrsasign from "jsrsasign";
-/* eslint-disable @typescript-eslint/no-invalid-this */
import { Recorder, isLiveMode } from "@azure-tools/test-recorder";
diff --git a/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts b/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts
index 9a1a18b82c4a..f4da845e215c 100644
--- a/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts
+++ b/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
-/* eslint-disable @typescript-eslint/no-invalid-this */
import { Recorder, isLiveMode } from "@azure-tools/test-recorder";
@@ -12,7 +11,6 @@ import {
import { createRSAKey, createX509Certificate, generateSha1Hash } from "../utils/cryptoUtils.js";
import { KnownCertificateModification } from "../../src/generated/index.js";
-// eslint-disable-next-line @typescript-eslint/triple-slash-reference
///
import * as jsrsasign from "jsrsasign";
import { byteArrayToHex } from "../../src/utils/base64.js";
diff --git a/sdk/attestation/attestation/tsconfig.browser.config.json b/sdk/attestation/attestation/tsconfig.browser.config.json
index f772e6eb3b76..75871518e3a0 100644
--- a/sdk/attestation/attestation/tsconfig.browser.config.json
+++ b/sdk/attestation/attestation/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/attestation/attestation/tsconfig.json b/sdk/attestation/attestation/tsconfig.json
index 66b3c92a926e..b186a5a177d8 100644
--- a/sdk/attestation/attestation/tsconfig.json
+++ b/sdk/attestation/attestation/tsconfig.json
@@ -1,19 +1,9 @@
{
"extends": "../../../tsconfig",
- "compilerOptions": {
- "paths": {
- "@azure/attestation": ["./src/index"]
- },
- "module": "NodeNext",
- "moduleResolution": "NodeNext",
- "rootDir": "."
- },
- "include": [
- "src/**/*.ts",
- "src/**/*.mts",
- "src/**/*.cts",
- "samples-dev/**/*.ts",
- "test/**/*.ts",
- "test/**/*.mts"
- ]
+ "references": [
+ { "path": "./tsconfig.src.json" },
+ { "path": "./tsconfig.samples.json" },
+ { "path": "./tsconfig.test.json" }
+ ],
+ "files": []
}
diff --git a/sdk/attestation/attestation/tsconfig.samples.json b/sdk/attestation/attestation/tsconfig.samples.json
new file mode 100644
index 000000000000..9036fdc9f484
--- /dev/null
+++ b/sdk/attestation/attestation/tsconfig.samples.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../../../tsconfig.samples.base.json",
+ "compilerOptions": {
+ "paths": {
+ "@azure/attestation": ["./dist/esm"]
+ }
+ }
+}
diff --git a/sdk/attestation/attestation/tsconfig.src.json b/sdk/attestation/attestation/tsconfig.src.json
new file mode 100644
index 000000000000..bae70752dd38
--- /dev/null
+++ b/sdk/attestation/attestation/tsconfig.src.json
@@ -0,0 +1,3 @@
+{
+ "extends": "../../../tsconfig.lib.json"
+}
diff --git a/sdk/attestation/attestation/tsconfig.test.json b/sdk/attestation/attestation/tsconfig.test.json
new file mode 100644
index 000000000000..290ca214aebc
--- /dev/null
+++ b/sdk/attestation/attestation/tsconfig.test.json
@@ -0,0 +1,3 @@
+{
+ "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"]
+}
diff --git a/sdk/attestation/attestation/vitest.config.ts b/sdk/attestation/attestation/vitest.config.ts
index 39267dd2f56f..0149e8b85f90 100644
--- a/sdk/attestation/attestation/vitest.config.ts
+++ b/sdk/attestation/attestation/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/attestation/attestation/vitest.esm.config.ts b/sdk/attestation/attestation/vitest.esm.config.ts
new file mode 100644
index 000000000000..2f6e757a54f7
--- /dev/null
+++ b/sdk/attestation/attestation/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
+);