From 8ba039c4685ac3bd26b5611c8793f25658005fad Mon Sep 17 00:00:00 2001 From: Jamie Rolfs Date: Fri, 9 Dec 2022 15:12:20 -0800 Subject: [PATCH] build: move shared TypeScript configuration to project root instead of extending For consistency, up until now, the shared TypeScript configuration has lived in `src/config` with all of the other shared configurations that this package provides. For all of the other configurations we're able to simple re-export the configuration at the project root to provide it to consumers at `require('@hover/javascript/[config]')`. Because the TypeScript configuration is JSON, however, we were using `extends` instead of re-exporting. This has been causing all kinds of trouble within this package since we were extending from the `dist` directory. This finally moves the canonical TypeScript configuration to the root, so that we don't need to `extends` from `dist/` while preserving `src/config/tsconfig.json` via `extends` just in case. The actual configuration for this project itself still lives at `src/tsconfig.json`, but this prevents issues when anything (like the `ts-node` that gets loaded in `commitlint` from trying to read a non-existent `dist/tsconfig.json` if it does read the `tsconfig.json` at the root of the project. --- src/config/tsconfig.json | 24 +----------------------- tsconfig.json | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/config/tsconfig.json b/src/config/tsconfig.json index d8798fdb..4082f16a 100644 --- a/src/config/tsconfig.json +++ b/src/config/tsconfig.json @@ -1,25 +1,3 @@ { - "compilerOptions": { - "alwaysStrict": true, - "declaration": true, - "esModuleInterop": true, - "importHelpers": true, - "jsx": "react", - "lib": ["dom", "esnext"], - "module": "esnext", - "moduleResolution": "node", - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": false, - "noUnusedParameters": true, - "resolveJsonModule": true, - "sourceMap": true, - "strict": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "target": "es5" - } + "extends": "../../tsconfig.json" } diff --git a/tsconfig.json b/tsconfig.json index 9ec86ea2..d8798fdb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,25 @@ { - "extends": "./dist/config/tsconfig", "compilerOptions": { - "allowJs": true + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "importHelpers": true, + "jsx": "react", + "lib": ["dom", "esnext"], + "module": "esnext", + "moduleResolution": "node", + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": true, + "resolveJsonModule": true, + "sourceMap": true, + "strict": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "target": "es5" } }