diff --git a/.eslintrc.json b/.eslintrc.json index 20b91330e..1cb902be5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -301,6 +301,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "no-console": [ "error" ], diff --git a/.projenrc.ts b/.projenrc.ts index a9b00a1d5..3502d0744 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -729,7 +729,6 @@ tmpToolkitHelpers.package.addField('exports', { tmpToolkitHelpers.eslint?.addRules({ '@cdklabs/no-throw-default-error': 'error', - '@typescript-eslint/consistent-type-imports': 'error', }); tmpToolkitHelpers.gitignore.addPatterns('test/**/*.map'); @@ -1218,7 +1217,6 @@ new S3DocsPublishing(toolkitLib, { // Eslint rules toolkitLib.eslint?.addRules({ '@cdklabs/no-throw-default-error': 'error', - '@typescript-eslint/consistent-type-imports': 'error', 'import/no-restricted-paths': ['error', { zones: [{ target: './', diff --git a/packages/@aws-cdk/cdk-build-tools/.eslintrc.json b/packages/@aws-cdk/cdk-build-tools/.eslintrc.json index d45b6fa34..8d4b0afed 100644 --- a/packages/@aws-cdk/cdk-build-tools/.eslintrc.json +++ b/packages/@aws-cdk/cdk-build-tools/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/@aws-cdk/cdk-build-tools/lib/compile.ts b/packages/@aws-cdk/cdk-build-tools/lib/compile.ts index 173fea936..a5eba4bb7 100644 --- a/packages/@aws-cdk/cdk-build-tools/lib/compile.ts +++ b/packages/@aws-cdk/cdk-build-tools/lib/compile.ts @@ -1,6 +1,7 @@ import { makeExecutable, shell } from './os'; -import { CDKBuildOptions, CompilerOverrides, currentPackageJson, packageCompiler } from './package-info'; -import { Timers } from './timer'; +import type { CDKBuildOptions, CompilerOverrides } from './package-info'; +import { currentPackageJson, packageCompiler } from './package-info'; +import type { Timers } from './timer'; /** * Run the compiler on the current package diff --git a/packages/@aws-cdk/cdk-build-tools/lib/lint.ts b/packages/@aws-cdk/cdk-build-tools/lib/lint.ts index ef5d52241..85892eb13 100644 --- a/packages/@aws-cdk/cdk-build-tools/lib/lint.ts +++ b/packages/@aws-cdk/cdk-build-tools/lib/lint.ts @@ -2,8 +2,8 @@ import * as path from 'path'; import * as process from 'process'; import * as fs from 'fs-extra'; import { shell, escape } from './os'; -import { CDKBuildOptions, CompilerOverrides } from './package-info'; -import { Timers } from './timer'; +import type { CDKBuildOptions, CompilerOverrides } from './package-info'; +import type { Timers } from './timer'; export async function lintCurrentPackage( options: CDKBuildOptions, diff --git a/packages/@aws-cdk/cdk-cli-wrapper/.eslintrc.json b/packages/@aws-cdk/cdk-cli-wrapper/.eslintrc.json index d45b6fa34..8d4b0afed 100644 --- a/packages/@aws-cdk/cdk-cli-wrapper/.eslintrc.json +++ b/packages/@aws-cdk/cdk-cli-wrapper/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/@aws-cdk/cdk-cli-wrapper/lib/cdk-wrapper.ts b/packages/@aws-cdk/cdk-cli-wrapper/lib/cdk-wrapper.ts index d7855779f..093806cc3 100644 --- a/packages/@aws-cdk/cdk-cli-wrapper/lib/cdk-wrapper.ts +++ b/packages/@aws-cdk/cdk-cli-wrapper/lib/cdk-wrapper.ts @@ -1,5 +1,6 @@ -import { ChildProcess } from 'child_process'; -import { DefaultCdkOptions, DeployOptions, DestroyOptions, SynthOptions, ListOptions, StackActivityProgress, HotswapMode } from './commands'; +import type { ChildProcess } from 'child_process'; +import type { DefaultCdkOptions, DeployOptions, DestroyOptions, SynthOptions, ListOptions } from './commands'; +import { StackActivityProgress, HotswapMode } from './commands'; import { exec, watch } from './utils'; /** diff --git a/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/deploy.ts b/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/deploy.ts index b096885ea..14d0c4125 100644 --- a/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/deploy.ts +++ b/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/deploy.ts @@ -1,4 +1,4 @@ -import { DefaultCdkOptions, RequireApproval } from './common'; +import type { DefaultCdkOptions, RequireApproval } from './common'; /** * Options to use with cdk deploy diff --git a/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/destroy.ts b/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/destroy.ts index 9dfe8f267..5112075f5 100644 --- a/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/destroy.ts +++ b/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/destroy.ts @@ -1,4 +1,4 @@ -import { DefaultCdkOptions } from './common'; +import type { DefaultCdkOptions } from './common'; /** * Options to use with cdk destroy diff --git a/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/list.ts b/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/list.ts index bb654f5cc..a4d5018bb 100644 --- a/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/list.ts +++ b/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/list.ts @@ -1,4 +1,4 @@ -import { DefaultCdkOptions } from './common'; +import type { DefaultCdkOptions } from './common'; /** * Options for cdk list diff --git a/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/synth.ts b/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/synth.ts index 3922884bf..87b365d35 100644 --- a/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/synth.ts +++ b/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/synth.ts @@ -1,4 +1,4 @@ -import { DefaultCdkOptions } from './common'; +import type { DefaultCdkOptions } from './common'; /** * Options to use with cdk synth diff --git a/packages/@aws-cdk/cli-lib-alpha/.eslintrc.json b/packages/@aws-cdk/cli-lib-alpha/.eslintrc.json index d6feae45e..4acf8b220 100644 --- a/packages/@aws-cdk/cli-lib-alpha/.eslintrc.json +++ b/packages/@aws-cdk/cli-lib-alpha/.eslintrc.json @@ -269,6 +269,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/@aws-cdk/cli-lib-alpha/lib/cli.ts b/packages/@aws-cdk/cli-lib-alpha/lib/cli.ts index e11eac064..72e9e4a78 100644 --- a/packages/@aws-cdk/cli-lib-alpha/lib/cli.ts +++ b/packages/@aws-cdk/cli-lib-alpha/lib/cli.ts @@ -1,5 +1,6 @@ // eslint-disable-next-line import/no-extraneous-dependencies -import { SharedOptions, DeployOptions, DestroyOptions, BootstrapOptions, SynthOptions, ListOptions, StackActivityProgress, HotswapMode } from './commands'; +import type { SharedOptions, DeployOptions, DestroyOptions, BootstrapOptions, SynthOptions, ListOptions } from './commands'; +import { StackActivityProgress, HotswapMode } from './commands'; import { exec as runCli } from '../../../aws-cdk/lib'; // eslint-disable-next-line import/no-extraneous-dependencies import { createAssembly, prepareContext, prepareDefaultEnvironment } from '../../../aws-cdk/lib/api/cxapp/exec'; diff --git a/packages/@aws-cdk/cli-lib-alpha/lib/commands/bootstrap.ts b/packages/@aws-cdk/cli-lib-alpha/lib/commands/bootstrap.ts index be0f5657f..1bf07ee4a 100644 --- a/packages/@aws-cdk/cli-lib-alpha/lib/commands/bootstrap.ts +++ b/packages/@aws-cdk/cli-lib-alpha/lib/commands/bootstrap.ts @@ -1,4 +1,4 @@ -import { SharedOptions } from './common'; +import type { SharedOptions } from './common'; /** * Options to use with cdk bootstrap diff --git a/packages/@aws-cdk/cli-lib-alpha/lib/commands/deploy.ts b/packages/@aws-cdk/cli-lib-alpha/lib/commands/deploy.ts index 34c05242e..b74bae52a 100644 --- a/packages/@aws-cdk/cli-lib-alpha/lib/commands/deploy.ts +++ b/packages/@aws-cdk/cli-lib-alpha/lib/commands/deploy.ts @@ -1,4 +1,4 @@ -import { SharedOptions, RequireApproval } from './common'; +import type { SharedOptions, RequireApproval } from './common'; export enum HotswapMode { /** diff --git a/packages/@aws-cdk/cli-lib-alpha/lib/commands/destroy.ts b/packages/@aws-cdk/cli-lib-alpha/lib/commands/destroy.ts index 5879f1a89..dd483380d 100644 --- a/packages/@aws-cdk/cli-lib-alpha/lib/commands/destroy.ts +++ b/packages/@aws-cdk/cli-lib-alpha/lib/commands/destroy.ts @@ -1,4 +1,4 @@ -import { SharedOptions } from './common'; +import type { SharedOptions } from './common'; /** * Options to use with cdk destroy diff --git a/packages/@aws-cdk/cli-lib-alpha/lib/commands/list.ts b/packages/@aws-cdk/cli-lib-alpha/lib/commands/list.ts index 28755aa1d..77301293d 100644 --- a/packages/@aws-cdk/cli-lib-alpha/lib/commands/list.ts +++ b/packages/@aws-cdk/cli-lib-alpha/lib/commands/list.ts @@ -1,4 +1,4 @@ -import { SharedOptions } from './common'; +import type { SharedOptions } from './common'; /** * Options for cdk list diff --git a/packages/@aws-cdk/cli-lib-alpha/lib/commands/synth.ts b/packages/@aws-cdk/cli-lib-alpha/lib/commands/synth.ts index 605943520..24dc3524c 100644 --- a/packages/@aws-cdk/cli-lib-alpha/lib/commands/synth.ts +++ b/packages/@aws-cdk/cli-lib-alpha/lib/commands/synth.ts @@ -1,4 +1,4 @@ -import { SharedOptions } from './common'; +import type { SharedOptions } from './common'; /** * Options to use with cdk synth diff --git a/packages/@aws-cdk/cli-plugin-contract/.eslintrc.json b/packages/@aws-cdk/cli-plugin-contract/.eslintrc.json index d45b6fa34..8d4b0afed 100644 --- a/packages/@aws-cdk/cli-plugin-contract/.eslintrc.json +++ b/packages/@aws-cdk/cli-plugin-contract/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/@aws-cdk/cloud-assembly-schema/.eslintrc.json b/packages/@aws-cdk/cloud-assembly-schema/.eslintrc.json index d45b6fa34..8d4b0afed 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/.eslintrc.json +++ b/packages/@aws-cdk/cloud-assembly-schema/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/assets/docker-image-asset.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/assets/docker-image-asset.ts index bbcbe65e2..c91dd63ab 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/assets/docker-image-asset.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/assets/docker-image-asset.ts @@ -1,4 +1,4 @@ -import { AwsDestination } from './aws-destination'; +import type { AwsDestination } from './aws-destination'; /** * A file asset diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/assets/file-asset.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/assets/file-asset.ts index 3d4c2284d..82ae024aa 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/assets/file-asset.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/assets/file-asset.ts @@ -1,4 +1,4 @@ -import { AwsDestination } from './aws-destination'; +import type { AwsDestination } from './aws-destination'; /** * A file asset diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/assets/schema.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/assets/schema.ts index 7f5b33da1..2863121ec 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/assets/schema.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/assets/schema.ts @@ -1,5 +1,5 @@ -import { DockerImageAsset } from './docker-image-asset'; -import { FileAsset } from './file-asset'; +import type { DockerImageAsset } from './docker-image-asset'; +import type { FileAsset } from './file-asset'; /** * Definitions for the asset manifest diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/context-queries.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/context-queries.ts index 83649c51d..82bb3e687 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/context-queries.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/context-queries.ts @@ -1,4 +1,4 @@ -import { Tag } from './metadata-schema'; +import type { Tag } from './metadata-schema'; /** * Identifier for the context provider diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/schema.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/schema.ts index 6e4f56e00..4ac55eccf 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/schema.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/schema.ts @@ -1,6 +1,6 @@ -import { ArtifactProperties } from './artifact-schema'; -import { ContextProvider, ContextQueryProperties } from './context-queries'; -import { MetadataEntry } from './metadata-schema'; +import type { ArtifactProperties } from './artifact-schema'; +import type { ContextProvider, ContextQueryProperties } from './context-queries'; +import type { MetadataEntry } from './metadata-schema'; /** * Type of cloud artifact. diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/commands/deploy.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/commands/deploy.ts index 72a1f6e97..dfcc4d806 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/commands/deploy.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/commands/deploy.ts @@ -1,4 +1,4 @@ -import { DefaultCdkOptions, RequireApproval } from './common'; +import type { DefaultCdkOptions, RequireApproval } from './common'; /** * Options to use with cdk deploy diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/commands/destroy.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/commands/destroy.ts index 9dfe8f267..5112075f5 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/commands/destroy.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/commands/destroy.ts @@ -1,4 +1,4 @@ -import { DefaultCdkOptions } from './common'; +import type { DefaultCdkOptions } from './common'; /** * Options to use with cdk destroy diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/schema.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/schema.ts index cafaf2278..03ef588c0 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/schema.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/schema.ts @@ -1,4 +1,4 @@ -import { TestCase } from './test-case'; +import type { TestCase } from './test-case'; /** * Definitions for the integration testing manifest */ diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/test-case.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/test-case.ts index c8762fd4e..921907be5 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/test-case.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/integ-tests/test-case.ts @@ -1,4 +1,4 @@ -import { DeployOptions, DestroyOptions } from './commands'; +import type { DeployOptions, DestroyOptions } from './commands'; /** * The set of options to control the workflow of the test runner diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts index bb1a3396d..ac1020df7 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts @@ -1,9 +1,9 @@ import * as fs from 'fs'; import * as jsonschema from 'jsonschema'; import * as semver from 'semver'; -import * as assets from './assets'; +import type * as assets from './assets'; import * as assembly from './cloud-assembly'; -import * as integ from './integ-tests'; +import type * as integ from './integ-tests'; /* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable @typescript-eslint/no-require-imports */ diff --git a/packages/@aws-cdk/cloud-assembly-schema/test/manifest.test.ts b/packages/@aws-cdk/cloud-assembly-schema/test/manifest.test.ts index 8e97bbdb8..f3c0f8d15 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/test/manifest.test.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/test/manifest.test.ts @@ -3,12 +3,14 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import * as semver from 'semver'; +import type { + AssemblyManifest, + StackTagsMetadataEntry, +} from '../lib'; import { ArtifactType, - AssemblyManifest, ContextProvider, Manifest, - StackTagsMetadataEntry, } from '../lib'; const FIXTURES = path.join(__dirname, 'fixtures'); diff --git a/packages/@aws-cdk/cloudformation-diff/.eslintrc.json b/packages/@aws-cdk/cloudformation-diff/.eslintrc.json index d45b6fa34..8d4b0afed 100644 --- a/packages/@aws-cdk/cloudformation-diff/.eslintrc.json +++ b/packages/@aws-cdk/cloudformation-diff/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/@aws-cdk/cloudformation-diff/lib/diff/index.ts b/packages/@aws-cdk/cloudformation-diff/lib/diff/index.ts index 4ab45f7f0..3563d3748 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/diff/index.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/diff/index.ts @@ -1,4 +1,4 @@ -import { Resource } from '@aws-cdk/service-spec-types'; +import type { Resource } from '@aws-cdk/service-spec-types'; import * as types from './types'; import { deepEqual, diffKeyedEntities, loadResourceModel } from './util'; diff --git a/packages/@aws-cdk/cloudformation-diff/lib/diff/types.ts b/packages/@aws-cdk/cloudformation-diff/lib/diff/types.ts index cde26116e..9ec562e4b 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/diff/types.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/diff/types.ts @@ -1,5 +1,6 @@ import { AssertionError } from 'assert'; -import { PropertyScrutinyType, ResourceScrutinyType, Resource as ResourceModel } from '@aws-cdk/service-spec-types'; +import type { Resource as ResourceModel } from '@aws-cdk/service-spec-types'; +import { PropertyScrutinyType, ResourceScrutinyType } from '@aws-cdk/service-spec-types'; import { deepEqual, loadResourceModel } from './util'; import { IamChanges } from '../iam/iam-changes'; import { SecurityGroupChanges } from '../network/security-group-changes'; diff --git a/packages/@aws-cdk/cloudformation-diff/lib/diff/util.ts b/packages/@aws-cdk/cloudformation-diff/lib/diff/util.ts index bb8cae305..44993656f 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/diff/util.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/diff/util.ts @@ -1,5 +1,5 @@ import { loadAwsServiceSpecSync } from '@aws-cdk/aws-service-spec'; -import { Resource, SpecDatabase } from '@aws-cdk/service-spec-types'; +import type { Resource, SpecDatabase } from '@aws-cdk/service-spec-types'; /** * Compares two objects for equality, deeply. The function handles arguments that are diff --git a/packages/@aws-cdk/cloudformation-diff/lib/format.ts b/packages/@aws-cdk/cloudformation-diff/lib/format.ts index a2d1474a5..bbfd621df 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/format.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/format.ts @@ -1,11 +1,12 @@ import { format } from 'util'; import * as chalk from 'chalk'; -import { DifferenceCollection, TemplateDiff } from './diff/types'; +import type { DifferenceCollection, TemplateDiff } from './diff/types'; import { deepEqual } from './diff/util'; -import { Difference, isPropertyDifference, ResourceDifference, ResourceImpact } from './diff-template'; +import type { Difference, ResourceDifference } from './diff-template'; +import { isPropertyDifference, ResourceImpact } from './diff-template'; import { formatTable } from './format-table'; -import { IamChanges } from './iam/iam-changes'; -import { SecurityGroupChanges } from './network/security-group-changes'; +import type { IamChanges } from './iam/iam-changes'; +import type { SecurityGroupChanges } from './network/security-group-changes'; // from cx-api const PATH_METADATA_KEY = 'aws:cdk:path'; diff --git a/packages/@aws-cdk/cloudformation-diff/lib/iam/iam-changes.ts b/packages/@aws-cdk/cloudformation-diff/lib/iam/iam-changes.ts index 5e20b9614..9d1d39469 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/iam/iam-changes.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/iam/iam-changes.ts @@ -1,10 +1,13 @@ import { PropertyScrutinyType, ResourceScrutinyType } from '@aws-cdk/service-spec-types'; import * as chalk from 'chalk'; -import { ISsoInstanceACAConfig, ISsoPermissionSet, SsoAssignment, SsoInstanceACAConfig, SsoPermissionSet } from './iam-identity-center'; -import { ManagedPolicyAttachment, ManagedPolicyJson } from './managed-policy'; -import { parseLambdaPermission, parseStatements, Statement, StatementJson } from './statement'; -import { MaybeParsed } from '../diff/maybe-parsed'; -import { PropertyChange, PropertyMap, ResourceChange } from '../diff/types'; +import type { ISsoInstanceACAConfig, ISsoPermissionSet } from './iam-identity-center'; +import { SsoAssignment, SsoInstanceACAConfig, SsoPermissionSet } from './iam-identity-center'; +import type { ManagedPolicyJson } from './managed-policy'; +import { ManagedPolicyAttachment } from './managed-policy'; +import type { Statement, StatementJson } from './statement'; +import { parseLambdaPermission, parseStatements } from './statement'; +import type { MaybeParsed } from '../diff/maybe-parsed'; +import type { PropertyChange, PropertyMap, ResourceChange } from '../diff/types'; import { DiffableCollection } from '../diffable'; import { renderIntrinsics } from '../render-intrinsics'; import { deepRemoveUndefined, dropIfEmpty, flatMap, makeComparator } from '../util'; diff --git a/packages/@aws-cdk/cloudformation-diff/lib/iam/managed-policy.ts b/packages/@aws-cdk/cloudformation-diff/lib/iam/managed-policy.ts index 57f6fe76a..7cbe607a1 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/iam/managed-policy.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/iam/managed-policy.ts @@ -1,4 +1,5 @@ -import { MaybeParsed, mkParsed } from '../diff/maybe-parsed'; +import type { MaybeParsed } from '../diff/maybe-parsed'; +import { mkParsed } from '../diff/maybe-parsed'; export class ManagedPolicyAttachment { public static parseManagedPolicies(identityArn: string, arns: string | string[]): ManagedPolicyAttachment[] { diff --git a/packages/@aws-cdk/cloudformation-diff/lib/iam/statement.ts b/packages/@aws-cdk/cloudformation-diff/lib/iam/statement.ts index 2b5bfa5ca..fb6a86072 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/iam/statement.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/iam/statement.ts @@ -1,4 +1,5 @@ -import { MaybeParsed, mkParsed, mkUnparseable } from '../diff/maybe-parsed'; +import type { MaybeParsed } from '../diff/maybe-parsed'; +import { mkParsed, mkUnparseable } from '../diff/maybe-parsed'; import { deepRemoveUndefined } from '../util'; // namespace object imports won't work in the bundle for function exports diff --git a/packages/@aws-cdk/cloudformation-diff/lib/network/security-group-changes.ts b/packages/@aws-cdk/cloudformation-diff/lib/network/security-group-changes.ts index 90eed7ab5..ecde87a27 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/network/security-group-changes.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/network/security-group-changes.ts @@ -1,6 +1,7 @@ import * as chalk from 'chalk'; -import { RuleJson, SecurityGroupRule } from './security-group-rule'; -import { PropertyChange, ResourceChange } from '../diff/types'; +import type { RuleJson } from './security-group-rule'; +import { SecurityGroupRule } from './security-group-rule'; +import type { PropertyChange, ResourceChange } from '../diff/types'; import { DiffableCollection } from '../diffable'; import { renderIntrinsics } from '../render-intrinsics'; import { deepRemoveUndefined, dropIfEmpty, makeComparator } from '../util'; diff --git a/packages/@aws-cdk/cloudformation-diff/test/iam/detect-changes.test.ts b/packages/@aws-cdk/cloudformation-diff/test/iam/detect-changes.test.ts index 5fd38449d..8caa7c593 100644 --- a/packages/@aws-cdk/cloudformation-diff/test/iam/detect-changes.test.ts +++ b/packages/@aws-cdk/cloudformation-diff/test/iam/detect-changes.test.ts @@ -1,7 +1,7 @@ import * as chalk from 'chalk'; import { fullDiff } from '../../lib'; -import { MaybeParsed } from '../../lib/diff/maybe-parsed'; -import { IamChangesJson } from '../../lib/iam/iam-changes'; +import type { MaybeParsed } from '../../lib/diff/maybe-parsed'; +import type { IamChangesJson } from '../../lib/iam/iam-changes'; import { deepRemoveUndefined } from '../../lib/util'; import { largeSsoPermissionSet, poldoc, policy, resource, role, template } from '../util'; diff --git a/packages/@aws-cdk/cloudformation-diff/test/template-and-changeset-diff-merger.test.ts b/packages/@aws-cdk/cloudformation-diff/test/template-and-changeset-diff-merger.test.ts index 049a96500..b9c34cf4c 100644 --- a/packages/@aws-cdk/cloudformation-diff/test/template-and-changeset-diff-merger.test.ts +++ b/packages/@aws-cdk/cloudformation-diff/test/template-and-changeset-diff-merger.test.ts @@ -1,4 +1,4 @@ -import { ResourceChangeDetail } from '@aws-sdk/client-cloudformation'; +import type { ResourceChangeDetail } from '@aws-sdk/client-cloudformation'; import * as utils from './util'; import { PropertyDifference, ResourceDifference, ResourceImpact, fullDiff } from '../lib'; import { TemplateAndChangeSetDiffMerger } from '../lib/diff/template-and-changeset-diff-merger'; diff --git a/packages/@aws-cdk/cloudformation-diff/test/util.ts b/packages/@aws-cdk/cloudformation-diff/test/util.ts index 1c0782e28..efd4a0ec4 100644 --- a/packages/@aws-cdk/cloudformation-diff/test/util.ts +++ b/packages/@aws-cdk/cloudformation-diff/test/util.ts @@ -1,4 +1,4 @@ -import { Change, DescribeChangeSetOutput } from '@aws-sdk/client-cloudformation'; +import type { Change, DescribeChangeSetOutput } from '@aws-sdk/client-cloudformation'; export function template(resources: {[key: string]: any}) { return { Resources: resources }; diff --git a/packages/@aws-cdk/node-bundle/.eslintrc.json b/packages/@aws-cdk/node-bundle/.eslintrc.json index 327aa2046..4be69fef6 100644 --- a/packages/@aws-cdk/node-bundle/.eslintrc.json +++ b/packages/@aws-cdk/node-bundle/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/@aws-cdk/node-bundle/src/api/_attributions.ts b/packages/@aws-cdk/node-bundle/src/api/_attributions.ts index 2e00e9590..e5407ae77 100644 --- a/packages/@aws-cdk/node-bundle/src/api/_attributions.ts +++ b/packages/@aws-cdk/node-bundle/src/api/_attributions.ts @@ -3,7 +3,8 @@ import * as fs from 'fs-extra'; import type { ModuleInfo } from 'license-checker'; import { shell } from './_shell'; import type { Package } from './bundle'; -import { Violation, ViolationType, ViolationsReport } from './violation'; +import type { Violation } from './violation'; +import { ViolationType, ViolationsReport } from './violation'; const ATTRIBUTION_SEPARATOR = '\n----------------\n'; diff --git a/packages/@aws-cdk/node-bundle/src/api/bundle.ts b/packages/@aws-cdk/node-bundle/src/api/bundle.ts index 364160757..50f2c2a1e 100644 --- a/packages/@aws-cdk/node-bundle/src/api/bundle.ts +++ b/packages/@aws-cdk/node-bundle/src/api/bundle.ts @@ -4,7 +4,8 @@ import * as esbuild from 'esbuild'; import * as fs from 'fs-extra'; import { Attributions } from './_attributions'; import { shell } from './_shell'; -import { Violation, ViolationType, ViolationsReport } from './violation'; +import type { Violation } from './violation'; +import { ViolationType, ViolationsReport } from './violation'; const DEFAULT_ALLOWED_LICENSES = [ 'Apache-2.0', diff --git a/packages/@aws-cdk/node-bundle/src/cli-main.ts b/packages/@aws-cdk/node-bundle/src/cli-main.ts index 80455c94d..2f445f9f2 100644 --- a/packages/@aws-cdk/node-bundle/src/cli-main.ts +++ b/packages/@aws-cdk/node-bundle/src/cli-main.ts @@ -1,7 +1,8 @@ import * as path from 'path'; import * as fs from 'fs-extra'; import * as yargs from 'yargs'; -import { Bundle, BundlePackOptions, BundleProps, BundleValidateOptions } from './api'; +import type { BundlePackOptions, BundleProps, BundleValidateOptions } from './api'; +import { Bundle } from './api'; function versionNumber(): string { return fs.readJSONSync(path.join(__dirname, '..', 'package.json')).version; diff --git a/packages/@aws-cdk/tmp-toolkit-helpers/.eslintrc.json b/packages/@aws-cdk/tmp-toolkit-helpers/.eslintrc.json index 12b52ecc2..37f148684 100644 --- a/packages/@aws-cdk/tmp-toolkit-helpers/.eslintrc.json +++ b/packages/@aws-cdk/tmp-toolkit-helpers/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" @@ -314,8 +315,7 @@ "prettier/prettier": [ "off" ], - "@cdklabs/no-throw-default-error": "error", - "@typescript-eslint/consistent-type-imports": "error" + "@cdklabs/no-throw-default-error": "error" }, "overrides": [] } diff --git a/packages/@aws-cdk/toolkit-lib/.eslintrc.json b/packages/@aws-cdk/toolkit-lib/.eslintrc.json index e4e1adfd2..98da5b375 100644 --- a/packages/@aws-cdk/toolkit-lib/.eslintrc.json +++ b/packages/@aws-cdk/toolkit-lib/.eslintrc.json @@ -269,6 +269,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" @@ -312,7 +313,6 @@ "off" ], "@cdklabs/no-throw-default-error": "error", - "@typescript-eslint/consistent-type-imports": "error", "import/no-restricted-paths": [ "error", { diff --git a/packages/@aws-cdk/user-input-gen/.eslintrc.json b/packages/@aws-cdk/user-input-gen/.eslintrc.json index d45b6fa34..8d4b0afed 100644 --- a/packages/@aws-cdk/user-input-gen/.eslintrc.json +++ b/packages/@aws-cdk/user-input-gen/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts b/packages/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts index b4f2c49eb..93570a019 100644 --- a/packages/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts +++ b/packages/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts @@ -2,7 +2,7 @@ import { code, FreeFunction, Module, SelectiveModuleImport, Type, TypeScriptRend import { EsLintRules } from '@cdklabs/typewriter/lib/eslint-rules'; import * as prettier from 'prettier'; import { kebabToCamelCase, SOURCE_OF_TRUTH } from './util'; -import { CliAction, CliConfig } from './yargs-types'; +import type { CliAction, CliConfig } from './yargs-types'; const CLI_ARG_NAME = 'args'; const CONFIG_ARG_NAME = 'config'; @@ -40,7 +40,10 @@ export async function renderUserInputFuncs(config: CliConfig): Promise { createConfigArguments.addBody(code.expr.directCode(buildConfigArgsFunction(config))); const ts = new TypeScriptRenderer({ - disabledEsLintRules: [EsLintRules.MAX_LEN], // the default disabled rules result in 'Definition for rule 'prettier/prettier' was not found' + disabledEsLintRules: [ + EsLintRules.MAX_LEN, // the default disabled rules result in 'Definition for rule 'prettier/prettier' was not found + '@typescript-eslint/consistent-type-imports', // (ironically) typewriter does not support type imports + ], }).render(scope); return prettier.format(ts, { diff --git a/packages/@aws-cdk/user-input-gen/lib/user-input-gen.ts b/packages/@aws-cdk/user-input-gen/lib/user-input-gen.ts index 94106df0f..a1ad10c90 100644 --- a/packages/@aws-cdk/user-input-gen/lib/user-input-gen.ts +++ b/packages/@aws-cdk/user-input-gen/lib/user-input-gen.ts @@ -2,7 +2,7 @@ import { Module, SelectiveModuleImport, StructType, Type, TypeScriptRenderer } f import { EsLintRules } from '@cdklabs/typewriter/lib/eslint-rules'; import * as prettier from 'prettier'; import { kebabToCamelCase, kebabToPascal, SOURCE_OF_TRUTH } from './util'; -import { CliConfig } from './yargs-types'; +import type { CliConfig } from './yargs-types'; export async function renderUserInputType(config: CliConfig): Promise { const scope = new Module('aws-cdk'); @@ -121,7 +121,10 @@ export async function renderUserInputType(config: CliConfig): Promise { } const ts = new TypeScriptRenderer({ - disabledEsLintRules: [EsLintRules.MAX_LEN], // the default disabled rules result in 'Definition for rule 'prettier/prettier' was not found' + disabledEsLintRules: [ + EsLintRules.MAX_LEN, // the default disabled rules result in 'Definition for rule 'prettier/prettier' was not found + '@typescript-eslint/consistent-type-imports', // (ironically) typewriter does not support type imports + ], }).render(scope); return prettier.format(ts, { diff --git a/packages/@aws-cdk/user-input-gen/lib/util.ts b/packages/@aws-cdk/user-input-gen/lib/util.ts index a2c11aa81..a3de958e2 100644 --- a/packages/@aws-cdk/user-input-gen/lib/util.ts +++ b/packages/@aws-cdk/user-input-gen/lib/util.ts @@ -1,4 +1,5 @@ -import { code, Expression } from '@cdklabs/typewriter'; +import type { Expression } from '@cdklabs/typewriter'; +import { code } from '@cdklabs/typewriter'; export const SOURCE_OF_TRUTH = 'packages/aws-cdk/lib/cli/cli-config.ts'; diff --git a/packages/@aws-cdk/user-input-gen/lib/yargs-gen.ts b/packages/@aws-cdk/user-input-gen/lib/yargs-gen.ts index 2b92e34fd..1481f29ca 100644 --- a/packages/@aws-cdk/user-input-gen/lib/yargs-gen.ts +++ b/packages/@aws-cdk/user-input-gen/lib/yargs-gen.ts @@ -1,8 +1,9 @@ -import { $E, Expression, ExternalModule, FreeFunction, IScope, Module, SelectiveModuleImport, Statement, ThingSymbol, Type, TypeScriptRenderer, code, expr } from '@cdklabs/typewriter'; +import type { IScope, Statement } from '@cdklabs/typewriter'; +import { $E, Expression, ExternalModule, FreeFunction, Module, SelectiveModuleImport, ThingSymbol, Type, TypeScriptRenderer, code, expr } from '@cdklabs/typewriter'; import { EsLintRules } from '@cdklabs/typewriter/lib/eslint-rules'; import * as prettier from 'prettier'; import { lit, SOURCE_OF_TRUTH } from './util'; -import { CliConfig, CliOption, YargsOption } from './yargs-types'; +import type { CliConfig, CliOption, YargsOption } from './yargs-types'; // to import lodash.clonedeep properly, we would need to set esModuleInterop: true // however that setting does not work in the CLI, so we fudge it. @@ -47,7 +48,10 @@ export async function renderYargs(config: CliConfig, helpers: CliHelpers): Promi parseCommandLineArguments.addBody(makeYargs(config, helpers)); const ts = new TypeScriptRenderer({ - disabledEsLintRules: [EsLintRules.MAX_LEN], // the default disabled rules result in 'Definition for rule 'prettier/prettier' was not found' + disabledEsLintRules: [ + EsLintRules.MAX_LEN, // the default disabled rules result in 'Definition for rule 'prettier/prettier' was not found + '@typescript-eslint/consistent-type-imports', // (ironically) typewriter does not support type imports + ], }).render(scope); return prettier.format(ts, { diff --git a/packages/@aws-cdk/user-input-gen/test/convert-to-user-input-gen.test.ts b/packages/@aws-cdk/user-input-gen/test/convert-to-user-input-gen.test.ts index b6b676429..d48d74d8c 100644 --- a/packages/@aws-cdk/user-input-gen/test/convert-to-user-input-gen.test.ts +++ b/packages/@aws-cdk/user-input-gen/test/convert-to-user-input-gen.test.ts @@ -1,4 +1,5 @@ -import { CliConfig, renderUserInputFuncs } from '../lib'; +import type { CliConfig } from '../lib'; +import { renderUserInputFuncs } from '../lib'; describe('render', () => { test('can generate conversion function', async () => { @@ -48,7 +49,7 @@ describe('render', () => { // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- - /* eslint-disable @stylistic/max-len */ + /* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ import { Command } from './user-configuration'; import { UserInput, GlobalOptions } from './user-input'; diff --git a/packages/@aws-cdk/user-input-gen/test/user-input-gen.test.ts b/packages/@aws-cdk/user-input-gen/test/user-input-gen.test.ts index b5566f84b..5de64fb3f 100644 --- a/packages/@aws-cdk/user-input-gen/test/user-input-gen.test.ts +++ b/packages/@aws-cdk/user-input-gen/test/user-input-gen.test.ts @@ -1,4 +1,5 @@ -import { CliConfig, renderUserInputType } from '../lib'; +import type { CliConfig } from '../lib'; +import { renderUserInputType } from '../lib'; describe('render', () => { test('can generate UserInput type', async () => { @@ -48,7 +49,7 @@ describe('render', () => { // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- - /* eslint-disable @stylistic/max-len */ + /* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ import { Command } from './user-configuration'; /** @@ -157,7 +158,7 @@ describe('render', () => { // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- - /* eslint-disable @stylistic/max-len */ + /* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ import { Command } from './user-configuration'; /** @@ -239,7 +240,7 @@ describe('render', () => { // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- - /* eslint-disable @stylistic/max-len */ + /* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ import { Command } from './user-configuration'; /** diff --git a/packages/@aws-cdk/user-input-gen/test/yargs-gen.test.ts b/packages/@aws-cdk/user-input-gen/test/yargs-gen.test.ts index 5040c5e7e..fb6840d1f 100644 --- a/packages/@aws-cdk/user-input-gen/test/yargs-gen.test.ts +++ b/packages/@aws-cdk/user-input-gen/test/yargs-gen.test.ts @@ -1,5 +1,6 @@ import { $E, expr, ThingSymbol } from '@cdklabs/typewriter'; -import { CliConfig, CliHelpers, renderYargs } from '../lib'; +import type { CliConfig } from '../lib'; +import { CliHelpers, renderYargs } from '../lib'; const YARGS_HELPERS = new CliHelpers('./util/yargs-helpers'); @@ -28,7 +29,7 @@ describe('render', () => { // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- - /* eslint-disable @stylistic/max-len */ + /* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ import { Argv } from 'yargs'; import * as helpers from './util/yargs-helpers'; @@ -94,7 +95,7 @@ describe('render', () => { // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- - /* eslint-disable @stylistic/max-len */ + /* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ import { Argv } from 'yargs'; import * as helpers from './util/yargs-helpers'; @@ -139,9 +140,7 @@ describe('render', () => { one: { type: 'boolean', default: $E( - expr - .sym(new ThingSymbol('banana', YARGS_HELPERS)) - .call(expr.lit(1), expr.lit(2), expr.lit(3)), + expr.sym(new ThingSymbol('banana', YARGS_HELPERS)).call(expr.lit(1), expr.lit(2), expr.lit(3)), ), }, }, @@ -149,9 +148,7 @@ describe('render', () => { }, }; - expect(await renderYargs(config, YARGS_HELPERS)).toContain( - 'default: helpers.banana(1, 2, 3)', - ); + expect(await renderYargs(config, YARGS_HELPERS)).toContain('default: helpers.banana(1, 2, 3)'); }); test('special notification-arn option gets NO default value', async () => { @@ -179,7 +176,7 @@ describe('render', () => { // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- - /* eslint-disable @stylistic/max-len */ + /* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ import { Argv } from 'yargs'; import * as helpers from './util/yargs-helpers'; diff --git a/packages/@aws-cdk/yarn-cling/.eslintrc.json b/packages/@aws-cdk/yarn-cling/.eslintrc.json index d45b6fa34..8d4b0afed 100644 --- a/packages/@aws-cdk/yarn-cling/.eslintrc.json +++ b/packages/@aws-cdk/yarn-cling/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/@aws-cdk/yarn-cling/lib/hoisting.ts b/packages/@aws-cdk/yarn-cling/lib/hoisting.ts index e5d1d7355..9d6393949 100644 --- a/packages/@aws-cdk/yarn-cling/lib/hoisting.ts +++ b/packages/@aws-cdk/yarn-cling/lib/hoisting.ts @@ -1,4 +1,4 @@ -import { PackageLockPackage } from './types'; +import type { PackageLockPackage } from './types'; /** * Hoist package-lock dependencies in-place diff --git a/packages/@aws-cdk/yarn-cling/lib/index.ts b/packages/@aws-cdk/yarn-cling/lib/index.ts index 0b17985b8..24f022378 100644 --- a/packages/@aws-cdk/yarn-cling/lib/index.ts +++ b/packages/@aws-cdk/yarn-cling/lib/index.ts @@ -3,7 +3,7 @@ import * as path from 'path'; import * as lockfile from '@yarnpkg/lockfile'; import * as semver from 'semver'; import { hoistDependencies } from './hoisting'; -import { PackageJson, PackageLock, PackageLockEntry, PackageLockPackage, YarnLock } from './types'; +import type { PackageJson, PackageLock, PackageLockEntry, PackageLockPackage, YarnLock } from './types'; export interface ShrinkwrapOptions { /** diff --git a/packages/@aws-cdk/yarn-cling/test/hoisting.test.ts b/packages/@aws-cdk/yarn-cling/test/hoisting.test.ts index e5bcc1314..44f4ef357 100644 --- a/packages/@aws-cdk/yarn-cling/test/hoisting.test.ts +++ b/packages/@aws-cdk/yarn-cling/test/hoisting.test.ts @@ -1,5 +1,5 @@ import { hoistDependencies, renderTree } from '../lib/hoisting'; -import { PackageLockPackage } from '../lib/types'; +import type { PackageLockPackage } from '../lib/types'; type DependencyTree = PackageLockPackage; diff --git a/packages/aws-cdk/.eslintrc.json b/packages/aws-cdk/.eslintrc.json index acd4d9b6b..3b7564c00 100644 --- a/packages/aws-cdk/.eslintrc.json +++ b/packages/aws-cdk/.eslintrc.json @@ -270,6 +270,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/aws-cdk/lib/api/aws-auth/account-cache.ts b/packages/aws-cdk/lib/api/aws-auth/account-cache.ts index 070d1ed04..ae58a57c0 100644 --- a/packages/aws-cdk/lib/api/aws-auth/account-cache.ts +++ b/packages/aws-cdk/lib/api/aws-auth/account-cache.ts @@ -1,6 +1,6 @@ import * as path from 'path'; import * as fs from 'fs-extra'; -import { Account } from './sdk-provider'; +import type { Account } from './sdk-provider'; import { debug } from '../../logging'; import { cdkCacheDir } from '../../util'; diff --git a/packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts b/packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts index 4c83aaee5..38e76d0e9 100644 --- a/packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts +++ b/packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts @@ -2,7 +2,7 @@ import { createCredentialChain, fromEnv, fromIni, fromNodeProviderChain } from ' import { MetadataService } from '@aws-sdk/ec2-metadata-service'; import type { NodeHttpHandlerOptions } from '@smithy/node-http-handler'; import { loadSharedConfigFiles } from '@smithy/shared-ini-file-loader'; -import { AwsCredentialIdentityProvider, Logger } from '@smithy/types'; +import type { AwsCredentialIdentityProvider, Logger } from '@smithy/types'; import * as promptly from 'promptly'; import { ProxyAgent } from 'proxy-agent'; import { makeCachingProvider } from './provider-caching'; diff --git a/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts b/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts index e1a494ec3..d37ec7f58 100644 --- a/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts +++ b/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts @@ -5,7 +5,7 @@ import { credentialsAboutToExpire, makeCachingProvider } from './provider-cachin import { debug, warning } from '../../logging'; import { AuthenticationError } from '../../toolkit/error'; import { formatErrorMessage } from '../../util'; -import { Mode } from '../plugin/mode'; +import type { Mode } from '../plugin/mode'; import { PluginHost } from '../plugin/plugin'; /** diff --git a/packages/aws-cdk/lib/api/aws-auth/provider-caching.ts b/packages/aws-cdk/lib/api/aws-auth/provider-caching.ts index 77b763023..666ebef6d 100644 --- a/packages/aws-cdk/lib/api/aws-auth/provider-caching.ts +++ b/packages/aws-cdk/lib/api/aws-auth/provider-caching.ts @@ -1,5 +1,5 @@ import { memoize } from '@smithy/property-provider'; -import { AwsCredentialIdentity, AwsCredentialIdentityProvider } from '@smithy/types'; +import type { AwsCredentialIdentity, AwsCredentialIdentityProvider } from '@smithy/types'; /** * Wrap a credential provider in a cache diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk-logger.ts b/packages/aws-cdk/lib/api/aws-auth/sdk-logger.ts index 7d1f4d617..a330c5863 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk-logger.ts +++ b/packages/aws-cdk/lib/api/aws-auth/sdk-logger.ts @@ -1,6 +1,7 @@ import { inspect, format } from 'util'; -import { Logger } from '@smithy/types'; -import { IoHelper, IO } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { Logger } from '@smithy/types'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import { IO } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { replacerBufferWithInfo } from '../../util'; export class SdkToCliLogger implements Logger { diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts b/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts index 7bb197944..ec53a9237 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts +++ b/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts @@ -1,10 +1,11 @@ import * as os from 'os'; -import { ContextLookupRoleOptions } from '@aws-cdk/cloud-assembly-schema'; -import { Environment, EnvironmentUtils, UNKNOWN_ACCOUNT, UNKNOWN_REGION } from '@aws-cdk/cx-api'; -import { AssumeRoleCommandInput } from '@aws-sdk/client-sts'; +import type { ContextLookupRoleOptions } from '@aws-cdk/cloud-assembly-schema'; +import type { Environment } from '@aws-cdk/cx-api'; +import { EnvironmentUtils, UNKNOWN_ACCOUNT, UNKNOWN_REGION } from '@aws-cdk/cx-api'; +import type { AssumeRoleCommandInput } from '@aws-sdk/client-sts'; import { fromTemporaryCredentials } from '@aws-sdk/credential-providers'; import type { NodeHttpHandlerOptions } from '@smithy/node-http-handler'; -import { AwsCredentialIdentityProvider, Logger } from '@smithy/types'; +import type { AwsCredentialIdentityProvider, Logger } from '@smithy/types'; import { AwsCliCompatible } from './awscli-compatible'; import { cached } from './cached'; import { CredentialPlugins } from './credential-plugins'; diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk.ts b/packages/aws-cdk/lib/api/aws-auth/sdk.ts index 3d0dd1b43..7bd177dce 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk.ts +++ b/packages/aws-cdk/lib/api/aws-auth/sdk.ts @@ -1,125 +1,133 @@ +import type { + FunctionConfiguration, + GetSchemaCreationStatusCommandInput, + GetSchemaCreationStatusCommandOutput, + ListFunctionsCommandInput, + StartSchemaCreationCommandInput, + StartSchemaCreationCommandOutput, + UpdateApiKeyCommandInput, + UpdateApiKeyCommandOutput, + UpdateFunctionCommandInput, + UpdateFunctionCommandOutput, + UpdateResolverCommandInput, + UpdateResolverCommandOutput, +} from '@aws-sdk/client-appsync'; import { AppSyncClient, - FunctionConfiguration, GetSchemaCreationStatusCommand, - type GetSchemaCreationStatusCommandInput, - type GetSchemaCreationStatusCommandOutput, - type ListFunctionsCommandInput, paginateListFunctions, StartSchemaCreationCommand, - type StartSchemaCreationCommandInput, - type StartSchemaCreationCommandOutput, UpdateApiKeyCommand, - type UpdateApiKeyCommandInput, - type UpdateApiKeyCommandOutput, UpdateFunctionCommand, - type UpdateFunctionCommandInput, - type UpdateFunctionCommandOutput, UpdateResolverCommand, - type UpdateResolverCommandInput, - type UpdateResolverCommandOutput, } from '@aws-sdk/client-appsync'; -import { - CloudControlClient, - GetResourceCommand, +import type { GetResourceCommandInput, GetResourceCommandOutput, - ListResourcesCommand, ListResourcesCommandInput, ListResourcesCommandOutput, } from '@aws-sdk/client-cloudcontrol'; import { - CloudFormationClient, - ContinueUpdateRollbackCommand, + CloudControlClient, + GetResourceCommand, + ListResourcesCommand, +} from '@aws-sdk/client-cloudcontrol'; +import type { ContinueUpdateRollbackCommandInput, ContinueUpdateRollbackCommandOutput, + DescribeStackEventsCommandOutput, + DescribeStackResourcesCommandInput, + DescribeStackResourcesCommandOutput, + ListStacksCommandInput, + ListStacksCommandOutput, + RollbackStackCommandInput, + RollbackStackCommandOutput, + StackResourceSummary, + CreateChangeSetCommandInput, + CreateChangeSetCommandOutput, + CreateGeneratedTemplateCommandInput, + CreateGeneratedTemplateCommandOutput, + CreateStackCommandInput, + CreateStackCommandOutput, + DeleteChangeSetCommandInput, + DeleteChangeSetCommandOutput, + DeleteGeneratedTemplateCommandInput, + DeleteGeneratedTemplateCommandOutput, + DeleteStackCommandInput, + DeleteStackCommandOutput, + DescribeChangeSetCommandInput, + DescribeChangeSetCommandOutput, + DescribeGeneratedTemplateCommandInput, + DescribeGeneratedTemplateCommandOutput, + DescribeResourceScanCommandInput, + DescribeResourceScanCommandOutput, + DescribeStackEventsCommandInput, + DescribeStacksCommandInput, + DescribeStacksCommandOutput, + ExecuteChangeSetCommandInput, + ExecuteChangeSetCommandOutput, + GetGeneratedTemplateCommandInput, + GetGeneratedTemplateCommandOutput, + GetTemplateCommandInput, + GetTemplateCommandOutput, + GetTemplateSummaryCommandInput, + GetTemplateSummaryCommandOutput, + ListExportsCommandInput, + ListExportsCommandOutput, + ListResourceScanRelatedResourcesCommandInput, + ListResourceScanRelatedResourcesCommandOutput, + ListResourceScanResourcesCommandInput, + ListResourceScanResourcesCommandOutput, + ListResourceScansCommandInput, + ListResourceScansCommandOutput, + ListStackResourcesCommandInput, + StartResourceScanCommandInput, + StartResourceScanCommandOutput, + UpdateStackCommandInput, + UpdateStackCommandOutput, + UpdateTerminationProtectionCommandInput, + UpdateTerminationProtectionCommandOutput, +} from '@aws-sdk/client-cloudformation'; +import { + CloudFormationClient, + ContinueUpdateRollbackCommand, CreateChangeSetCommand, - type CreateChangeSetCommandInput, - type CreateChangeSetCommandOutput, CreateGeneratedTemplateCommand, - type CreateGeneratedTemplateCommandInput, - type CreateGeneratedTemplateCommandOutput, CreateStackCommand, - type CreateStackCommandInput, - type CreateStackCommandOutput, DeleteChangeSetCommand, - type DeleteChangeSetCommandInput, - type DeleteChangeSetCommandOutput, DeleteGeneratedTemplateCommand, - type DeleteGeneratedTemplateCommandInput, - type DeleteGeneratedTemplateCommandOutput, DeleteStackCommand, - type DeleteStackCommandInput, - type DeleteStackCommandOutput, DescribeChangeSetCommand, - type DescribeChangeSetCommandInput, - type DescribeChangeSetCommandOutput, DescribeGeneratedTemplateCommand, - type DescribeGeneratedTemplateCommandInput, - type DescribeGeneratedTemplateCommandOutput, DescribeResourceScanCommand, - type DescribeResourceScanCommandInput, - type DescribeResourceScanCommandOutput, DescribeStackEventsCommand, - type DescribeStackEventsCommandInput, - DescribeStackEventsCommandOutput, DescribeStackResourcesCommand, - DescribeStackResourcesCommandInput, - DescribeStackResourcesCommandOutput, DescribeStacksCommand, - type DescribeStacksCommandInput, - type DescribeStacksCommandOutput, ExecuteChangeSetCommand, - type ExecuteChangeSetCommandInput, - type ExecuteChangeSetCommandOutput, GetGeneratedTemplateCommand, - type GetGeneratedTemplateCommandInput, - type GetGeneratedTemplateCommandOutput, GetTemplateCommand, - type GetTemplateCommandInput, - type GetTemplateCommandOutput, GetTemplateSummaryCommand, - type GetTemplateSummaryCommandInput, - type GetTemplateSummaryCommandOutput, ListExportsCommand, - type ListExportsCommandInput, - type ListExportsCommandOutput, ListResourceScanRelatedResourcesCommand, - type ListResourceScanRelatedResourcesCommandInput, - type ListResourceScanRelatedResourcesCommandOutput, ListResourceScanResourcesCommand, - type ListResourceScanResourcesCommandInput, - type ListResourceScanResourcesCommandOutput, ListResourceScansCommand, - type ListResourceScansCommandInput, - type ListResourceScansCommandOutput, - type ListStackResourcesCommandInput, ListStacksCommand, - ListStacksCommandInput, - ListStacksCommandOutput, paginateListStackResources, RollbackStackCommand, - RollbackStackCommandInput, - RollbackStackCommandOutput, - StackResourceSummary, StartResourceScanCommand, - type StartResourceScanCommandInput, - type StartResourceScanCommandOutput, UpdateStackCommand, - type UpdateStackCommandInput, - type UpdateStackCommandOutput, UpdateTerminationProtectionCommand, - type UpdateTerminationProtectionCommandInput, - type UpdateTerminationProtectionCommandOutput, } from '@aws-sdk/client-cloudformation'; +import type { + FilterLogEventsCommandInput, + FilterLogEventsCommandOutput, + DescribeLogGroupsCommandInput, + DescribeLogGroupsCommandOutput, +} from '@aws-sdk/client-cloudwatch-logs'; import { CloudWatchLogsClient, DescribeLogGroupsCommand, - type DescribeLogGroupsCommandInput, - type DescribeLogGroupsCommandOutput, FilterLogEventsCommand, - FilterLogEventsCommandInput, - FilterLogEventsCommandOutput, } from '@aws-sdk/client-cloudwatch-logs'; import { CodeBuildClient, @@ -157,63 +165,69 @@ import { type DescribeVpnGatewaysCommandOutput, EC2Client, } from '@aws-sdk/client-ec2'; -import { - BatchDeleteImageCommand, +import type { BatchDeleteImageCommandInput, BatchDeleteImageCommandOutput, + ListImagesCommandInput, + ListImagesCommandOutput, + PutImageCommandInput, + PutImageCommandOutput, + BatchGetImageCommandInput, + BatchGetImageCommandOutput, + CreateRepositoryCommandInput, + CreateRepositoryCommandOutput, + DescribeImagesCommandInput as ECRDescribeImagesCommandInput, + DescribeImagesCommandOutput as ECRDescribeImagesCommandOutput, + DescribeRepositoriesCommandInput, + DescribeRepositoriesCommandOutput, + GetAuthorizationTokenCommandInput, + GetAuthorizationTokenCommandOutput, + PutImageScanningConfigurationCommandInput, + PutImageScanningConfigurationCommandOutput, +} from '@aws-sdk/client-ecr'; +import { + BatchDeleteImageCommand, CreateRepositoryCommand, - type CreateRepositoryCommandInput, - type CreateRepositoryCommandOutput, DescribeImagesCommand as ECRDescribeImagesCommand, - type DescribeImagesCommandInput as ECRDescribeImagesCommandInput, - type DescribeImagesCommandOutput as ECRDescribeImagesCommandOutput, DescribeRepositoriesCommand, - type DescribeRepositoriesCommandInput, - type DescribeRepositoriesCommandOutput, ECRClient, GetAuthorizationTokenCommand, - type GetAuthorizationTokenCommandInput, - type GetAuthorizationTokenCommandOutput, ListImagesCommand, - ListImagesCommandInput, - ListImagesCommandOutput, PutImageCommand, - PutImageCommandInput, - PutImageCommandOutput, PutImageScanningConfigurationCommand, - type PutImageScanningConfigurationCommandInput, - type PutImageScanningConfigurationCommandOutput, - BatchGetImageCommandInput, BatchGetImageCommand, - BatchGetImageCommandOutput, } from '@aws-sdk/client-ecr'; -import { +import type { DescribeServicesCommandInput, + RegisterTaskDefinitionCommandInput, + ListClustersCommandInput, + ListClustersCommandOutput, + RegisterTaskDefinitionCommandOutput, + UpdateServiceCommandInput, + UpdateServiceCommandOutput, +} from '@aws-sdk/client-ecs'; +import { ECSClient, ListClustersCommand, - type ListClustersCommandInput, - type ListClustersCommandOutput, RegisterTaskDefinitionCommand, - RegisterTaskDefinitionCommandInput, - type RegisterTaskDefinitionCommandOutput, UpdateServiceCommand, - type UpdateServiceCommandInput, - type UpdateServiceCommandOutput, waitUntilServicesStable, } from '@aws-sdk/client-ecs'; +import type { + Listener, + LoadBalancer, + DescribeListenersCommandInput, + DescribeListenersCommandOutput, + DescribeLoadBalancersCommandInput, + DescribeLoadBalancersCommandOutput, + DescribeTagsCommandInput, + DescribeTagsCommandOutput, +} from '@aws-sdk/client-elastic-load-balancing-v2'; import { DescribeListenersCommand, - type DescribeListenersCommandInput, - type DescribeListenersCommandOutput, DescribeLoadBalancersCommand, - type DescribeLoadBalancersCommandInput, - type DescribeLoadBalancersCommandOutput, DescribeTagsCommand, - type DescribeTagsCommandInput, - type DescribeTagsCommandOutput, ElasticLoadBalancingV2Client, - Listener, - LoadBalancer, paginateDescribeListeners, paginateDescribeLoadBalancers, } from '@aws-sdk/client-elastic-load-balancing-v2'; @@ -269,33 +283,35 @@ import { type ListHostedZonesCommandOutput, Route53Client, } from '@aws-sdk/client-route-53'; -import { - type CompleteMultipartUploadCommandOutput, - DeleteObjectsCommand, +import type { DeleteObjectsCommandInput, DeleteObjectsCommandOutput, - DeleteObjectTaggingCommand, DeleteObjectTaggingCommandInput, DeleteObjectTaggingCommandOutput, + GetObjectTaggingCommandInput, + GetObjectTaggingCommandOutput, + PutObjectTaggingCommandInput, + PutObjectTaggingCommandOutput, + CompleteMultipartUploadCommandOutput, + GetBucketEncryptionCommandInput, + GetBucketEncryptionCommandOutput, + GetBucketLocationCommandInput, + GetBucketLocationCommandOutput, + GetObjectCommandInput, + GetObjectCommandOutput, + ListObjectsV2CommandInput, + ListObjectsV2CommandOutput, + PutObjectCommandInput, +} from '@aws-sdk/client-s3'; +import { + DeleteObjectsCommand, + DeleteObjectTaggingCommand, GetBucketEncryptionCommand, - type GetBucketEncryptionCommandInput, - type GetBucketEncryptionCommandOutput, GetBucketLocationCommand, - type GetBucketLocationCommandInput, - type GetBucketLocationCommandOutput, GetObjectCommand, - type GetObjectCommandInput, - type GetObjectCommandOutput, GetObjectTaggingCommand, - GetObjectTaggingCommandInput, - GetObjectTaggingCommandOutput, ListObjectsV2Command, - type ListObjectsV2CommandInput, - type ListObjectsV2CommandOutput, - type PutObjectCommandInput, PutObjectTaggingCommand, - PutObjectTaggingCommandInput, - PutObjectTaggingCommandOutput, S3Client, } from '@aws-sdk/client-s3'; import { @@ -304,11 +320,13 @@ import { type GetSecretValueCommandOutput, SecretsManagerClient, } from '@aws-sdk/client-secrets-manager'; +import type { + UpdateStateMachineCommandInput, + UpdateStateMachineCommandOutput, +} from '@aws-sdk/client-sfn'; import { SFNClient, UpdateStateMachineCommand, - UpdateStateMachineCommandInput, - UpdateStateMachineCommandOutput, } from '@aws-sdk/client-sfn'; import { GetParameterCommand, @@ -320,12 +338,12 @@ import { GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts'; import { Upload } from '@aws-sdk/lib-storage'; import { getEndpointFromInstructions } from '@smithy/middleware-endpoint'; import type { NodeHttpHandlerOptions } from '@smithy/node-http-handler'; -import { AwsCredentialIdentityProvider, Logger } from '@smithy/types'; +import type { AwsCredentialIdentityProvider, Logger } from '@smithy/types'; import { ConfiguredRetryStrategy } from '@smithy/util-retry'; -import { WaiterResult } from '@smithy/util-waiter'; +import type { WaiterResult } from '@smithy/util-waiter'; import { AccountAccessKeyCache } from './account-cache'; import { cachedAsync } from './cached'; -import { Account } from './sdk-provider'; +import type { Account } from './sdk-provider'; import { traceMemberMethods } from './tracing'; import { defaultCliUserAgent } from './user-agent'; import { debug } from '../../logging'; diff --git a/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts b/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts index e913e48e5..1fbfa2ac6 100644 --- a/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts +++ b/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts @@ -1,10 +1,10 @@ import { info } from 'console'; import * as path from 'path'; -import * as cxapi from '@aws-cdk/cx-api'; +import type * as cxapi from '@aws-cdk/cx-api'; import type { BootstrapEnvironmentOptions, BootstrappingParameters } from './bootstrap-props'; import { BootstrapStack, bootstrapVersionFromTemplate } from './deploy-bootstrap'; import { legacyBootstrapTemplate } from './legacy-template'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { warn } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; import { bundledPackageRootDir, loadStructuredFile, serializeStructure } from '../../util'; diff --git a/packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts b/packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts index c163f991e..c8c0430ab 100644 --- a/packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts +++ b/packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts @@ -1,6 +1,6 @@ -import { BootstrapSource } from './bootstrap-environment'; -import { Tag } from '../tags'; -import { StringWithoutPlaceholders } from '../util/placeholders'; +import type { BootstrapSource } from './bootstrap-environment'; +import type { Tag } from '../tags'; +import type { StringWithoutPlaceholders } from '../util/placeholders'; export const BUCKET_NAME_OUTPUT = 'BucketName'; export const REPOSITORY_NAME_OUTPUT = 'ImageRepositoryName'; diff --git a/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts b/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts index 0b54689fe..e6011e323 100644 --- a/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts +++ b/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts @@ -1,19 +1,21 @@ import * as os from 'os'; import * as path from 'path'; import { ArtifactType } from '@aws-cdk/cloud-assembly-schema'; -import { CloudAssemblyBuilder, Environment, EnvironmentUtils } from '@aws-cdk/cx-api'; +import type { Environment } from '@aws-cdk/cx-api'; +import { CloudAssemblyBuilder, EnvironmentUtils } from '@aws-cdk/cx-api'; import * as fs from 'fs-extra'; +import type { BootstrapEnvironmentOptions } from './bootstrap-props'; import { BOOTSTRAP_VARIANT_PARAMETER, BOOTSTRAP_VERSION_OUTPUT, BOOTSTRAP_VERSION_RESOURCE, - BootstrapEnvironmentOptions, DEFAULT_BOOTSTRAP_VARIANT, } from './bootstrap-props'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { warn } from '../../cli/messages'; import type { SDK, SdkProvider } from '../aws-auth'; -import { assertIsSuccessfulDeployStackResult, SuccessfulDeployStackResult } from '../deployments'; +import type { SuccessfulDeployStackResult } from '../deployments'; +import { assertIsSuccessfulDeployStackResult } from '../deployments'; import { deployStack } from '../deployments/deploy-stack'; import { NoBootstrapStackEnvironmentResources } from '../environment'; import { Mode } from '../plugin/mode'; diff --git a/packages/aws-cdk/lib/api/bootstrap/legacy-template.ts b/packages/aws-cdk/lib/api/bootstrap/legacy-template.ts index dd9e89f1f..0125556ba 100644 --- a/packages/aws-cdk/lib/api/bootstrap/legacy-template.ts +++ b/packages/aws-cdk/lib/api/bootstrap/legacy-template.ts @@ -1,4 +1,5 @@ -import { BootstrappingParameters, BUCKET_DOMAIN_NAME_OUTPUT, BUCKET_NAME_OUTPUT } from './bootstrap-props'; +import type { BootstrappingParameters } from './bootstrap-props'; +import { BUCKET_DOMAIN_NAME_OUTPUT, BUCKET_NAME_OUTPUT } from './bootstrap-props'; export function legacyBootstrapTemplate(params: BootstrappingParameters): any { return { diff --git a/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts b/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts index 58e5a7cd7..2b1ef9c69 100644 --- a/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts +++ b/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts @@ -1,10 +1,10 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import type * as cxapi from '@aws-cdk/cx-api'; import { CloudAssembly } from './cloud-assembly'; -import { Configuration } from '../../cli/user-configuration'; +import type { Configuration } from '../../cli/user-configuration'; import * as contextproviders from '../../context-providers'; import { debug } from '../../logging'; import { ToolkitError } from '../../toolkit/error'; -import { SdkProvider } from '../aws-auth'; +import type { SdkProvider } from '../aws-auth'; /** * @returns output directory diff --git a/packages/aws-cdk/lib/api/cxapp/environments.ts b/packages/aws-cdk/lib/api/cxapp/environments.ts index 8dbc8a719..ddc58396d 100644 --- a/packages/aws-cdk/lib/api/cxapp/environments.ts +++ b/packages/aws-cdk/lib/api/cxapp/environments.ts @@ -1,8 +1,8 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import type * as cxapi from '@aws-cdk/cx-api'; import { minimatch } from 'minimatch'; -import { StackCollection } from './cloud-assembly'; +import type { StackCollection } from './cloud-assembly'; import { ToolkitError } from '../../toolkit/error'; -import { SdkProvider } from '../aws-auth'; +import type { SdkProvider } from '../aws-auth'; export function looksLikeGlob(environment: string) { return environment.indexOf('*') > -1; diff --git a/packages/aws-cdk/lib/api/cxapp/exec.ts b/packages/aws-cdk/lib/api/cxapp/exec.ts index 6b2e6ba8b..7f5f0c9db 100644 --- a/packages/aws-cdk/lib/api/cxapp/exec.ts +++ b/packages/aws-cdk/lib/api/cxapp/exec.ts @@ -5,15 +5,17 @@ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; import * as fs from 'fs-extra'; import * as semver from 'semver'; -import { Configuration, PROJECT_CONFIG, USER_DEFAULTS } from '../../cli/user-configuration'; +import type { Configuration } from '../../cli/user-configuration'; +import { PROJECT_CONFIG, USER_DEFAULTS } from '../../cli/user-configuration'; import { versionNumber } from '../../cli/version'; import { debug, warning } from '../../logging'; import { ToolkitError } from '../../toolkit/error'; import { loadTree, some } from '../../tree'; import { splitBySize } from '../../util'; -import { SdkProvider } from '../aws-auth'; -import { Settings } from '../settings'; -import { RWLock, ILock } from '../util/rwlock'; +import type { SdkProvider } from '../aws-auth'; +import type { Settings } from '../settings'; +import type { ILock } from '../util/rwlock'; +import { RWLock } from '../util/rwlock'; export interface ExecProgramResult { readonly assembly: cxapi.CloudAssembly; diff --git a/packages/aws-cdk/lib/api/deployments/asset-publishing.ts b/packages/aws-cdk/lib/api/deployments/asset-publishing.ts index 43355ef65..0bce3ad11 100644 --- a/packages/aws-cdk/lib/api/deployments/asset-publishing.ts +++ b/packages/aws-cdk/lib/api/deployments/asset-publishing.ts @@ -1,19 +1,21 @@ import { type Environment, UNKNOWN_ACCOUNT, UNKNOWN_REGION } from '@aws-cdk/cx-api'; -import { - type Account, - type AssetManifest, - AssetPublishing, +import type { ClientOptions, EventType, - type IAws, - type IECRClient, - type IPublishProgress, - type IPublishProgressListener, - type IS3Client, - type ISecretsManagerClient, + Account, + AssetManifest, + IAws, + IECRClient, + IPublishProgress, + IPublishProgressListener, + IS3Client, + ISecretsManagerClient, +} from 'cdk-assets'; +import { + AssetPublishing, } from 'cdk-assets'; import type { SDK } from '..'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { formatMessage } from '../../cli/messages'; import type { IoMessageLevel } from '../../toolkit/cli-io-host'; import { ToolkitError } from '../../toolkit/error'; diff --git a/packages/aws-cdk/lib/api/deployments/assets.ts b/packages/aws-cdk/lib/api/deployments/assets.ts index d600e7a47..458bc0f2d 100644 --- a/packages/aws-cdk/lib/api/deployments/assets.ts +++ b/packages/aws-cdk/lib/api/deployments/assets.ts @@ -3,12 +3,12 @@ import * as path from 'path'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; import * as chalk from 'chalk'; -import { AssetManifestBuilder } from './asset-manifest-builder'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { AssetManifestBuilder } from './asset-manifest-builder'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { debug } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; -import { EnvironmentResources } from '../environment'; -import { ToolkitInfo } from '../toolkit-info'; +import type { EnvironmentResources } from '../environment'; +import type { ToolkitInfo } from '../toolkit-info'; /** * Take the metadata assets from the given stack and add them to the given asset manifest diff --git a/packages/aws-cdk/lib/api/deployments/checks.ts b/packages/aws-cdk/lib/api/deployments/checks.ts index 92c6f1e41..7448a6e0b 100644 --- a/packages/aws-cdk/lib/api/deployments/checks.ts +++ b/packages/aws-cdk/lib/api/deployments/checks.ts @@ -1,7 +1,7 @@ -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { debug } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; -import { SDK } from '../aws-auth'; +import type { SDK } from '../aws-auth'; export async function determineAllowCrossAccountAssetPublishing( sdk: SDK, diff --git a/packages/aws-cdk/lib/api/deployments/cloudformation.ts b/packages/aws-cdk/lib/api/deployments/cloudformation.ts index da4ec7af2..ce071bb68 100644 --- a/packages/aws-cdk/lib/api/deployments/cloudformation.ts +++ b/packages/aws-cdk/lib/api/deployments/cloudformation.ts @@ -10,16 +10,18 @@ import { type Stack, type Tag, } from '@aws-sdk/client-cloudformation'; -import { AssetManifest, FileManifestEntry } from 'cdk-assets'; +import type { FileManifestEntry } from 'cdk-assets'; +import { AssetManifest } from 'cdk-assets'; import { AssetManifestBuilder } from './asset-manifest-builder'; import type { Deployments } from './deployments'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { debug } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; import { formatErrorMessage, deserializeStructure } from '../../util'; import type { ICloudFormationClient, SdkProvider } from '../aws-auth'; import { StackStatus } from '../stack-events'; -import { makeBodyParameter, TemplateBodyParameter } from '../util/template-body-parameter'; +import type { TemplateBodyParameter } from '../util/template-body-parameter'; +import { makeBodyParameter } from '../util/template-body-parameter'; export type ResourcesToImport = ResourceToImport[]; export type ResourceIdentifierSummaries = ResourceIdentifierSummary[]; diff --git a/packages/aws-cdk/lib/api/deployments/deploy-stack.ts b/packages/aws-cdk/lib/api/deployments/deploy-stack.ts index 82380c131..82efdac92 100644 --- a/packages/aws-cdk/lib/api/deployments/deploy-stack.ts +++ b/packages/aws-cdk/lib/api/deployments/deploy-stack.ts @@ -1,5 +1,5 @@ import { format } from 'util'; -import * as cxapi from '@aws-cdk/cx-api'; +import type * as cxapi from '@aws-cdk/cx-api'; import type { CreateChangeSetCommandInput, CreateStackCommandInput, @@ -14,6 +14,11 @@ import { AssetManifestBuilder } from './asset-manifest-builder'; import { publishAssets } from './asset-publishing'; import { addMetadataAssetsToManifest } from './assets'; import { determineAllowCrossAccountAssetPublishing } from './checks'; +import type { + ParameterValues, + ParameterChanges, + ResourcesToImport, +} from './cloudformation'; import { changeSetHasNoChanges, CloudFormationStack, @@ -21,14 +26,11 @@ import { waitForChangeSet, waitForStackDeploy, waitForStackDelete, - ParameterValues, - ParameterChanges, - ResourcesToImport, } from './cloudformation'; -import { ChangeSetDeploymentMethod, DeploymentMethod } from './deployment-method'; -import { DeployStackResult, SuccessfulDeployStackResult } from './deployment-result'; +import type { ChangeSetDeploymentMethod, DeploymentMethod } from './deployment-method'; +import type { DeployStackResult, SuccessfulDeployStackResult } from './deployment-result'; import { tryHotswapDeployment } from './hotswap-deployments'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { debug, info, warn } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; import { formatErrorMessage } from '../../util'; @@ -37,7 +39,7 @@ import type { EnvironmentResources } from '../environment'; import { CfnEvaluationException } from '../evaluate-cloudformation-template'; import { HotswapMode, HotswapPropertyOverrides, ICON } from '../hotswap/common'; import { StackActivityMonitor } from '../stack-events'; -import { StringWithoutPlaceholders } from '../util/placeholders'; +import type { StringWithoutPlaceholders } from '../util/placeholders'; import { type TemplateBodyParameter, makeBodyParameter } from '../util/template-body-parameter'; export interface DeployStackOptions { diff --git a/packages/aws-cdk/lib/api/deployments/deployments.ts b/packages/aws-cdk/lib/api/deployments/deployments.ts index 828596958..4152938c4 100644 --- a/packages/aws-cdk/lib/api/deployments/deployments.ts +++ b/packages/aws-cdk/lib/api/deployments/deployments.ts @@ -1,5 +1,5 @@ import { randomUUID } from 'crypto'; -import * as cxapi from '@aws-cdk/cx-api'; +import type * as cxapi from '@aws-cdk/cx-api'; import * as cdk_assets from 'cdk-assets'; import * as chalk from 'chalk'; import { AssetManifestBuilder } from './asset-manifest-builder'; @@ -8,29 +8,31 @@ import { PublishingAws, } from './asset-publishing'; import { determineAllowCrossAccountAssetPublishing } from './checks'; +import type { + ResourcesToImport, + Template, + ResourceIdentifierSummaries, +} from './cloudformation'; import { CloudFormationStack, - type ResourceIdentifierSummaries, - ResourcesToImport, stabilizeStack, - Template, uploadStackTemplateAssets, } from './cloudformation'; import { deployStack, destroyStack } from './deploy-stack'; -import { DeploymentMethod } from './deployment-method'; -import { DeployStackResult } from './deployment-result'; +import type { DeploymentMethod } from './deployment-method'; +import type { DeployStackResult } from './deployment-result'; import { loadCurrentTemplate, loadCurrentTemplateWithNestedStacks, type RootTemplateWithNestedStacks, } from './nested-stack-helpers'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { debug, warn } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; import { formatErrorMessage } from '../../util'; import type { SdkProvider } from '../aws-auth/sdk-provider'; import { type EnvironmentResources, EnvironmentAccess } from '../environment'; -import { HotswapMode, HotswapPropertyOverrides } from '../hotswap/common'; +import type { HotswapMode, HotswapPropertyOverrides } from '../hotswap/common'; import { StackActivityMonitor, StackEventPoller, RollbackChoice } from '../stack-events'; import type { Tag } from '../tags'; import { DEFAULT_TOOLKIT_STACK_NAME } from '../toolkit-info'; diff --git a/packages/aws-cdk/lib/api/deployments/hotswap-deployments.ts b/packages/aws-cdk/lib/api/deployments/hotswap-deployments.ts index ef4f06fdb..e90b63fa1 100644 --- a/packages/aws-cdk/lib/api/deployments/hotswap-deployments.ts +++ b/packages/aws-cdk/lib/api/deployments/hotswap-deployments.ts @@ -1,25 +1,28 @@ import { format } from 'util'; import * as cfn_diff from '@aws-cdk/cloudformation-diff'; -import * as cxapi from '@aws-cdk/cx-api'; -import { WaiterResult } from '@smithy/util-waiter'; +import type * as cxapi from '@aws-cdk/cx-api'; +import type { WaiterResult } from '@smithy/util-waiter'; import * as chalk from 'chalk'; import type { SDK, SdkProvider } from '../aws-auth'; import type { CloudFormationStack } from './cloudformation'; -import { NestedStackTemplates, loadCurrentTemplateWithNestedStacks } from './nested-stack-helpers'; +import type { NestedStackTemplates } from './nested-stack-helpers'; +import { loadCurrentTemplateWithNestedStacks } from './nested-stack-helpers'; import { info } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; import { formatErrorMessage } from '../../util'; import { EvaluateCloudFormationTemplate } from '../evaluate-cloudformation-template'; import { isHotswappableAppSyncChange } from '../hotswap/appsync-mapping-templates'; import { isHotswappableCodeBuildProjectChange } from '../hotswap/code-build-projects'; -import { - ICON, +import type { ChangeHotswapResult, - HotswapMode, HotswappableChange, NonHotswappableChange, HotswappableChangeCandidate, HotswapPropertyOverrides, ClassifiedResourceChanges, +} from '../hotswap/common'; +import { + ICON, + HotswapMode, reportNonHotswappableChange, reportNonHotswappableResource, } from '../hotswap/common'; @@ -31,11 +34,11 @@ import { } from '../hotswap/s3-bucket-deployments'; import { isHotswappableStateMachineChange } from '../hotswap/stepfunctions-state-machines'; import { Mode } from '../plugin'; -import { SuccessfulDeployStackResult } from './deployment-result'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { SuccessfulDeployStackResult } from './deployment-result'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; // Must use a require() otherwise esbuild complains about calling a namespace -// eslint-disable-next-line @typescript-eslint/no-require-imports +// eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/consistent-type-imports const pLimit: typeof import('p-limit') = require('p-limit'); type HotswapDetector = ( diff --git a/packages/aws-cdk/lib/api/environment/environment-access.ts b/packages/aws-cdk/lib/api/environment/environment-access.ts index 7edbc02d5..888d9aea3 100644 --- a/packages/aws-cdk/lib/api/environment/environment-access.ts +++ b/packages/aws-cdk/lib/api/environment/environment-access.ts @@ -1,13 +1,15 @@ -import * as cxapi from '@aws-cdk/cx-api'; -import { SDK } from '../aws-auth'; -import { EnvironmentResources, EnvironmentResourcesRegistry } from './environment-resources'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type * as cxapi from '@aws-cdk/cx-api'; +import type { SDK } from '../aws-auth'; +import type { EnvironmentResources } from './environment-resources'; +import { EnvironmentResourcesRegistry } from './environment-resources'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { warn } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; import { formatErrorMessage } from '../../util'; -import { CredentialsOptions, SdkForEnvironment, SdkProvider } from '../aws-auth/sdk-provider'; +import type { CredentialsOptions, SdkForEnvironment, SdkProvider } from '../aws-auth/sdk-provider'; import { Mode } from '../plugin/mode'; -import { replaceEnvPlaceholders, StringWithoutPlaceholders } from '../util/placeholders'; +import type { StringWithoutPlaceholders } from '../util/placeholders'; +import { replaceEnvPlaceholders } from '../util/placeholders'; /** * Access particular AWS resources, based on information from the CX manifest diff --git a/packages/aws-cdk/lib/api/environment/environment-resources.ts b/packages/aws-cdk/lib/api/environment/environment-resources.ts index 48b1e087b..5cb64f809 100644 --- a/packages/aws-cdk/lib/api/environment/environment-resources.ts +++ b/packages/aws-cdk/lib/api/environment/environment-resources.ts @@ -1,5 +1,5 @@ import type { Environment } from '@aws-cdk/cx-api'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { debug, warn } from '../../cli/messages'; import { Notices } from '../../notices'; import { ToolkitError } from '../../toolkit/error'; diff --git a/packages/aws-cdk/lib/api/garbage-collection/garbage-collector.ts b/packages/aws-cdk/lib/api/garbage-collection/garbage-collector.ts index cab2eb703..efc130703 100644 --- a/packages/aws-cdk/lib/api/garbage-collection/garbage-collector.ts +++ b/packages/aws-cdk/lib/api/garbage-collection/garbage-collector.ts @@ -1,19 +1,19 @@ -import * as cxapi from '@aws-cdk/cx-api'; -import { ImageIdentifier } from '@aws-sdk/client-ecr'; -import { Tag } from '@aws-sdk/client-s3'; +import type * as cxapi from '@aws-cdk/cx-api'; +import type { ImageIdentifier } from '@aws-sdk/client-ecr'; +import type { Tag } from '@aws-sdk/client-s3'; import * as chalk from 'chalk'; import * as promptly from 'promptly'; -import { IECRClient, IS3Client, SDK, SdkProvider } from '../aws-auth'; +import type { IECRClient, IS3Client, SDK, SdkProvider } from '../aws-auth'; import { DEFAULT_TOOLKIT_STACK_NAME, ToolkitInfo } from '../toolkit-info'; import { ProgressPrinter } from './progress-printer'; import { ActiveAssetCache, BackgroundStackRefresh, refreshStacks } from './stack-refresh'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { debug, info } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; import { Mode } from '../plugin/mode'; // Must use a require() otherwise esbuild complains -// eslint-disable-next-line @typescript-eslint/no-require-imports +// eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/consistent-type-imports const pLimit: typeof import('p-limit') = require('p-limit'); export const S3_ISOLATED_TAG = 'aws-cdk:isolated'; diff --git a/packages/aws-cdk/lib/api/garbage-collection/progress-printer.ts b/packages/aws-cdk/lib/api/garbage-collection/progress-printer.ts index 8051af8f3..55faab525 100644 --- a/packages/aws-cdk/lib/api/garbage-collection/progress-printer.ts +++ b/packages/aws-cdk/lib/api/garbage-collection/progress-printer.ts @@ -1,6 +1,6 @@ import * as chalk from 'chalk'; -import { GcAsset as GCAsset } from './garbage-collector'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { GcAsset as GCAsset } from './garbage-collector'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { info } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; diff --git a/packages/aws-cdk/lib/api/garbage-collection/stack-refresh.ts b/packages/aws-cdk/lib/api/garbage-collection/stack-refresh.ts index e29d405ff..ead2f55b2 100644 --- a/packages/aws-cdk/lib/api/garbage-collection/stack-refresh.ts +++ b/packages/aws-cdk/lib/api/garbage-collection/stack-refresh.ts @@ -1,8 +1,8 @@ -import { ParameterDeclaration } from '@aws-sdk/client-cloudformation'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { ParameterDeclaration } from '@aws-sdk/client-cloudformation'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { debug } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; -import { ICloudFormationClient } from '../aws-auth'; +import type { ICloudFormationClient } from '../aws-auth'; export class ActiveAssetCache { private readonly stacks: Set = new Set(); diff --git a/packages/aws-cdk/lib/api/hotswap/ecs-services.ts b/packages/aws-cdk/lib/api/hotswap/ecs-services.ts index e3e4c3cd8..906fdb1db 100644 --- a/packages/aws-cdk/lib/api/hotswap/ecs-services.ts +++ b/packages/aws-cdk/lib/api/hotswap/ecs-services.ts @@ -1,8 +1,10 @@ +import type { + HotswapPropertyOverrides, + ChangeHotswapResult, + HotswappableChangeCandidate, +} from './common'; import { - type ChangeHotswapResult, - classifyChanges, - type HotswappableChangeCandidate, - HotswapPropertyOverrides, lowerCaseFirstCharacter, + classifyChanges, lowerCaseFirstCharacter, reportNonHotswappableChange, transformObjectKeys, } from './common'; diff --git a/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts b/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts index cd78fb189..dbff616e7 100644 --- a/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts +++ b/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts @@ -1,6 +1,7 @@ import { Writable } from 'stream'; -import { type FunctionConfiguration, type UpdateFunctionConfigurationCommandInput } from '@aws-sdk/client-lambda'; -import { type ChangeHotswapResult, classifyChanges, type HotswappableChangeCandidate, PropDiffs } from './common'; +import type { FunctionConfiguration, UpdateFunctionConfigurationCommandInput } from '@aws-sdk/client-lambda'; +import type { PropDiffs, ChangeHotswapResult, HotswappableChangeCandidate } from './common'; +import { classifyChanges } from './common'; import { ToolkitError } from '../../toolkit/error'; import { flatMap } from '../../util'; import type { ILambdaClient, SDK } from '../aws-auth'; diff --git a/packages/aws-cdk/lib/api/logs/find-cloudwatch-logs.ts b/packages/aws-cdk/lib/api/logs/find-cloudwatch-logs.ts index 90372a51b..7cf48a756 100644 --- a/packages/aws-cdk/lib/api/logs/find-cloudwatch-logs.ts +++ b/packages/aws-cdk/lib/api/logs/find-cloudwatch-logs.ts @@ -1,6 +1,7 @@ import type { CloudFormationStackArtifact, Environment } from '@aws-cdk/cx-api'; import type { StackResourceSummary } from '@aws-sdk/client-cloudformation'; -import { IO, IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import { IO } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { formatErrorMessage } from '../../util'; import type { SDK, SdkProvider } from '../aws-auth'; import { EnvironmentAccess } from '../environment'; diff --git a/packages/aws-cdk/lib/api/logs/logs-monitor.ts b/packages/aws-cdk/lib/api/logs/logs-monitor.ts index f5677a20a..91d220eec 100644 --- a/packages/aws-cdk/lib/api/logs/logs-monitor.ts +++ b/packages/aws-cdk/lib/api/logs/logs-monitor.ts @@ -1,9 +1,10 @@ import * as util from 'util'; -import * as cxapi from '@aws-cdk/cx-api'; +import type * as cxapi from '@aws-cdk/cx-api'; import * as chalk from 'chalk'; import * as uuid from 'uuid'; import type { CloudWatchLogEvent } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io'; -import { IO, IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import { IO } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { flatten } from '../../util'; import type { SDK } from '../aws-auth'; diff --git a/packages/aws-cdk/lib/api/resource-import/importer.ts b/packages/aws-cdk/lib/api/resource-import/importer.ts index 60b1a9c32..a9ed91313 100644 --- a/packages/aws-cdk/lib/api/resource-import/importer.ts +++ b/packages/aws-cdk/lib/api/resource-import/importer.ts @@ -1,14 +1,15 @@ import { format } from 'util'; import * as cfnDiff from '@aws-cdk/cloudformation-diff'; -import { ResourceDifference } from '@aws-cdk/cloudformation-diff'; -import * as cxapi from '@aws-cdk/cx-api'; +import type { ResourceDifference } from '@aws-cdk/cloudformation-diff'; +import type * as cxapi from '@aws-cdk/cx-api'; import * as chalk from 'chalk'; import * as fs from 'fs-extra'; import * as promptly from 'promptly'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { error, info, warn } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; -import { assertIsSuccessfulDeployStackResult, type Deployments, DeploymentMethod, ResourceIdentifierProperties, ResourcesToImport } from '../deployments'; +import type { DeploymentMethod, ResourceIdentifierProperties, ResourcesToImport, Deployments } from '../deployments'; +import { assertIsSuccessfulDeployStackResult } from '../deployments'; import type { Tag } from '../tags'; export interface ResourceImporterProps { diff --git a/packages/aws-cdk/lib/api/resource-import/migrator.ts b/packages/aws-cdk/lib/api/resource-import/migrator.ts index 6d3845a68..439c1ef89 100644 --- a/packages/aws-cdk/lib/api/resource-import/migrator.ts +++ b/packages/aws-cdk/lib/api/resource-import/migrator.ts @@ -1,11 +1,12 @@ import type * as cxapi from '@aws-cdk/cx-api'; import * as chalk from 'chalk'; import * as fs from 'fs-extra'; -import { ImportDeploymentOptions, ResourceImporter } from './importer'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { ImportDeploymentOptions } from './importer'; +import { ResourceImporter } from './importer'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { info } from '../../cli/messages'; import { formatTime } from '../../util'; -import { StackCollection } from '../cxapp/cloud-assembly'; +import type { StackCollection } from '../cxapp/cloud-assembly'; import type { Deployments, ResourcesToImport } from '../deployments'; export interface ResourceMigratorProps { diff --git a/packages/aws-cdk/lib/api/stack-events/stack-activity-monitor.ts b/packages/aws-cdk/lib/api/stack-events/stack-activity-monitor.ts index b266cc9f3..f7e3584af 100644 --- a/packages/aws-cdk/lib/api/stack-events/stack-activity-monitor.ts +++ b/packages/aws-cdk/lib/api/stack-events/stack-activity-monitor.ts @@ -9,7 +9,7 @@ import { debug, error, info } from '../../cli/messages'; import { stackEventHasErrorMessage } from '../../util'; import type { ICloudFormationClient } from '../aws-auth'; import { StackProgressMonitor } from './stack-progress-monitor'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; export interface StackActivityMonitorProps { /** diff --git a/packages/aws-cdk/lib/api/stack-events/stack-progress-monitor.ts b/packages/aws-cdk/lib/api/stack-events/stack-progress-monitor.ts index 92a0209b9..433830b57 100644 --- a/packages/aws-cdk/lib/api/stack-events/stack-progress-monitor.ts +++ b/packages/aws-cdk/lib/api/stack-events/stack-progress-monitor.ts @@ -1,7 +1,7 @@ import * as util from 'util'; import type { StackProgress } from '@aws-cdk/tmp-toolkit-helpers'; -import { StackEvent } from '@aws-sdk/client-cloudformation'; +import type { StackEvent } from '@aws-sdk/client-cloudformation'; import { padLeft } from '../../util'; /** diff --git a/packages/aws-cdk/lib/api/toolkit-info.ts b/packages/aws-cdk/lib/api/toolkit-info.ts index 1e47d1c4f..648129ea0 100644 --- a/packages/aws-cdk/lib/api/toolkit-info.ts +++ b/packages/aws-cdk/lib/api/toolkit-info.ts @@ -1,5 +1,5 @@ import { format } from 'util'; -import * as cxapi from '@aws-cdk/cx-api'; +import type * as cxapi from '@aws-cdk/cx-api'; import * as chalk from 'chalk'; import type { SDK } from './aws-auth'; import { @@ -11,7 +11,7 @@ import { REPOSITORY_NAME_OUTPUT, } from './bootstrap/bootstrap-props'; import { type CloudFormationStack, stabilizeStack } from './deployments/cloudformation'; -import { IoHelper } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { IoHelper } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { debug } from '../cli/messages'; import { ToolkitError } from '../toolkit/error'; diff --git a/packages/aws-cdk/lib/api/util/template-body-parameter.ts b/packages/aws-cdk/lib/api/util/template-body-parameter.ts index 582477a60..2f5658ae2 100644 --- a/packages/aws-cdk/lib/api/util/template-body-parameter.ts +++ b/packages/aws-cdk/lib/api/util/template-body-parameter.ts @@ -8,7 +8,7 @@ import { debug, error } from '../../logging'; import { ToolkitError } from '../../toolkit/error'; import { contentHash, toYAML } from '../../util'; import { type AssetManifestBuilder } from '../deployments'; -import { EnvironmentResources } from '../environment'; +import type { EnvironmentResources } from '../environment'; export type TemplateBodyParameter = { TemplateBody?: string; diff --git a/packages/aws-cdk/lib/api/work-graph/work-graph-builder.ts b/packages/aws-cdk/lib/api/work-graph/work-graph-builder.ts index e37f02473..f714e11d5 100644 --- a/packages/aws-cdk/lib/api/work-graph/work-graph-builder.ts +++ b/packages/aws-cdk/lib/api/work-graph/work-graph-builder.ts @@ -1,8 +1,9 @@ import * as cxapi from '@aws-cdk/cx-api'; import { AssetManifest, type IManifestEntry } from 'cdk-assets'; import { WorkGraph } from './work-graph'; -import { DeploymentState, AssetBuildNode, WorkNode } from './work-graph-types'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { AssetBuildNode, WorkNode } from './work-graph-types'; +import { DeploymentState } from './work-graph-types'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { ToolkitError } from '../../toolkit/error'; import { contentHashAny } from '../../util'; diff --git a/packages/aws-cdk/lib/api/work-graph/work-graph-types.ts b/packages/aws-cdk/lib/api/work-graph/work-graph-types.ts index 89fc46528..9e266519c 100644 --- a/packages/aws-cdk/lib/api/work-graph/work-graph-types.ts +++ b/packages/aws-cdk/lib/api/work-graph/work-graph-types.ts @@ -1,5 +1,5 @@ -import * as cxapi from '@aws-cdk/cx-api'; -import { AssetManifest, type IManifestEntry } from 'cdk-assets'; +import type * as cxapi from '@aws-cdk/cx-api'; +import type { AssetManifest, IManifestEntry } from 'cdk-assets'; export enum DeploymentState { PENDING = 'pending', diff --git a/packages/aws-cdk/lib/api/work-graph/work-graph.ts b/packages/aws-cdk/lib/api/work-graph/work-graph.ts index 9500e89fb..450435789 100644 --- a/packages/aws-cdk/lib/api/work-graph/work-graph.ts +++ b/packages/aws-cdk/lib/api/work-graph/work-graph.ts @@ -1,5 +1,6 @@ -import { WorkNode, DeploymentState, StackNode, AssetBuildNode, AssetPublishNode } from './work-graph-types'; -import { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { WorkNode, StackNode, AssetBuildNode, AssetPublishNode } from './work-graph-types'; +import { DeploymentState } from './work-graph-types'; +import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { debug, trace } from '../../cli/messages'; import { ToolkitError } from '../../toolkit/error'; import { parallelPromises } from '../../util'; diff --git a/packages/aws-cdk/lib/cli/activity-printer/base.ts b/packages/aws-cdk/lib/cli/activity-printer/base.ts index 2b101f4b8..b5f9f0bf7 100644 --- a/packages/aws-cdk/lib/cli/activity-printer/base.ts +++ b/packages/aws-cdk/lib/cli/activity-printer/base.ts @@ -1,7 +1,7 @@ -import { CloudFormationStackArtifact } from '@aws-cdk/cx-api'; +import type { CloudFormationStackArtifact } from '@aws-cdk/cx-api'; import { type StackActivity, type StackProgress } from '@aws-cdk/tmp-toolkit-helpers'; import { IO } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; -import { IoMessage } from '../../toolkit/cli-io-host'; +import type { IoMessage } from '../../toolkit/cli-io-host'; import { maxResourceTypeLength, stackEventHasErrorMessage } from '../../util'; export interface IActivityPrinter { diff --git a/packages/aws-cdk/lib/cli/activity-printer/current.ts b/packages/aws-cdk/lib/cli/activity-printer/current.ts index a2c473dfc..b2f1e38e4 100644 --- a/packages/aws-cdk/lib/cli/activity-printer/current.ts +++ b/packages/aws-cdk/lib/cli/activity-printer/current.ts @@ -1,7 +1,8 @@ import * as util from 'util'; import type { StackActivity } from '@aws-cdk/tmp-toolkit-helpers'; import * as chalk from 'chalk'; -import { ActivityPrinterBase, ActivityPrinterProps } from './base'; +import type { ActivityPrinterProps } from './base'; +import { ActivityPrinterBase } from './base'; import { RewritableBlock } from './display'; import { padLeft, padRight, stackEventHasErrorMessage } from '../../util'; diff --git a/packages/aws-cdk/lib/cli/activity-printer/history.ts b/packages/aws-cdk/lib/cli/activity-printer/history.ts index 82b7651c5..4a082d7ce 100644 --- a/packages/aws-cdk/lib/cli/activity-printer/history.ts +++ b/packages/aws-cdk/lib/cli/activity-printer/history.ts @@ -1,7 +1,8 @@ import * as util from 'util'; import type { StackActivity } from '@aws-cdk/tmp-toolkit-helpers'; import * as chalk from 'chalk'; -import { ActivityPrinterBase, ActivityPrinterProps } from './base'; +import type { ActivityPrinterProps } from './base'; +import { ActivityPrinterBase } from './base'; import { padRight } from '../../util'; /** diff --git a/packages/aws-cdk/lib/cli/cdk-toolkit.ts b/packages/aws-cdk/lib/cli/cdk-toolkit.ts index 01163f207..b31baf547 100644 --- a/packages/aws-cdk/lib/cli/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cli/cdk-toolkit.ts @@ -6,30 +6,39 @@ import * as chokidar from 'chokidar'; import * as fs from 'fs-extra'; import * as promptly from 'promptly'; import * as uuid from 'uuid'; -import { Configuration, PROJECT_CONFIG } from './user-configuration'; +import type { Configuration } from './user-configuration'; +import { PROJECT_CONFIG } from './user-configuration'; import { asIoHelper } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { DEFAULT_TOOLKIT_STACK_NAME } from '../api'; -import { SdkProvider } from '../api/aws-auth'; -import { Bootstrapper, BootstrapEnvironmentOptions } from '../api/bootstrap'; -import { +import type { SdkProvider } from '../api/aws-auth'; +import type { BootstrapEnvironmentOptions } from '../api/bootstrap'; +import { Bootstrapper } from '../api/bootstrap'; +import type { CloudAssembly, + StackSelector, +} from '../api/cxapp/cloud-assembly'; +import { DefaultSelection, ExtendedStackSelection, StackCollection, - StackSelector, } from '../api/cxapp/cloud-assembly'; -import { CloudExecutable } from '../api/cxapp/cloud-executable'; +import type { CloudExecutable } from '../api/cxapp/cloud-executable'; import { environmentsFromDescriptors, globEnvironmentsFromStacks, looksLikeGlob } from '../api/cxapp/environments'; -import { type Deployments, DeploymentMethod, SuccessfulDeployStackResult, createDiffChangeSet } from '../api/deployments'; +import type { DeploymentMethod, SuccessfulDeployStackResult, Deployments } from '../api/deployments'; +import { createDiffChangeSet } from '../api/deployments'; import { GarbageCollector } from '../api/garbage-collection/garbage-collector'; import { HotswapMode, HotswapPropertyOverrides, EcsHotswapProperties } from '../api/hotswap/common'; import { findCloudWatchLogGroups } from '../api/logs/find-cloudwatch-logs'; import { CloudWatchLogEventMonitor } from '../api/logs/logs-monitor'; import { ResourceImporter, removeNonImportResources, ResourceMigrator } from '../api/resource-import'; import { tagsForStack, type Tag } from '../api/tags'; -import { type AssetBuildNode, type AssetPublishNode, type Concurrency, type StackNode, type WorkGraph } from '../api/work-graph'; +import type { AssetBuildNode, AssetPublishNode, Concurrency, StackNode, WorkGraph } from '../api/work-graph'; import { WorkGraphBuilder } from '../api/work-graph/work-graph-builder'; import { StackActivityProgress } from '../commands/deploy'; +import type { + FromScan, + GenerateTemplateOutput, +} from '../commands/migrate'; import { generateCdkApp, generateStack, @@ -38,9 +47,7 @@ import { setEnvironment, parseSourceOptions, generateTemplate, - FromScan, TemplateSourceOptions, - GenerateTemplateOutput, CfnTemplateGeneratorProvider, writeMigrateJsonFile, buildGenertedTemplateOutput, @@ -56,7 +63,7 @@ import { ToolkitError } from '../toolkit/error'; import { numberFromBool, partition, validateSnsTopicArn, formatErrorMessage, deserializeStructure, obscureTemplate, serializeStructure, formatTime } from '../util'; // Must use a require() otherwise esbuild complains about calling a namespace -// eslint-disable-next-line @typescript-eslint/no-require-imports +// eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/consistent-type-imports const pLimit: typeof import('p-limit') = require('p-limit'); let TESTING = false; diff --git a/packages/aws-cdk/lib/cli/cli.ts b/packages/aws-cdk/lib/cli/cli.ts index cbad4687f..dcbb6671f 100644 --- a/packages/aws-cdk/lib/cli/cli.ts +++ b/packages/aws-cdk/lib/cli/cli.ts @@ -9,16 +9,19 @@ import { asIoHelper } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/pri import { SdkProvider } from '../api/aws-auth'; import { SdkToCliLogger } from '../api/aws-auth/sdk-logger'; import { setSdkTracing } from '../api/aws-auth/tracing'; -import { BootstrapSource, Bootstrapper } from '../api/bootstrap'; -import { StackSelector } from '../api/cxapp/cloud-assembly'; -import { CloudExecutable, Synthesizer } from '../api/cxapp/cloud-executable'; +import type { BootstrapSource } from '../api/bootstrap'; +import { Bootstrapper } from '../api/bootstrap'; +import type { StackSelector } from '../api/cxapp/cloud-assembly'; +import type { Synthesizer } from '../api/cxapp/cloud-executable'; +import { CloudExecutable } from '../api/cxapp/cloud-executable'; import { execProgram } from '../api/cxapp/exec'; -import { Deployments, DeploymentMethod } from '../api/deployments'; +import type { DeploymentMethod } from '../api/deployments'; +import { Deployments } from '../api/deployments'; import { HotswapMode } from '../api/hotswap/common'; import { PluginHost } from '../api/plugin'; -import { Settings } from '../api/settings'; +import type { Settings } from '../api/settings'; import { ToolkitInfo } from '../api/toolkit-info'; -import { ILock } from '../api/util/rwlock'; +import type { ILock } from '../api/util/rwlock'; import { contextHandler as context } from '../commands/context'; import { docs } from '../commands/docs'; import { doctor } from '../commands/doctor'; @@ -26,8 +29,10 @@ import { getMigrateScanType } from '../commands/migrate'; import { cliInit, printAvailableTemplates } from '../init'; import { result, debug, error, info } from '../logging'; import { Notices } from '../notices'; -import { Command, Configuration } from './user-configuration'; -import { IoMessageLevel, CliIoHost } from '../toolkit/cli-io-host'; +import type { Command } from './user-configuration'; +import { Configuration } from './user-configuration'; +import type { IoMessageLevel } from '../toolkit/cli-io-host'; +import { CliIoHost } from '../toolkit/cli-io-host'; import { ToolkitError } from '../toolkit/error'; /* eslint-disable max-len */ diff --git a/packages/aws-cdk/lib/cli/convert-to-user-input.ts b/packages/aws-cdk/lib/cli/convert-to-user-input.ts index 23d711f44..4ba7e0d6a 100644 --- a/packages/aws-cdk/lib/cli/convert-to-user-input.ts +++ b/packages/aws-cdk/lib/cli/convert-to-user-input.ts @@ -2,7 +2,7 @@ // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- -/* eslint-disable @stylistic/max-len */ +/* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ import { Command } from './user-configuration'; import { UserInput, GlobalOptions } from './user-input'; diff --git a/packages/aws-cdk/lib/cli/messages.ts b/packages/aws-cdk/lib/cli/messages.ts index 76c4d8c0d..933747edb 100644 --- a/packages/aws-cdk/lib/cli/messages.ts +++ b/packages/aws-cdk/lib/cli/messages.ts @@ -2,7 +2,7 @@ // The CLI cannot depend on the toolkit yet, because the toolkit currently depends on the CLI. // Once we have complete the repo split, we will create a temporary, private library package // for all code that is shared between CLI and toolkit. This is where this file will then live. -import { ActionLessMessage } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import type { ActionLessMessage } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import type { IoMessageCodeCategory } from '../logging'; import type { IoMessageCode, IoMessageLevel } from '../toolkit/cli-io-host'; diff --git a/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts index b166decae..e3b155b62 100644 --- a/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts +++ b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts @@ -2,7 +2,7 @@ // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- -/* eslint-disable @stylistic/max-len */ +/* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ import { Argv } from 'yargs'; import * as helpers from './util/yargs-helpers'; diff --git a/packages/aws-cdk/lib/cli/user-configuration.ts b/packages/aws-cdk/lib/cli/user-configuration.ts index b4e40c94a..bbc2d7d84 100644 --- a/packages/aws-cdk/lib/cli/user-configuration.ts +++ b/packages/aws-cdk/lib/cli/user-configuration.ts @@ -1,6 +1,6 @@ import { Context, PROJECT_CONTEXT } from '../api/context'; import { Settings } from '../api/settings'; -import { Tag } from '../api/tags'; +import type { Tag } from '../api/tags'; import { debug, warning } from '../logging'; import { ToolkitError } from '../toolkit/error'; diff --git a/packages/aws-cdk/lib/cli/user-input.ts b/packages/aws-cdk/lib/cli/user-input.ts index 5d292a9b8..3083eb626 100644 --- a/packages/aws-cdk/lib/cli/user-input.ts +++ b/packages/aws-cdk/lib/cli/user-input.ts @@ -2,7 +2,7 @@ // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- -/* eslint-disable @stylistic/max-len */ +/* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ import { Command } from './user-configuration'; /** diff --git a/packages/aws-cdk/lib/commands/context.ts b/packages/aws-cdk/lib/commands/context.ts index 9b7f7f4fd..f960ec0d8 100644 --- a/packages/aws-cdk/lib/commands/context.ts +++ b/packages/aws-cdk/lib/commands/context.ts @@ -1,6 +1,6 @@ import * as chalk from 'chalk'; import { minimatch } from 'minimatch'; -import { Context } from '../api/context'; +import type { Context } from '../api/context'; import { renderTable } from '../cli/tables'; import { PROJECT_CONFIG, PROJECT_CONTEXT, USER_DEFAULTS } from '../cli/user-configuration'; import * as version from '../cli/version'; diff --git a/packages/aws-cdk/lib/commands/migrate.ts b/packages/aws-cdk/lib/commands/migrate.ts index 49721ed5c..7c26cbf0e 100644 --- a/packages/aws-cdk/lib/commands/migrate.ts +++ b/packages/aws-cdk/lib/commands/migrate.ts @@ -3,7 +3,8 @@ import * as fs from 'fs'; import * as path from 'path'; import type { ForReading } from '@aws-cdk/cli-plugin-contract'; -import { Environment, UNKNOWN_ACCOUNT, UNKNOWN_REGION } from '@aws-cdk/cx-api'; +import type { Environment } from '@aws-cdk/cx-api'; +import { UNKNOWN_ACCOUNT, UNKNOWN_REGION } from '@aws-cdk/cx-api'; import type { DescribeGeneratedTemplateCommandOutput, DescribeResourceScanCommandOutput, diff --git a/packages/aws-cdk/lib/context-providers/ami.ts b/packages/aws-cdk/lib/context-providers/ami.ts index 162a7d4b3..af4986602 100644 --- a/packages/aws-cdk/lib/context-providers/ami.ts +++ b/packages/aws-cdk/lib/context-providers/ami.ts @@ -1,6 +1,6 @@ import type { AmiContextQuery } from '@aws-cdk/cloud-assembly-schema'; import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; -import { ContextProviderPlugin } from '../api/plugin'; +import type { ContextProviderPlugin } from '../api/plugin'; import { debug, info } from '../logging'; import { ContextProviderError } from '../toolkit/error'; diff --git a/packages/aws-cdk/lib/context-providers/availability-zones.ts b/packages/aws-cdk/lib/context-providers/availability-zones.ts index 1f4f5e2e1..7b2d4cc72 100644 --- a/packages/aws-cdk/lib/context-providers/availability-zones.ts +++ b/packages/aws-cdk/lib/context-providers/availability-zones.ts @@ -1,7 +1,7 @@ import type { AvailabilityZonesContextQuery } from '@aws-cdk/cloud-assembly-schema'; import type { AvailabilityZone } from '@aws-sdk/client-ec2'; import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; -import { ContextProviderPlugin } from '../api/plugin'; +import type { ContextProviderPlugin } from '../api/plugin'; import { debug } from '../logging'; /** diff --git a/packages/aws-cdk/lib/context-providers/cc-api-provider.ts b/packages/aws-cdk/lib/context-providers/cc-api-provider.ts index 607baaee9..c02532fd6 100644 --- a/packages/aws-cdk/lib/context-providers/cc-api-provider.ts +++ b/packages/aws-cdk/lib/context-providers/cc-api-provider.ts @@ -1,7 +1,7 @@ import type { CcApiContextQuery } from '@aws-cdk/cloud-assembly-schema'; -import { ICloudControlClient } from '../api'; +import type { ICloudControlClient } from '../api'; import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; -import { ContextProviderPlugin } from '../api/plugin'; +import type { ContextProviderPlugin } from '../api/plugin'; import { ContextProviderError } from '../toolkit/error'; import { findJsonValue, getResultObj } from '../util'; diff --git a/packages/aws-cdk/lib/context-providers/endpoint-service-availability-zones.ts b/packages/aws-cdk/lib/context-providers/endpoint-service-availability-zones.ts index 448770559..6e0320dee 100644 --- a/packages/aws-cdk/lib/context-providers/endpoint-service-availability-zones.ts +++ b/packages/aws-cdk/lib/context-providers/endpoint-service-availability-zones.ts @@ -1,6 +1,6 @@ import type { EndpointServiceAvailabilityZonesContextQuery } from '@aws-cdk/cloud-assembly-schema'; import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; -import { ContextProviderPlugin } from '../api/plugin'; +import type { ContextProviderPlugin } from '../api/plugin'; import { debug } from '../logging'; /** diff --git a/packages/aws-cdk/lib/context-providers/hosted-zones.ts b/packages/aws-cdk/lib/context-providers/hosted-zones.ts index fdbaf7220..9c24ac664 100644 --- a/packages/aws-cdk/lib/context-providers/hosted-zones.ts +++ b/packages/aws-cdk/lib/context-providers/hosted-zones.ts @@ -1,8 +1,8 @@ -import { HostedZoneContextQuery } from '@aws-cdk/cloud-assembly-schema'; +import type { HostedZoneContextQuery } from '@aws-cdk/cloud-assembly-schema'; import type { HostedZone } from '@aws-sdk/client-route-53'; import type { IRoute53Client } from '../api'; import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; -import { ContextProviderPlugin } from '../api/plugin'; +import type { ContextProviderPlugin } from '../api/plugin'; import { debug } from '../logging'; import { ContextProviderError } from '../toolkit/error'; diff --git a/packages/aws-cdk/lib/context-providers/index.ts b/packages/aws-cdk/lib/context-providers/index.ts index 04d8babaa..51221209a 100644 --- a/packages/aws-cdk/lib/context-providers/index.ts +++ b/packages/aws-cdk/lib/context-providers/index.ts @@ -10,10 +10,11 @@ import { LoadBalancerContextProviderPlugin, LoadBalancerListenerContextProviderP import { SecurityGroupContextProviderPlugin } from './security-groups'; import { SSMContextProviderPlugin } from './ssm-parameters'; import { VpcNetworkContextProviderPlugin } from './vpcs'; -import { SdkProvider } from '../api'; -import { Context, TRANSIENT_CONTEXT_KEY } from '../api/context'; +import type { SdkProvider } from '../api'; +import type { Context } from '../api/context'; +import { TRANSIENT_CONTEXT_KEY } from '../api/context'; import { PluginHost } from '../api/plugin'; -import { ContextProviderPlugin } from '../api/plugin/context-provider-plugin'; +import type { ContextProviderPlugin } from '../api/plugin/context-provider-plugin'; import { replaceEnvPlaceholders } from '../api/util/placeholders'; import { debug } from '../logging'; import { ContextProviderError } from '../toolkit/error'; diff --git a/packages/aws-cdk/lib/context-providers/keys.ts b/packages/aws-cdk/lib/context-providers/keys.ts index a6decc74f..152d79a7d 100644 --- a/packages/aws-cdk/lib/context-providers/keys.ts +++ b/packages/aws-cdk/lib/context-providers/keys.ts @@ -3,7 +3,7 @@ import type { KeyContextResponse } from '@aws-cdk/cx-api'; import type { AliasListEntry, ListAliasesCommandOutput } from '@aws-sdk/client-kms'; import type { IKMSClient } from '../api'; import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; -import { ContextProviderPlugin } from '../api/plugin'; +import type { ContextProviderPlugin } from '../api/plugin'; import { debug } from '../logging'; import { ContextProviderError } from '../toolkit/error'; diff --git a/packages/aws-cdk/lib/context-providers/load-balancers.ts b/packages/aws-cdk/lib/context-providers/load-balancers.ts index 04499b63b..dcb2a9ded 100644 --- a/packages/aws-cdk/lib/context-providers/load-balancers.ts +++ b/packages/aws-cdk/lib/context-providers/load-balancers.ts @@ -1,13 +1,15 @@ -import { LoadBalancerContextQuery, LoadBalancerListenerContextQuery } from '@aws-cdk/cloud-assembly-schema'; -import { +import type { LoadBalancerContextQuery, LoadBalancerListenerContextQuery } from '@aws-cdk/cloud-assembly-schema'; +import type { LoadBalancerContextResponse, - LoadBalancerIpAddressType, LoadBalancerListenerContextResponse, } from '@aws-cdk/cx-api'; -import { type Listener, LoadBalancer, type TagDescription } from '@aws-sdk/client-elastic-load-balancing-v2'; +import { + LoadBalancerIpAddressType, +} from '@aws-cdk/cx-api'; +import type { LoadBalancer, Listener, TagDescription } from '@aws-sdk/client-elastic-load-balancing-v2'; import type { IElasticLoadBalancingV2Client } from '../api'; import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; -import { ContextProviderPlugin } from '../api/plugin'; +import type { ContextProviderPlugin } from '../api/plugin'; import { ContextProviderError } from '../toolkit/error'; /** diff --git a/packages/aws-cdk/lib/context-providers/ssm-parameters.ts b/packages/aws-cdk/lib/context-providers/ssm-parameters.ts index f7ac0a204..7571c085d 100644 --- a/packages/aws-cdk/lib/context-providers/ssm-parameters.ts +++ b/packages/aws-cdk/lib/context-providers/ssm-parameters.ts @@ -1,7 +1,7 @@ import type { SSMParameterContextQuery } from '@aws-cdk/cloud-assembly-schema'; import type { GetParameterCommandOutput } from '@aws-sdk/client-ssm'; import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; -import { ContextProviderPlugin } from '../api/plugin'; +import type { ContextProviderPlugin } from '../api/plugin'; import { debug } from '../logging'; import { ContextProviderError } from '../toolkit/error'; diff --git a/packages/aws-cdk/lib/context-providers/vpcs.ts b/packages/aws-cdk/lib/context-providers/vpcs.ts index 4f434f782..d3cb5f785 100644 --- a/packages/aws-cdk/lib/context-providers/vpcs.ts +++ b/packages/aws-cdk/lib/context-providers/vpcs.ts @@ -3,7 +3,7 @@ import { type VpcContextResponse, type VpcSubnetGroup, VpcSubnetGroupType } from import type { Filter, RouteTable, Tag, Vpc } from '@aws-sdk/client-ec2'; import type { IEC2Client } from '../api'; import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; -import { ContextProviderPlugin } from '../api/plugin'; +import type { ContextProviderPlugin } from '../api/plugin'; import { debug } from '../logging'; import { ContextProviderError } from '../toolkit/error'; export class VpcNetworkContextProviderPlugin implements ContextProviderPlugin { diff --git a/packages/aws-cdk/lib/diff.ts b/packages/aws-cdk/lib/diff.ts index 3e8c7b192..74a2cd041 100644 --- a/packages/aws-cdk/lib/diff.ts +++ b/packages/aws-cdk/lib/diff.ts @@ -9,7 +9,7 @@ import { fullDiff, mangleLikeCloudFormation, } from '@aws-cdk/cloudformation-diff'; -import * as cxapi from '@aws-cdk/cx-api'; +import type * as cxapi from '@aws-cdk/cx-api'; import * as chalk from 'chalk'; import { type NestedStackTemplates } from './api/deployments'; import { info, warning } from './logging'; diff --git a/packages/aws-cdk/lib/legacy-logging-source.ts b/packages/aws-cdk/lib/legacy-logging-source.ts index b83623ed9..0c7fa5bd9 100644 --- a/packages/aws-cdk/lib/legacy-logging-source.ts +++ b/packages/aws-cdk/lib/legacy-logging-source.ts @@ -5,7 +5,7 @@ // we keep a copy of the original version around. // See https://github.com/aws/aws-cdk/pull/33021 for more information. -import { Writable } from 'stream'; +import type { Writable } from 'stream'; import * as util from 'util'; import * as chalk from 'chalk'; diff --git a/packages/aws-cdk/lib/list-stacks.ts b/packages/aws-cdk/lib/list-stacks.ts index dbe846a6a..0f0ef774e 100644 --- a/packages/aws-cdk/lib/list-stacks.ts +++ b/packages/aws-cdk/lib/list-stacks.ts @@ -1,6 +1,6 @@ import type { StackDetails } from '@aws-cdk/tmp-toolkit-helpers'; import { DefaultSelection, ExtendedStackSelection } from './api/cxapp/cloud-assembly'; -import { CdkToolkit } from './cli/cdk-toolkit'; +import type { CdkToolkit } from './cli/cdk-toolkit'; /** * Options for List Stacks diff --git a/packages/aws-cdk/lib/logging.ts b/packages/aws-cdk/lib/logging.ts index 03ea3fd3d..8d9a1b256 100644 --- a/packages/aws-cdk/lib/logging.ts +++ b/packages/aws-cdk/lib/logging.ts @@ -1,6 +1,7 @@ import * as util from 'util'; import * as chalk from 'chalk'; -import { IoMessageLevel, IoMessage, CliIoHost, IoMessageCode } from './toolkit/cli-io-host'; +import type { IoMessageLevel, IoMessage, IoMessageCode } from './toolkit/cli-io-host'; +import { CliIoHost } from './toolkit/cli-io-host'; export type IoMessageCodeCategory = 'TOOLKIT' | 'SDK' | 'ASSETS'; export type IoCodeLevel = 'E' | 'W' | 'I'; diff --git a/packages/aws-cdk/lib/notices.ts b/packages/aws-cdk/lib/notices.ts index 93175fbb0..e66f2ede2 100644 --- a/packages/aws-cdk/lib/notices.ts +++ b/packages/aws-cdk/lib/notices.ts @@ -1,17 +1,18 @@ -import { ClientRequest } from 'http'; -import { RequestOptions } from 'https'; +import type { ClientRequest } from 'http'; +import type { RequestOptions } from 'https'; import * as https from 'node:https'; import * as path from 'path'; import type { Environment } from '@aws-cdk/cx-api'; import * as fs from 'fs-extra'; import * as semver from 'semver'; -import { SdkHttpOptions } from './api'; +import type { SdkHttpOptions } from './api'; import { AwsCliCompatible } from './api/aws-auth/awscli-compatible'; import type { Context } from './api/context'; import { versionNumber } from './cli/version'; import { debug, info, warning, error } from './logging'; import { ToolkitError } from './toolkit/error'; -import { ConstructTreeNode, loadTreeFromDir } from './tree'; +import type { ConstructTreeNode } from './tree'; +import { loadTreeFromDir } from './tree'; import { cdkCacheDir, formatErrorMessage } from './util'; const CACHE_FILE_PATH = path.join(cdkCacheDir(), 'notices.json'); diff --git a/packages/aws-cdk/lib/tree.ts b/packages/aws-cdk/lib/tree.ts index 5368e9a16..51601bcf2 100644 --- a/packages/aws-cdk/lib/tree.ts +++ b/packages/aws-cdk/lib/tree.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import { CloudAssembly } from '@aws-cdk/cx-api'; +import type { CloudAssembly } from '@aws-cdk/cx-api'; import * as fs from 'fs-extra'; import { trace } from './logging'; diff --git a/packages/cdk-assets/.eslintrc.json b/packages/cdk-assets/.eslintrc.json index 3754aaa5f..2e73e77e7 100644 --- a/packages/cdk-assets/.eslintrc.json +++ b/packages/cdk-assets/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/packages/cdk-assets/lib/asset-manifest.ts b/packages/cdk-assets/lib/asset-manifest.ts index 141f296f1..c2e388f2c 100644 --- a/packages/cdk-assets/lib/asset-manifest.ts +++ b/packages/cdk-assets/lib/asset-manifest.ts @@ -1,11 +1,13 @@ import * as fs from 'fs'; import * as path from 'path'; -import { +import type { AssetManifest as AssetManifestSchema, DockerImageDestination, DockerImageSource, FileDestination, FileSource, +} from '@aws-cdk/cloud-assembly-schema'; +import { Manifest, } from '@aws-cdk/cloud-assembly-schema'; diff --git a/packages/cdk-assets/lib/aws-types.ts b/packages/cdk-assets/lib/aws-types.ts index ed6e60669..ab6f68e25 100644 --- a/packages/cdk-assets/lib/aws-types.ts +++ b/packages/cdk-assets/lib/aws-types.ts @@ -5,7 +5,7 @@ * migration to an SDK v4. */ -import { Readable } from 'stream'; +import type { Readable } from 'stream'; export interface ResponseMetadata { /** diff --git a/packages/cdk-assets/lib/aws.ts b/packages/cdk-assets/lib/aws.ts index eb702196f..b1660d683 100644 --- a/packages/cdk-assets/lib/aws.ts +++ b/packages/cdk-assets/lib/aws.ts @@ -12,11 +12,13 @@ import { S3Client, } from '@aws-sdk/client-s3'; import { GetSecretValueCommand, SecretsManagerClient } from '@aws-sdk/client-secrets-manager'; -import { +import type { AssumeRoleCommandInput, + STSClientConfig, +} from '@aws-sdk/client-sts'; +import { GetCallerIdentityCommand, STSClient, - STSClientConfig, } from '@aws-sdk/client-sts'; import { fromNodeProviderChain, fromTemporaryCredentials } from '@aws-sdk/credential-providers'; import { Upload } from '@aws-sdk/lib-storage'; @@ -25,7 +27,7 @@ import { NODE_REGION_CONFIG_OPTIONS, } from '@smithy/config-resolver'; import { loadConfig } from '@smithy/node-config-provider'; -import { +import type { AwsCredentialIdentityProvider, CompleteMultipartUploadCommandOutput, DescribeImagesCommandInput, diff --git a/packages/cdk-assets/lib/private/asset-handler.ts b/packages/cdk-assets/lib/private/asset-handler.ts index a33faa5ea..75d25ad69 100644 --- a/packages/cdk-assets/lib/private/asset-handler.ts +++ b/packages/cdk-assets/lib/private/asset-handler.ts @@ -1,6 +1,6 @@ -import { DockerFactory } from './docker'; -import { IAws } from '../aws'; -import { EventEmitter } from '../progress'; +import type { DockerFactory } from './docker'; +import type { IAws } from '../aws'; +import type { EventEmitter } from '../progress'; /** * Options for publishing an asset. diff --git a/packages/cdk-assets/lib/private/docker-credentials.ts b/packages/cdk-assets/lib/private/docker-credentials.ts index bca4383f5..e146744cf 100644 --- a/packages/cdk-assets/lib/private/docker-credentials.ts +++ b/packages/cdk-assets/lib/private/docker-credentials.ts @@ -1,8 +1,9 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; -import { IAws, IECRClient } from '../aws'; -import { EventEmitter, EventType } from '../progress'; +import type { IAws, IECRClient } from '../aws'; +import type { EventEmitter } from '../progress'; +import { EventType } from '../progress'; export interface DockerCredentials { readonly Username: string; diff --git a/packages/cdk-assets/lib/private/docker.ts b/packages/cdk-assets/lib/private/docker.ts index dd4d72428..9e51111a2 100644 --- a/packages/cdk-assets/lib/private/docker.ts +++ b/packages/cdk-assets/lib/private/docker.ts @@ -2,11 +2,13 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import { cdkCredentialsConfig, obtainEcrCredentials } from './docker-credentials'; -import { shell, ShellOptions, ProcessFailedError } from './shell'; +import type { ShellOptions, ProcessFailedError } from './shell'; +import { shell } from './shell'; import { createCriticalSection } from './util'; -import { IECRClient } from '../aws'; -import { SubprocessOutputDestination } from './asset-handler'; -import { EventEmitter, shellEventPublisherFromEventEmitter } from '../progress'; +import type { IECRClient } from '../aws'; +import type { SubprocessOutputDestination } from './asset-handler'; +import type { EventEmitter } from '../progress'; +import { shellEventPublisherFromEventEmitter } from '../progress'; interface BuildOptions { readonly directory: string; diff --git a/packages/cdk-assets/lib/private/handlers/container-images.ts b/packages/cdk-assets/lib/private/handlers/container-images.ts index f50640066..402694ede 100644 --- a/packages/cdk-assets/lib/private/handlers/container-images.ts +++ b/packages/cdk-assets/lib/private/handlers/container-images.ts @@ -1,11 +1,11 @@ import * as path from 'path'; -import { DockerImageDestination } from '@aws-cdk/cloud-assembly-schema'; +import type { DockerImageDestination } from '@aws-cdk/cloud-assembly-schema'; import { destinationToClientOptions } from './client-options'; -import { DockerImageManifestEntry } from '../../asset-manifest'; +import type { DockerImageManifestEntry } from '../../asset-manifest'; import type { IECRClient } from '../../aws'; import { EventType, shellEventPublisherFromEventEmitter } from '../../progress'; -import { IAssetHandler, IHandlerHost, IHandlerOptions } from '../asset-handler'; -import { Docker } from '../docker'; +import type { IAssetHandler, IHandlerHost, IHandlerOptions } from '../asset-handler'; +import type { Docker } from '../docker'; import { replaceAwsPlaceholders } from '../placeholders'; import { shell } from '../shell'; diff --git a/packages/cdk-assets/lib/private/handlers/files.ts b/packages/cdk-assets/lib/private/handlers/files.ts index cb6ca2985..9690ceaf6 100644 --- a/packages/cdk-assets/lib/private/handlers/files.ts +++ b/packages/cdk-assets/lib/private/handlers/files.ts @@ -1,14 +1,15 @@ import { createReadStream, promises as fs } from 'fs'; import * as path from 'path'; -import { FileAssetPackaging, FileSource } from '@aws-cdk/cloud-assembly-schema'; +import type { FileSource } from '@aws-cdk/cloud-assembly-schema'; +import { FileAssetPackaging } from '@aws-cdk/cloud-assembly-schema'; import * as mime from 'mime'; import { destinationToClientOptions } from './client-options'; -import { FileManifestEntry } from '../../asset-manifest'; -import { IS3Client } from '../../aws'; -import { PutObjectCommandInput } from '../../aws-types'; +import type { FileManifestEntry } from '../../asset-manifest'; +import type { IS3Client } from '../../aws'; +import type { PutObjectCommandInput } from '../../aws-types'; import { EventType, shellEventPublisherFromEventEmitter } from '../../progress'; import { zipDirectory } from '../archive'; -import { IAssetHandler, IHandlerHost, type PublishOptions } from '../asset-handler'; +import type { IAssetHandler, IHandlerHost, PublishOptions } from '../asset-handler'; import { pathExists } from '../fs-extra'; import { replaceAwsPlaceholders } from '../placeholders'; import { shell } from '../shell'; diff --git a/packages/cdk-assets/lib/private/placeholders.ts b/packages/cdk-assets/lib/private/placeholders.ts index e025ea1d6..2af7c09af 100644 --- a/packages/cdk-assets/lib/private/placeholders.ts +++ b/packages/cdk-assets/lib/private/placeholders.ts @@ -1,5 +1,5 @@ import { EnvironmentPlaceholders } from '@aws-cdk/cx-api'; -import { IAws } from '../aws'; +import type { IAws } from '../aws'; /** * Replace the {ACCOUNT} and {REGION} placeholders in all strings found in a complex object. diff --git a/packages/cdk-assets/lib/private/shell.ts b/packages/cdk-assets/lib/private/shell.ts index 2201b83ef..5effc5e10 100644 --- a/packages/cdk-assets/lib/private/shell.ts +++ b/packages/cdk-assets/lib/private/shell.ts @@ -1,5 +1,5 @@ import * as child_process from 'child_process'; -import { SubprocessOutputDestination } from './asset-handler'; +import type { SubprocessOutputDestination } from './asset-handler'; export type ShellEventType = 'open' | 'data_stdout' | 'data_stderr' | 'close'; diff --git a/packages/cdk-assets/lib/progress.ts b/packages/cdk-assets/lib/progress.ts index 603c778b0..2ca2b0c8a 100644 --- a/packages/cdk-assets/lib/progress.ts +++ b/packages/cdk-assets/lib/progress.ts @@ -1,5 +1,5 @@ -import { IManifestEntry } from './asset-manifest'; -import { ShellEventType } from './private/shell'; +import type { IManifestEntry } from './asset-manifest'; +import type { ShellEventType } from './private/shell'; /** * A listener for progress events from the publisher diff --git a/packages/cdk-assets/lib/publishing.ts b/packages/cdk-assets/lib/publishing.ts index 0f4fda5e5..e1600eb0d 100644 --- a/packages/cdk-assets/lib/publishing.ts +++ b/packages/cdk-assets/lib/publishing.ts @@ -1,15 +1,16 @@ -import { AssetManifest, IManifestEntry } from './asset-manifest'; -import { IAws } from './aws'; -import { +import type { AssetManifest, IManifestEntry } from './asset-manifest'; +import type { IAws } from './aws'; +import type { IAssetHandler, IHandlerHost, - type PublishOptions, SubprocessOutputDestination, + PublishOptions, } from './private/asset-handler'; import { DockerFactory } from './private/docker'; import { makeAssetHandler } from './private/handlers'; import { pLimit } from './private/p-limit'; -import { EventType, IPublishProgress, IPublishProgressListener } from './progress'; +import type { IPublishProgress, IPublishProgressListener } from './progress'; +import { EventType } from './progress'; export interface AssetPublishingOptions { /** diff --git a/packages/cdk-assets/test/assetpublishing.test.ts b/packages/cdk-assets/test/assetpublishing.test.ts index 89e9cde70..05d28f264 100644 --- a/packages/cdk-assets/test/assetpublishing.test.ts +++ b/packages/cdk-assets/test/assetpublishing.test.ts @@ -2,7 +2,8 @@ import { Manifest } from '@aws-cdk/cloud-assembly-schema'; import { GetBucketLocationCommand, ListObjectsV2Command } from '@aws-sdk/client-s3'; import { MockAws, mockS3 } from './mock-aws'; import mockfs from './mock-fs'; -import { AssetManifest, AssetPublishing, IAws } from '../lib'; +import type { IAws } from '../lib'; +import { AssetManifest, AssetPublishing } from '../lib'; import { MockProgressListener } from './mock-progress-listener'; import { EventType } from '../lib/progress'; diff --git a/packages/cdk-assets/test/docker-images.test.ts b/packages/cdk-assets/test/docker-images.test.ts index eaf8c39c9..921bc31c8 100644 --- a/packages/cdk-assets/test/docker-images.test.ts +++ b/packages/cdk-assets/test/docker-images.test.ts @@ -4,16 +4,17 @@ import 'aws-sdk-client-mock-jest'; import * as fs from 'fs'; import { Manifest } from '@aws-cdk/cloud-assembly-schema'; +import type { GetAuthorizationTokenResponse } from '@aws-sdk/client-ecr'; import { DescribeImagesCommand, DescribeRepositoriesCommand, GetAuthorizationTokenCommand, - GetAuthorizationTokenResponse, } from '@aws-sdk/client-ecr'; import { MockAws, mockEcr, resetDefaultAwsMockBehavior } from './mock-aws'; import { mockSpawn } from './mock-child_process'; import mockfs from './mock-fs'; -import { AssetManifest, AssetPublishing, IAws } from '../lib'; +import type { IAws } from '../lib'; +import { AssetManifest, AssetPublishing } from '../lib'; import * as dockercreds from '../lib/private/docker-credentials'; let aws: IAws; diff --git a/packages/cdk-assets/test/fake-listener.ts b/packages/cdk-assets/test/fake-listener.ts index d5f4b55c9..aa03a8488 100644 --- a/packages/cdk-assets/test/fake-listener.ts +++ b/packages/cdk-assets/test/fake-listener.ts @@ -1,4 +1,4 @@ -import { IPublishProgressListener, EventType, IPublishProgress } from '../lib/progress'; +import type { IPublishProgressListener, EventType, IPublishProgress } from '../lib/progress'; export class FakeListener implements IPublishProgressListener { public readonly types = new Array(); diff --git a/packages/cdk-assets/test/logging.test.ts b/packages/cdk-assets/test/logging.test.ts index a8b7b580e..d950b5180 100644 --- a/packages/cdk-assets/test/logging.test.ts +++ b/packages/cdk-assets/test/logging.test.ts @@ -5,7 +5,8 @@ import { Manifest } from '@aws-cdk/cloud-assembly-schema'; import { S3Client, ListObjectsV2Command } from '@aws-sdk/client-s3'; import { mockClient } from 'aws-sdk-client-mock'; import mockfs from './mock-fs'; -import { setLogThreshold, log, LogLevel } from '../bin/logging'; +import type { LogLevel } from '../bin/logging'; +import { setLogThreshold, log } from '../bin/logging'; describe('Logging System', () => { let consoleErrorSpy: jest.SpyInstance; diff --git a/packages/cdk-assets/test/mock-aws.ts b/packages/cdk-assets/test/mock-aws.ts index 30f5160da..40955889d 100644 --- a/packages/cdk-assets/test/mock-aws.ts +++ b/packages/cdk-assets/test/mock-aws.ts @@ -3,7 +3,8 @@ import { S3Client, UploadPartCommand, PutObjectCommand } from '@aws-sdk/client-s import { SecretsManagerClient } from '@aws-sdk/client-secrets-manager'; import { GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts'; import { mockClient } from 'aws-sdk-client-mock'; -import { Account, ClientOptions, DefaultAwsClient } from '../lib/aws'; +import type { Account, ClientOptions } from '../lib/aws'; +import { DefaultAwsClient } from '../lib/aws'; export const mockEcr = mockClient(ECRClient); export const mockS3 = mockClient(S3Client); diff --git a/packages/cdk-assets/test/mock-progress-listener.ts b/packages/cdk-assets/test/mock-progress-listener.ts index 2dd5cd3d0..496b0312e 100644 --- a/packages/cdk-assets/test/mock-progress-listener.ts +++ b/packages/cdk-assets/test/mock-progress-listener.ts @@ -1,5 +1,5 @@ -import { EventType } from '../lib'; -import { IPublishProgress, IPublishProgressListener } from '../lib/progress'; +import type { EventType } from '../lib'; +import type { IPublishProgress, IPublishProgressListener } from '../lib/progress'; /** * Represents a logged message with additional metadata purely for testing purposes. diff --git a/packages/cdk-assets/test/placeholders.test.ts b/packages/cdk-assets/test/placeholders.test.ts index 1d5f3cd53..34aa136aa 100644 --- a/packages/cdk-assets/test/placeholders.test.ts +++ b/packages/cdk-assets/test/placeholders.test.ts @@ -5,7 +5,8 @@ import { DescribeImagesCommand } from '@aws-sdk/client-ecr'; import { ListObjectsV2Command } from '@aws-sdk/client-s3'; import { MockAws, mockEcr, mockS3, resetDefaultAwsMockBehavior } from './mock-aws'; import mockfs from './mock-fs'; -import { AssetManifest, AssetPublishing, IAws } from '../lib'; +import type { IAws } from '../lib'; +import { AssetManifest, AssetPublishing } from '../lib'; let aws: IAws; beforeEach(() => { diff --git a/packages/cdk-assets/test/private/docker-credentials.test.ts b/packages/cdk-assets/test/private/docker-credentials.test.ts index cf236e8ae..2ef9f6af6 100644 --- a/packages/cdk-assets/test/private/docker-credentials.test.ts +++ b/packages/cdk-assets/test/private/docker-credentials.test.ts @@ -3,12 +3,12 @@ import * as os from 'os'; import * as path from 'path'; import { GetAuthorizationTokenCommand } from '@aws-sdk/client-ecr'; import { GetSecretValueCommand } from '@aws-sdk/client-secrets-manager'; -import { IAws } from '../../lib/aws'; +import type { IAws } from '../../lib/aws'; +import type { DockerCredentialsConfig } from '../../lib/private/docker-credentials'; import { _clearCdkCredentialsConfigCache, cdkCredentialsConfig, cdkCredentialsConfigFile, - DockerCredentialsConfig, fetchDockerLoginCredentials, } from '../../lib/private/docker-credentials'; import { MockAws, mockEcr, mockSecretsManager } from '../mock-aws'; diff --git a/packages/cdk-assets/test/private/docker.test.ts b/packages/cdk-assets/test/private/docker.test.ts index 5caaa2a84..291830754 100644 --- a/packages/cdk-assets/test/private/docker.test.ts +++ b/packages/cdk-assets/test/private/docker.test.ts @@ -1,5 +1,5 @@ import { Docker } from '../../lib/private/docker'; -import { ShellOptions, ProcessFailedError } from '../../lib/private/shell'; +import type { ShellOptions, ProcessFailedError } from '../../lib/private/shell'; type ShellExecuteMock = jest.SpyInstance< ReturnType, diff --git a/packages/cdk-assets/test/progress.test.ts b/packages/cdk-assets/test/progress.test.ts index 53d8ac36f..2ea677152 100644 --- a/packages/cdk-assets/test/progress.test.ts +++ b/packages/cdk-assets/test/progress.test.ts @@ -3,7 +3,8 @@ import { GetBucketLocationCommand, ListObjectsV2Command } from '@aws-sdk/client- import { FakeListener } from './fake-listener'; import { MockAws, mockS3 } from './mock-aws'; import mockfs from './mock-fs'; -import { AssetManifest, AssetPublishing, IAws } from '../lib'; +import type { IAws } from '../lib'; +import { AssetManifest, AssetPublishing } from '../lib'; let aws: IAws; beforeEach(() => { diff --git a/packages/cdk-assets/test/shell-logging.test.ts b/packages/cdk-assets/test/shell-logging.test.ts index 716fb6676..15547cb78 100644 --- a/packages/cdk-assets/test/shell-logging.test.ts +++ b/packages/cdk-assets/test/shell-logging.test.ts @@ -3,7 +3,8 @@ import mockfs from './mock-fs'; import { MockProgressListener } from './mock-progress-listener'; import { setLogThreshold } from '../bin/logging'; import { EventType, shellEventToEventType } from '../lib'; -import { shell, ShellEventPublisher } from '../lib/private/shell'; +import type { ShellEventPublisher } from '../lib/private/shell'; +import { shell } from '../lib/private/shell'; jest.mock('child_process'); diff --git a/packages/cdk-assets/test/zipping.test.ts b/packages/cdk-assets/test/zipping.test.ts index 8936f2a4a..d9ace8d55 100644 --- a/packages/cdk-assets/test/zipping.test.ts +++ b/packages/cdk-assets/test/zipping.test.ts @@ -3,7 +3,8 @@ import { Manifest } from '@aws-cdk/cloud-assembly-schema'; import { ListObjectsV2Command, PutObjectCommand } from '@aws-sdk/client-s3'; import { mockS3 } from './mock-aws'; import mockfs from './mock-fs'; -import { AssetManifest, AssetPublishing, DefaultAwsClient, IAws } from '../lib'; +import type { IAws } from '../lib'; +import { AssetManifest, AssetPublishing, DefaultAwsClient } from '../lib'; let aws: IAws; beforeEach(() => { diff --git a/packages/cdk/.eslintrc.json b/packages/cdk/.eslintrc.json index d45b6fa34..8d4b0afed 100644 --- a/packages/cdk/.eslintrc.json +++ b/packages/cdk/.eslintrc.json @@ -272,6 +272,7 @@ ] } ], + "@typescript-eslint/consistent-type-imports": "error", "semi": [ "error", "always" diff --git a/projenrc/adc-publishing.ts b/projenrc/adc-publishing.ts index aba5a4e4b..36df2173d 100644 --- a/projenrc/adc-publishing.ts +++ b/projenrc/adc-publishing.ts @@ -1,4 +1,4 @@ -import { Monorepo } from 'cdklabs-projen-project-types/lib/yarn'; +import type { Monorepo } from 'cdklabs-projen-project-types/lib/yarn'; import { Component, github } from 'projen'; import { JobPermission } from 'projen/lib/github/workflows-model'; diff --git a/projenrc/codecov.ts b/projenrc/codecov.ts index fea41a36e..1cdcc4289 100644 --- a/projenrc/codecov.ts +++ b/projenrc/codecov.ts @@ -1,6 +1,6 @@ import { Component, github } from 'projen'; import { JobPermission } from 'projen/lib/github/workflows-model'; -import { TypeScriptProject } from 'projen/lib/typescript'; +import type { TypeScriptProject } from 'projen/lib/typescript'; export interface CodeCovWorkflowProps { readonly restrictToRepos: string[]; diff --git a/projenrc/eslint.ts b/projenrc/eslint.ts index 406ea4147..2e23c65a3 100644 --- a/projenrc/eslint.ts +++ b/projenrc/eslint.ts @@ -65,6 +65,9 @@ export const ESLINT_RULES = { // we prefer `import/no-duplicate` over `no-duplicate-imports` since the former can handle type imports 'import/no-duplicates': 'error', + // Enforce consistent usage of type imports. This allows transpilers to drop imports without knowing the types of the dependencies.s + '@typescript-eslint/consistent-type-imports': 'error', + // Cannot shadow names 'no-shadow': ['off'], '@typescript-eslint/no-shadow': ['error'], diff --git a/projenrc/issue-labeler.ts b/projenrc/issue-labeler.ts index 46f01beb9..ac6a97ca6 100644 --- a/projenrc/issue-labeler.ts +++ b/projenrc/issue-labeler.ts @@ -1,6 +1,7 @@ -import { Component, github } from 'projen'; +import type { github } from 'projen'; +import { Component } from 'projen'; import { JobPermission } from 'projen/lib/github/workflows-model'; -import { TypeScriptProject } from 'projen/lib/typescript'; +import type { TypeScriptProject } from 'projen/lib/typescript'; import { GitHubToken, stringifyList } from './util'; const OSDS_DEVS = ['ashishdhingra', 'khushail', 'hunhsieh']; diff --git a/projenrc/jsii.ts b/projenrc/jsii.ts index e5ade1ad2..06df0e94d 100644 --- a/projenrc/jsii.ts +++ b/projenrc/jsii.ts @@ -2,9 +2,10 @@ import { yarn } from 'cdklabs-projen-project-types'; import * as pj from 'projen'; import { Stability } from 'projen/lib/cdk'; import { WorkflowSteps } from 'projen/lib/github'; -import { Job, JobPermission, Step, Tools } from 'projen/lib/github/workflows-model'; +import type { Job, Step, Tools } from 'projen/lib/github/workflows-model'; +import { JobPermission } from 'projen/lib/github/workflows-model'; import { NodePackageManager } from 'projen/lib/javascript'; -import { CommonPublishOptions, NpmPublishOptions } from 'projen/lib/release'; +import type { CommonPublishOptions, NpmPublishOptions } from 'projen/lib/release'; export interface JsiiBuildOptions { /** diff --git a/projenrc/pr-labeler.ts b/projenrc/pr-labeler.ts index 002e8bf81..a78a031e3 100644 --- a/projenrc/pr-labeler.ts +++ b/projenrc/pr-labeler.ts @@ -1,7 +1,9 @@ -import { Component, github } from 'projen'; +import type { github } from 'projen'; +import { Component } from 'projen'; import { JobPermission } from 'projen/lib/github/workflows-model'; -import { TypeScriptProject } from 'projen/lib/typescript'; -import { GitHubToken, stringifyList } from './util'; +import type { TypeScriptProject } from 'projen/lib/typescript'; +import type { GitHubToken } from './util'; +import { stringifyList } from './util'; /** * See https://github.com/cdklabs/pr-triage-manager diff --git a/projenrc/record-publishing-timestamp.ts b/projenrc/record-publishing-timestamp.ts index 7b0e69205..684f668b3 100644 --- a/projenrc/record-publishing-timestamp.ts +++ b/projenrc/record-publishing-timestamp.ts @@ -1,4 +1,4 @@ -import { Monorepo } from 'cdklabs-projen-project-types/lib/yarn'; +import type { Monorepo } from 'cdklabs-projen-project-types/lib/yarn'; import { Component } from 'projen'; import { JobPermission } from 'projen/lib/github/workflows-model'; diff --git a/projenrc/s3-docs-publishing.ts b/projenrc/s3-docs-publishing.ts index 0ee2d1852..d460adcf8 100644 --- a/projenrc/s3-docs-publishing.ts +++ b/projenrc/s3-docs-publishing.ts @@ -1,4 +1,4 @@ -import { Monorepo, TypeScriptWorkspace } from 'cdklabs-projen-project-types/lib/yarn'; +import type { Monorepo, TypeScriptWorkspace } from 'cdklabs-projen-project-types/lib/yarn'; import { Component, github } from 'projen'; export interface S3DocsPublishingProps {