From d4bf741f70fad137e8af6b76013c79be8b4f4482 Mon Sep 17 00:00:00 2001 From: Timothy Shamilov Date: Wed, 29 Nov 2023 20:32:49 -0500 Subject: [PATCH] fix tsconfig errors (#306) * cleanup tsc settings * add base tsconfig to DRY up tsconfigs. build sourcemaps for all. * DRY up remaining repeated fields * strict false for web5spec * Minor fix to remove trailing commas from JSON --------- Co-authored-by: Frank Hinek --- .web5-spec/tsconfig.json | 17 ++--------------- package-lock.json | 18 +++++++++--------- packages/agent/src/dwn-manager.ts | 3 ++- packages/agent/tsconfig.cjs.json | 2 +- packages/agent/tsconfig.json | 20 +++----------------- packages/api/tsconfig.cjs.json | 2 +- packages/api/tsconfig.json | 21 ++++----------------- packages/common/tsconfig.json | 20 +++----------------- packages/credentials/tsconfig.cjs.json | 2 +- packages/credentials/tsconfig.json | 20 +++----------------- packages/crypto/tsconfig.cjs.json | 2 +- packages/crypto/tsconfig.json | 17 ++--------------- packages/dids/tsconfig.cjs.json | 2 +- packages/dids/tsconfig.json | 18 ++++-------------- packages/identity-agent/tsconfig.cjs.json | 2 +- packages/identity-agent/tsconfig.json | 18 ++---------------- packages/proxy-agent/tsconfig.cjs.json | 2 +- packages/proxy-agent/tsconfig.json | 17 ++--------------- packages/user-agent/tsconfig.cjs.json | 2 +- packages/user-agent/tsconfig.json | 20 +++----------------- tsconfig.json | 20 ++++++++++++++++++++ 21 files changed, 67 insertions(+), 178 deletions(-) create mode 100644 tsconfig.json diff --git a/.web5-spec/tsconfig.json b/.web5-spec/tsconfig.json index 46b6bcd42..c5fdbea07 100644 --- a/.web5-spec/tsconfig.json +++ b/.web5-spec/tsconfig.json @@ -1,22 +1,9 @@ { + "extends": "../tsconfig.json", "compilerOptions": { - // "strict": true, - "lib": [ - "DOM", - "ES6" - ], - "allowJs": true, - "target": "es6", - "module": "NodeNext", - "declaration": true, - "declarationMap": true, "declarationDir": "dist/types", "outDir": "dist", - // `NodeNext` will throw compilation errors if relative import paths are missing file extension - // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js - "moduleResolution": "NodeNext", - "esModuleInterop": true, - "resolveJsonModule": true + "strict": false }, "include": [ "main.ts", diff --git a/package-lock.json b/package-lock.json index 1070b6998..7aa262e3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1118,9 +1118,9 @@ } }, "node_modules/@types/dns-packet": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/@types/dns-packet/-/dns-packet-5.6.3.tgz", - "integrity": "sha512-T7YsGU31kUqAeN5SzfJxapsTAVCXucSb4QsnB7wcbFBpdm7Y77r/5SBrUpdT3Ng22pgxJtLljtQtBvkP5BiSqg==", + "version": "5.6.4", + "resolved": "https://registry.npmjs.org/@types/dns-packet/-/dns-packet-5.6.4.tgz", + "integrity": "sha512-R0ORTvCCeujG+upKfV4JlvozKLdQWlpsducXGd1L6ezBChwpjSj9K84F+KoMDsZQ9RhOLTR1hnNrwJHWagY24g==", "dev": true, "dependencies": { "@types/node": "*" @@ -1187,9 +1187,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.10.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.0.tgz", - "integrity": "sha512-D0WfRmU9TQ8I9PFx9Yc+EBHw+vSpIub4IDvQivcp26PtPrdMGAq5SDcpXEo/epqa/DXotVpekHiLNTg3iaKXBQ==", + "version": "20.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.1.tgz", + "integrity": "sha512-T2qwhjWwGH81vUEx4EXmBKsTJRXFXNZTL4v0gi01+zyBmCwzE6TyHszqX01m+QHTEq+EZNo13NeJIdEqf+Myrg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3419,9 +3419,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.596", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.596.tgz", - "integrity": "sha512-zW3zbZ40Icb2BCWjm47nxwcFGYlIgdXkAx85XDO7cyky9J4QQfq8t0W19/TLZqq3JPQXtlv8BPIGmfa9Jb4scg==", + "version": "1.4.597", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.597.tgz", + "integrity": "sha512-0XOQNqHhg2YgRVRUrS4M4vWjFCFIP2ETXcXe/0KIQBjXE9Cpy+tgzzYfuq6HGai3hWq0YywtG+5XK8fyG08EjA==", "dev": true, "peer": true }, diff --git a/packages/agent/src/dwn-manager.ts b/packages/agent/src/dwn-manager.ts index 33699674a..d5888c11c 100644 --- a/packages/agent/src/dwn-manager.ts +++ b/packages/agent/src/dwn-manager.ts @@ -1,3 +1,5 @@ +import type { Readable } from 'readable-stream'; + import { Signer, GenericMessage, @@ -10,7 +12,6 @@ import { import { Jose } from '@web5/crypto'; import { Convert } from '@web5/common'; import { DidResolver } from '@web5/dids'; -import { Readable } from 'readable-stream'; import { utils as didUtils } from '@web5/dids'; import { diff --git a/packages/agent/tsconfig.cjs.json b/packages/agent/tsconfig.cjs.json index 7a6f9c0c0..966f80c2b 100644 --- a/packages/agent/tsconfig.cjs.json +++ b/packages/agent/tsconfig.cjs.json @@ -3,7 +3,7 @@ "compilerOptions": { "lib": [ "DOM", - "ES5", + "ES5" ], "target": "ES5", "module": "CommonJS", diff --git a/packages/agent/tsconfig.json b/packages/agent/tsconfig.json index b29e4e7e1..23ed4ccf6 100644 --- a/packages/agent/tsconfig.json +++ b/packages/agent/tsconfig.json @@ -1,25 +1,11 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "lib": [ - "DOM", - "ES6" - ], - "allowJs": true, - "target": "es6", - "module": "ESNext", // Required for enabling JavaScript import assertion support - "declaration": true, - "declarationMap": true, "declarationDir": "dist/types", - "outDir": "dist/esm", - "sourceMap": true, - // `NodeNext` will throw compilation errors if relative import paths are missing file extension - // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js - "moduleResolution": "NodeNext", - "esModuleInterop": true + "outDir": "dist/esm" }, "include": [ - "src", + "src" ], "exclude": [ "node_modules" diff --git a/packages/api/tsconfig.cjs.json b/packages/api/tsconfig.cjs.json index 7a6f9c0c0..966f80c2b 100644 --- a/packages/api/tsconfig.cjs.json +++ b/packages/api/tsconfig.cjs.json @@ -3,7 +3,7 @@ "compilerOptions": { "lib": [ "DOM", - "ES5", + "ES5" ], "target": "ES5", "module": "CommonJS", diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 334d87aa4..0701f4d02 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -1,25 +1,12 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - // "strict": true, - "lib": [ - "DOM", - "ES6" - ], - "allowJs": true, - "target": "es6", - "module": "ESNext", - "declaration": true, - "declarationMap": true, + "strict": false, "declarationDir": "dist/types", - "outDir": "dist/esm", - // `NodeNext` will throw compilation errors if relative import paths are missing file extension - // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js - "moduleResolution": "NodeNext", - "esModuleInterop": true, - "resolveJsonModule": true + "outDir": "dist/esm" }, "include": [ - "src", + "src" ], "exclude": [ "node_modules" diff --git a/packages/common/tsconfig.json b/packages/common/tsconfig.json index b29e4e7e1..23ed4ccf6 100644 --- a/packages/common/tsconfig.json +++ b/packages/common/tsconfig.json @@ -1,25 +1,11 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "lib": [ - "DOM", - "ES6" - ], - "allowJs": true, - "target": "es6", - "module": "ESNext", // Required for enabling JavaScript import assertion support - "declaration": true, - "declarationMap": true, "declarationDir": "dist/types", - "outDir": "dist/esm", - "sourceMap": true, - // `NodeNext` will throw compilation errors if relative import paths are missing file extension - // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js - "moduleResolution": "NodeNext", - "esModuleInterop": true + "outDir": "dist/esm" }, "include": [ - "src", + "src" ], "exclude": [ "node_modules" diff --git a/packages/credentials/tsconfig.cjs.json b/packages/credentials/tsconfig.cjs.json index 0384273d6..70f5f4067 100644 --- a/packages/credentials/tsconfig.cjs.json +++ b/packages/credentials/tsconfig.cjs.json @@ -3,7 +3,7 @@ "compilerOptions": { "lib": [ "DOM", - "ES5", + "ES5" ], "target": "ES5", "module": "CommonJS", diff --git a/packages/credentials/tsconfig.json b/packages/credentials/tsconfig.json index b29e4e7e1..23ed4ccf6 100644 --- a/packages/credentials/tsconfig.json +++ b/packages/credentials/tsconfig.json @@ -1,25 +1,11 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "lib": [ - "DOM", - "ES6" - ], - "allowJs": true, - "target": "es6", - "module": "ESNext", // Required for enabling JavaScript import assertion support - "declaration": true, - "declarationMap": true, "declarationDir": "dist/types", - "outDir": "dist/esm", - "sourceMap": true, - // `NodeNext` will throw compilation errors if relative import paths are missing file extension - // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js - "moduleResolution": "NodeNext", - "esModuleInterop": true + "outDir": "dist/esm" }, "include": [ - "src", + "src" ], "exclude": [ "node_modules" diff --git a/packages/crypto/tsconfig.cjs.json b/packages/crypto/tsconfig.cjs.json index 7a6f9c0c0..966f80c2b 100644 --- a/packages/crypto/tsconfig.cjs.json +++ b/packages/crypto/tsconfig.cjs.json @@ -3,7 +3,7 @@ "compilerOptions": { "lib": [ "DOM", - "ES5", + "ES5" ], "target": "ES5", "module": "CommonJS", diff --git a/packages/crypto/tsconfig.json b/packages/crypto/tsconfig.json index 7fec77c5f..23ed4ccf6 100644 --- a/packages/crypto/tsconfig.json +++ b/packages/crypto/tsconfig.json @@ -1,21 +1,8 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "lib": [ - "DOM", - "ES6" - ], - "allowJs": true, - "target": "es6", - "module": "ESNext", // Required for enabling JavaScript import assertion support - "declaration": true, - "declarationMap": true, "declarationDir": "dist/types", - "outDir": "dist/esm", - // `NodeNext` will throw compilation errors if relative import paths are missing file extension - // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js - "moduleResolution": "NodeNext", - "esModuleInterop": true + "outDir": "dist/esm" }, "include": [ "src" diff --git a/packages/dids/tsconfig.cjs.json b/packages/dids/tsconfig.cjs.json index e34b3674f..63f6f61a4 100644 --- a/packages/dids/tsconfig.cjs.json +++ b/packages/dids/tsconfig.cjs.json @@ -3,7 +3,7 @@ "compilerOptions": { "lib": [ "DOM", - "ES5", + "ES5" ], "target": "ES5", "module": "CommonJS", diff --git a/packages/dids/tsconfig.json b/packages/dids/tsconfig.json index 35564adee..3226cdc66 100644 --- a/packages/dids/tsconfig.json +++ b/packages/dids/tsconfig.json @@ -1,19 +1,9 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "lib": [ - "DOM", - "ES6" - ], - "target": "es6", - "module": "ESNext", // Required for enabling JavaScript import assertion support - "declaration": true, - "declarationMap": true, + "strict": false, "declarationDir": "dist/types", - "outDir": "dist/esm", - // `NodeNext` will throw compilation errors if relative import paths are missing file extension - // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js - "moduleResolution": "NodeNext", - "esModuleInterop": true + "outDir": "dist/esm" }, "include": [ "src", @@ -22,4 +12,4 @@ "exclude": [ "node_modules" ] -} +} \ No newline at end of file diff --git a/packages/identity-agent/tsconfig.cjs.json b/packages/identity-agent/tsconfig.cjs.json index 0384273d6..70f5f4067 100644 --- a/packages/identity-agent/tsconfig.cjs.json +++ b/packages/identity-agent/tsconfig.cjs.json @@ -3,7 +3,7 @@ "compilerOptions": { "lib": [ "DOM", - "ES5", + "ES5" ], "target": "ES5", "module": "CommonJS", diff --git a/packages/identity-agent/tsconfig.json b/packages/identity-agent/tsconfig.json index b29e4e7e1..711a7a208 100644 --- a/packages/identity-agent/tsconfig.json +++ b/packages/identity-agent/tsconfig.json @@ -1,22 +1,8 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "lib": [ - "DOM", - "ES6" - ], - "allowJs": true, - "target": "es6", - "module": "ESNext", // Required for enabling JavaScript import assertion support - "declaration": true, - "declarationMap": true, "declarationDir": "dist/types", - "outDir": "dist/esm", - "sourceMap": true, - // `NodeNext` will throw compilation errors if relative import paths are missing file extension - // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js - "moduleResolution": "NodeNext", - "esModuleInterop": true + "outDir": "dist/esm" }, "include": [ "src", diff --git a/packages/proxy-agent/tsconfig.cjs.json b/packages/proxy-agent/tsconfig.cjs.json index 0384273d6..70f5f4067 100644 --- a/packages/proxy-agent/tsconfig.cjs.json +++ b/packages/proxy-agent/tsconfig.cjs.json @@ -3,7 +3,7 @@ "compilerOptions": { "lib": [ "DOM", - "ES5", + "ES5" ], "target": "ES5", "module": "CommonJS", diff --git a/packages/proxy-agent/tsconfig.json b/packages/proxy-agent/tsconfig.json index fea2cf4f1..711a7a208 100644 --- a/packages/proxy-agent/tsconfig.json +++ b/packages/proxy-agent/tsconfig.json @@ -1,21 +1,8 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "lib": [ - "DOM", - "ES6" - ], - "target": "es6", - "module": "ESNext", // Required for enabling JavaScript import assertion support - "declaration": true, - "declarationMap": true, "declarationDir": "dist/types", - "outDir": "dist/esm", - "sourceMap": true, - // `NodeNext` will throw compilation errors if relative import paths are missing file extension - // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js - "moduleResolution": "NodeNext", - "esModuleInterop": true + "outDir": "dist/esm" }, "include": [ "src", diff --git a/packages/user-agent/tsconfig.cjs.json b/packages/user-agent/tsconfig.cjs.json index 0384273d6..70f5f4067 100644 --- a/packages/user-agent/tsconfig.cjs.json +++ b/packages/user-agent/tsconfig.cjs.json @@ -3,7 +3,7 @@ "compilerOptions": { "lib": [ "DOM", - "ES5", + "ES5" ], "target": "ES5", "module": "CommonJS", diff --git a/packages/user-agent/tsconfig.json b/packages/user-agent/tsconfig.json index b29e4e7e1..23ed4ccf6 100644 --- a/packages/user-agent/tsconfig.json +++ b/packages/user-agent/tsconfig.json @@ -1,25 +1,11 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "lib": [ - "DOM", - "ES6" - ], - "allowJs": true, - "target": "es6", - "module": "ESNext", // Required for enabling JavaScript import assertion support - "declaration": true, - "declarationMap": true, "declarationDir": "dist/types", - "outDir": "dist/esm", - "sourceMap": true, - // `NodeNext` will throw compilation errors if relative import paths are missing file extension - // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js - "moduleResolution": "NodeNext", - "esModuleInterop": true + "outDir": "dist/esm" }, "include": [ - "src", + "src" ], "exclude": [ "node_modules" diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..9bd97dd1d --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "lib": [ + "DOM", + "ES6" + ], + "allowJs": true, + "strict": true, + "declaration": true, + "declarationMap": true, + "target": "ES6", + "module": "NodeNext", // Required for enabling JavaScript import assertion support + "sourceMap": true, + // `NodeNext` will throw compilation errors if relative import paths are missing file extension + // reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js + "esModuleInterop": true, + "resolveJsonModule": true, + "moduleResolution": "NodeNext" + } +} \ No newline at end of file