Skip to content

chore: use isolatedModules tsconfig everywhere #620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 19 additions & 33 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const defaultTsOptions: NonNullable<TypeScriptWorkspaceOptions['tsconfig']>['com
incremental: true,
esModuleInterop: false,
skipLibCheck: true,
isolatedModules: true,
};

/**
Expand Down Expand Up @@ -302,11 +303,6 @@ function genericCdkProps(props: GenericProps = {}) {
authorUrl: 'https://aws.amazon.com',
authorOrganization: true,
releasableCommits: pj.ReleasableCommits.featuresAndFixes('.'),
tsJestOptions: {
transformOptions: {
isolatedModules: true,
},
},
jestOptions: {
configFilePath: 'jest.config.json',
junitReporting: false,
Expand All @@ -322,6 +318,11 @@ function genericCdkProps(props: GenericProps = {}) {
trailingComma: pj.javascript.TrailingComma.ALL,
},
},
tsconfig: {
compilerOptions: {
...defaultTsOptions,
},
},
typescriptVersion: TYPESCRIPT_VERSION,
checkLicenses: props.private ? undefined : {
allow: ['Apache-2.0', 'MIT', 'ISC', 'BSD-3-Clause', '0BSD'],
Expand Down Expand Up @@ -684,18 +685,21 @@ const TOOLKIT_LIB_EXCLUDE_PATTERNS = [
'lib/init-templates/*/typescript/*/*.template.ts',
];

const toolkitLibTsCompilerOptions = {
...defaultTsOptions,
target: 'es2022',
lib: ['es2022', 'esnext.disposable'],
module: 'NodeNext',
declarationMap: true,
};

const toolkitLib = configureProject(
new yarn.TypeScriptWorkspace({
...genericCdkProps(),
parent: repo,
name: '@aws-cdk/toolkit-lib',
description: 'AWS CDK Programmatic Toolkit Library',
srcdir: 'lib',
tsconfigDev: {
compilerOptions: {
rootDir: '.', // shouldn't be required but something broke... check again once we have gotten rid of the tmpToolkitHelpers package
},
},
peerDeps: [
cliPluginContract.customizeReference({ versionType: 'any-minor' }), // allow consumers to easily de-depulicate this
],
Expand Down Expand Up @@ -791,17 +795,13 @@ const toolkitLib = configureProject(
}),
tsconfig: {
compilerOptions: {
...defaultTsOptions,
target: 'es2022',
lib: ['es2022', 'esnext.disposable'],
module: 'NodeNext',
isolatedModules: true,
declarationMap: true,
...toolkitLibTsCompilerOptions,
},
},
tsJestOptions: {
transformOptions: {
isolatedModules: false, // we use the respective tsc setting
tsconfigDev: {
compilerOptions: {
...toolkitLibTsCompilerOptions,
rootDir: '.', // shouldn't be required but something broke... check again once we have gotten rid of the tmpToolkitHelpers package
},
},
majorVersion: 1,
Expand Down Expand Up @@ -1070,12 +1070,6 @@ const cli = configureProject(
'yaml@^1',
'yargs@^15',
],
tsJestOptions: {
transformOptions: {
// Skips type checking, otherwise tests take too long
isolatedModules: true,
},
},
tsconfig: {
compilerOptions: {
...defaultTsOptions,
Expand All @@ -1096,7 +1090,6 @@ const cli = configureProject(
esModuleInterop: false,
skipLibCheck: true,
},

},
eslintOptions: {
dirs: ['lib'],
Expand Down Expand Up @@ -1466,13 +1459,6 @@ const integRunner = configureProject(
tsconfig: {
compilerOptions: {
...defaultTsOptions,
lib: ['es2020', 'dom'],
isolatedModules: true,
},
},
tsJestOptions: {
transformOptions: {
isolatedModules: false, // we use the respective tsc setting
},
},
jestOptions: jestOptionsForProject({
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk-testing/cli-integ/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk-testing/cli-integ/tsconfig.dev.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk-testing/cli-integ/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/cdk-cli-wrapper/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/cdk-cli-wrapper/tsconfig.dev.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/cdk-cli-wrapper/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/cli-lib-alpha/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/cli-lib-alpha/tsconfig.dev.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/cli-plugin-contract/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/cli-plugin-contract/tsconfig.dev.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/cli-plugin-contract/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/cloud-assembly-schema/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions packages/@aws-cdk/cloud-assembly-schema/tsconfig.dev.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/cloudformation-diff/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/cloudformation-diff/tsconfig.dev.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/cloudformation-diff/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/integ-runner/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/integ-runner/tsconfig.dev.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/integ-runner/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/node-bundle/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/node-bundle/tsconfig.dev.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/node-bundle/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/toolkit-lib/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/user-input-gen/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/user-input-gen/tsconfig.dev.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/user-input-gen/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/@aws-cdk/yarn-cling/jest.config.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/yarn-cling/tsconfig.dev.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@aws-cdk/yarn-cling/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading