From 5a185aae72b3b596f8243a55f416ac5983b31338 Mon Sep 17 00:00:00 2001 From: Ian Clanton-Thuon Date: Mon, 27 May 2024 23:59:08 -0700 Subject: [PATCH] Turn on some stricter compiler options. --- apps/api-extractor/tsconfig.json | 1 + apps/heft/tsconfig.json | 1 + build-tests-samples/heft-node-rig-tutorial/tsconfig.json | 1 + build-tests/api-extractor-scenarios/tsconfig.json | 5 ++++- eslint/eslint-patch/tsconfig.json | 1 + eslint/eslint-plugin-packlets/tsconfig.json | 1 + eslint/eslint-plugin-security/tsconfig.json | 1 + eslint/eslint-plugin/tsconfig.json | 1 + eslint/local-eslint-config/profile/_common.js | 2 +- heft-plugins/heft-api-extractor-plugin/tsconfig.json | 1 + heft-plugins/heft-jest-plugin/tsconfig.json | 1 + heft-plugins/heft-lint-plugin/tsconfig.json | 1 + heft-plugins/heft-typescript-plugin/tsconfig.json | 1 + libraries/api-extractor-model/tsconfig.json | 1 + libraries/heft-config-file/tsconfig.json | 1 + libraries/node-core-library/tsconfig.json | 1 + libraries/operation-graph/tsconfig.json | 1 + libraries/rig-package/tsconfig.json | 1 + libraries/terminal/tsconfig.json | 1 + libraries/tree-pattern/tsconfig.json | 1 + libraries/ts-command-line/tsconfig.json | 1 + rigs/local-node-rig/profiles/default/tsconfig-base.json | 1 + rigs/local-web-rig/profiles/app/tsconfig-base.json | 1 + rigs/local-web-rig/profiles/library/tsconfig-base.json | 1 + 24 files changed, 27 insertions(+), 2 deletions(-) diff --git a/apps/api-extractor/tsconfig.json b/apps/api-extractor/tsconfig.json index 20361aa1cf5..3bb3c516da6 100644 --- a/apps/api-extractor/tsconfig.json +++ b/apps/api-extractor/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["heft-jest", "node"], "resolveJsonModule": true } diff --git a/apps/heft/tsconfig.json b/apps/heft/tsconfig.json index 0f045dd1bd2..29870ddf10c 100644 --- a/apps/heft/tsconfig.json +++ b/apps/heft/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["heft-jest", "node"], "lib": ["ES2020"], "resolveJsonModule": true diff --git a/build-tests-samples/heft-node-rig-tutorial/tsconfig.json b/build-tests-samples/heft-node-rig-tutorial/tsconfig.json index 22f94ca28b5..8c61f6719f3 100644 --- a/build-tests-samples/heft-node-rig-tutorial/tsconfig.json +++ b/build-tests-samples/heft-node-rig-tutorial/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["heft-jest", "node"] } } diff --git a/build-tests/api-extractor-scenarios/tsconfig.json b/build-tests/api-extractor-scenarios/tsconfig.json index 86dcc8c8f9e..2452b093b0e 100644 --- a/build-tests/api-extractor-scenarios/tsconfig.json +++ b/build-tests/api-extractor-scenarios/tsconfig.json @@ -2,7 +2,10 @@ "extends": "./node_modules/local-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { "strictPropertyInitialization": false, - "noImplicitAny": false + "noImplicitAny": false, + // Intentionally turn this off for this project to test a combination of `export` and `export type` + // with type-only exports + "isolatedModules": false }, "include": ["src/**/*.ts", "typings/tsd.d.ts"] } diff --git a/eslint/eslint-patch/tsconfig.json b/eslint/eslint-patch/tsconfig.json index 80bdd079715..94da707cfe1 100644 --- a/eslint/eslint-patch/tsconfig.json +++ b/eslint/eslint-patch/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["node"], "resolveJsonModule": true } diff --git a/eslint/eslint-plugin-packlets/tsconfig.json b/eslint/eslint-plugin-packlets/tsconfig.json index cce588d0df5..cfa885474e5 100644 --- a/eslint/eslint-plugin-packlets/tsconfig.json +++ b/eslint/eslint-plugin-packlets/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "module": "Node16", "types": ["heft-jest", "node"] } diff --git a/eslint/eslint-plugin-security/tsconfig.json b/eslint/eslint-plugin-security/tsconfig.json index cce588d0df5..cfa885474e5 100644 --- a/eslint/eslint-plugin-security/tsconfig.json +++ b/eslint/eslint-plugin-security/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "module": "Node16", "types": ["heft-jest", "node"] } diff --git a/eslint/eslint-plugin/tsconfig.json b/eslint/eslint-plugin/tsconfig.json index cce588d0df5..cfa885474e5 100644 --- a/eslint/eslint-plugin/tsconfig.json +++ b/eslint/eslint-plugin/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "module": "Node16", "types": ["heft-jest", "node"] } diff --git a/eslint/local-eslint-config/profile/_common.js b/eslint/local-eslint-config/profile/_common.js index f261c47c2b2..65b17303e1d 100644 --- a/eslint/local-eslint-config/profile/_common.js +++ b/eslint/local-eslint-config/profile/_common.js @@ -85,7 +85,7 @@ function buildRules(profile) { radix: 'error', // Rationale: Including the `type` annotation in the import statement for imports - // only used as types prevents the import from being omitted in the compiled output. + // only used as types prevents the import from being emitted in the compiled output. '@typescript-eslint/consistent-type-imports': [ 'warn', { prefer: 'type-imports', disallowTypeAnnotations: false, fixStyle: 'inline-type-imports' } diff --git a/heft-plugins/heft-api-extractor-plugin/tsconfig.json b/heft-plugins/heft-api-extractor-plugin/tsconfig.json index cf2862197d4..f5de29a7b44 100644 --- a/heft-plugins/heft-api-extractor-plugin/tsconfig.json +++ b/heft-plugins/heft-api-extractor-plugin/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["node"], "resolveJsonModule": true } diff --git a/heft-plugins/heft-jest-plugin/tsconfig.json b/heft-plugins/heft-jest-plugin/tsconfig.json index cf5a178aec1..abd868756bf 100644 --- a/heft-plugins/heft-jest-plugin/tsconfig.json +++ b/heft-plugins/heft-jest-plugin/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["node", "heft-jest"], "resolveJsonModule": true } diff --git a/heft-plugins/heft-lint-plugin/tsconfig.json b/heft-plugins/heft-lint-plugin/tsconfig.json index 7512871fdbf..a66d877424d 100644 --- a/heft-plugins/heft-lint-plugin/tsconfig.json +++ b/heft-plugins/heft-lint-plugin/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["node"] } } diff --git a/heft-plugins/heft-typescript-plugin/tsconfig.json b/heft-plugins/heft-typescript-plugin/tsconfig.json index f4797378044..07b34e74ca5 100644 --- a/heft-plugins/heft-typescript-plugin/tsconfig.json +++ b/heft-plugins/heft-typescript-plugin/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["node"], "lib": ["ES2019"], "resolveJsonModule": true diff --git a/libraries/api-extractor-model/tsconfig.json b/libraries/api-extractor-model/tsconfig.json index fbc2f5c0a6c..e7de6e2eef2 100644 --- a/libraries/api-extractor-model/tsconfig.json +++ b/libraries/api-extractor-model/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["heft-jest", "node"] } } diff --git a/libraries/heft-config-file/tsconfig.json b/libraries/heft-config-file/tsconfig.json index fbc2f5c0a6c..e7de6e2eef2 100644 --- a/libraries/heft-config-file/tsconfig.json +++ b/libraries/heft-config-file/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["heft-jest", "node"] } } diff --git a/libraries/node-core-library/tsconfig.json b/libraries/node-core-library/tsconfig.json index fbc2f5c0a6c..e7de6e2eef2 100644 --- a/libraries/node-core-library/tsconfig.json +++ b/libraries/node-core-library/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["heft-jest", "node"] } } diff --git a/libraries/operation-graph/tsconfig.json b/libraries/operation-graph/tsconfig.json index f8cb8764fb1..69c8790c065 100644 --- a/libraries/operation-graph/tsconfig.json +++ b/libraries/operation-graph/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "allowSyntheticDefaultImports": true, "target": "ES2020", "lib": ["ES2020"], diff --git a/libraries/rig-package/tsconfig.json b/libraries/rig-package/tsconfig.json index fbc2f5c0a6c..e7de6e2eef2 100644 --- a/libraries/rig-package/tsconfig.json +++ b/libraries/rig-package/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["heft-jest", "node"] } } diff --git a/libraries/terminal/tsconfig.json b/libraries/terminal/tsconfig.json index fbc2f5c0a6c..e7de6e2eef2 100644 --- a/libraries/terminal/tsconfig.json +++ b/libraries/terminal/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["heft-jest", "node"] } } diff --git a/libraries/tree-pattern/tsconfig.json b/libraries/tree-pattern/tsconfig.json index 1de40fe9a71..4f93a7d2087 100644 --- a/libraries/tree-pattern/tsconfig.json +++ b/libraries/tree-pattern/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["heft-jest"] } } diff --git a/libraries/ts-command-line/tsconfig.json b/libraries/ts-command-line/tsconfig.json index fbc2f5c0a6c..e7de6e2eef2 100644 --- a/libraries/ts-command-line/tsconfig.json +++ b/libraries/ts-command-line/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { + "isolatedModules": true, "types": ["heft-jest", "node"] } } diff --git a/rigs/local-node-rig/profiles/default/tsconfig-base.json b/rigs/local-node-rig/profiles/default/tsconfig-base.json index 4e87edeb53a..833a52da13b 100644 --- a/rigs/local-node-rig/profiles/default/tsconfig-base.json +++ b/rigs/local-node-rig/profiles/default/tsconfig-base.json @@ -5,6 +5,7 @@ "compilerOptions": { "resolveJsonModule": true, + "isolatedModules": true, "outDir": "../../../../lib", "rootDir": "../../../../src", diff --git a/rigs/local-web-rig/profiles/app/tsconfig-base.json b/rigs/local-web-rig/profiles/app/tsconfig-base.json index 4562bfad5c1..79e596dfb8f 100644 --- a/rigs/local-web-rig/profiles/app/tsconfig-base.json +++ b/rigs/local-web-rig/profiles/app/tsconfig-base.json @@ -5,6 +5,7 @@ "compilerOptions": { "resolveJsonModule": true, + "isolatedModules": true, "target": "es2017", "lib": ["es2017", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"], diff --git a/rigs/local-web-rig/profiles/library/tsconfig-base.json b/rigs/local-web-rig/profiles/library/tsconfig-base.json index 13e9420a272..5a3404cad09 100644 --- a/rigs/local-web-rig/profiles/library/tsconfig-base.json +++ b/rigs/local-web-rig/profiles/library/tsconfig-base.json @@ -5,6 +5,7 @@ "compilerOptions": { "resolveJsonModule": true, + "isolatedModules": true, "outDir": "../../../../lib", "rootDir": "../../../../src",