From 93df62a6d4aa88148c1e895ca544bd543f1aa75c Mon Sep 17 00:00:00 2001 From: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com> Date: Tue, 28 Jan 2025 14:34:44 -0500 Subject: [PATCH] chore(custom-resource-handlers): lint (#33204) The linter in the custom-resource-handlers folder was never turned on, resulting in typos, inconsistencies, and potentially bugs. This PR does not fix any potential bugs. I have tracked them in separate issues. There's more work to be done with the generated files that we are not linting right now, but this is better than nothing ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../custom-resource-handlers/.eslintrc.js | 4 +++ .../custom-resource-handlers/README.md | 25 +++++++++++++++-- .../asset-deployment-handler/common.ts | 2 +- .../auto-delete-images-handler/index.ts | 2 +- .../cluster-resource-handler/cluster.ts | 8 +++--- .../cluster-resource-handler/consts.ts | 2 +- .../index.ts | 2 +- .../index.ts | 16 +++++------ .../auto-delete-objects-handler/index.ts | 10 ++++--- .../index.ts | 2 +- .../cross-region-ssm-reader-handler/index.ts | 7 ++--- .../cross-region-ssm-writer-handler/index.ts | 8 ++++-- .../lib/triggers/lambda/index.ts | 2 +- .../custom-resource-handlers/package.json | 4 +-- .../asset-deployment-handler.test.ts | 28 +++++++++---------- .../test/aws-eks/compare-log.test.ts | 2 +- .../test/aws-iam/oidc-handler.test.ts | 2 +- .../aws-logs/log-retention-handler.test.ts | 2 +- ...ss-account-zone-delegation-handler.test.ts | 2 +- .../auto-delete-objects-handler.test.ts | 10 +++---- .../test/aws-ses/drop-spam-handler.test.ts | 10 +++---- .../core/cfn-utils-provider-handler.test.ts | 2 +- .../callable-expr.test.ts | 6 ++-- .../custom-resource-provider-core.ts | 2 +- .../node-runtime/custom-resource-provider.ts | 2 +- .../expected/node-runtime/function.ts | 2 +- .../node-runtime/singleton-function.ts | 2 +- .../custom-resource-provider-core.ts | 2 +- .../custom-resource-provider.ts | 2 +- .../expected/python-runtime/function.ts | 2 +- .../python-runtime/singleton-function.ts | 2 +- .../singleton-function-eval-nodejs.ts | 2 +- .../module-importer.test.ts | 12 ++++---- .../aws-sdk-v3-handler.test.ts | 6 ++-- tools/@aws-cdk/pkglint/lib/rules.ts | 8 ++++-- 35 files changed, 117 insertions(+), 85 deletions(-) diff --git a/packages/@aws-cdk/custom-resource-handlers/.eslintrc.js b/packages/@aws-cdk/custom-resource-handlers/.eslintrc.js index bae9a67cd8758..2179c5db9be28 100644 --- a/packages/@aws-cdk/custom-resource-handlers/.eslintrc.js +++ b/packages/@aws-cdk/custom-resource-handlers/.eslintrc.js @@ -1,5 +1,9 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.dev.json'; +baseConfig.ignorePatterns = [ + ...baseConfig.ignorePatterns || [], + 'test/custom-resources-framework/expected/**', // ignore generated files +]; baseConfig.rules['import/no-extraneous-dependencies'] = [ 'error', { diff --git a/packages/@aws-cdk/custom-resource-handlers/README.md b/packages/@aws-cdk/custom-resource-handlers/README.md index e469ec0413ecd..f232faf6700d7 100644 --- a/packages/@aws-cdk/custom-resource-handlers/README.md +++ b/packages/@aws-cdk/custom-resource-handlers/README.md @@ -2,18 +2,37 @@ This package contains the following custom resource handlers: -### Stable: +## Stable -- aws-s3/auto-delete-objects-handler +- aws-certificatemanager/dns-validated-certificate-handler +- aws-cloudfront/edge-function +- aws-dynamodb/replica-handler +- aws-ec2/restrict-default-security-group-handler - aws-ecr/auto-delete-images-handler +- aws-ecs/lambda-source +- aws-eks/custom-resource-handler +- aws-eks/kubectl-handler - aws-events-targets/aws-api-handler +- aws-iam/oidc-handler +- aws-logs/log-retention-handler +- aws-route53/cross-account-zone-delegation-handler +- aws-route53/delete-existing-record-set-handler +- aws-s3/auto-delete-objects-handler +- aws-s3/notifications-resource-handler +- aws-s3-deployment/bucket-deployment-handler +- aws-ses/drop-spam-handler +- aws-stepfunctions-tasks/cross-region-aws-sdk-handler +- aws-stepfunctions-tasks/eval-nodejs-handler +- aws-stepfunctions-tasks/role-policy-handler - aws-synthetics/auto-delete-underlying-resources-handler - custom-resources/aws-custom-resource-handler +- pipelines/approve-lambda +- triggers/lambda These handlers are copied into `aws-cdk-lib/custom-resource-handlers` at build time and included as part of the `aws-cdk-lib` package. -### Experimental: +## Experimental - aws-amplify-alpha/asset-deployment-handler - aws-redshift-alpha/asset-deployment-handler diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/aws-amplify-alpha/asset-deployment-handler/common.ts b/packages/@aws-cdk/custom-resource-handlers/lib/aws-amplify-alpha/asset-deployment-handler/common.ts index 8066bf5879b86..4d3ed8ad12e14 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/aws-amplify-alpha/asset-deployment-handler/common.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/aws-amplify-alpha/asset-deployment-handler/common.ts @@ -19,7 +19,7 @@ export interface IsCompleteResponse { * Additional/changes to resource attributes. */ readonly Data?: { [name: string]: any }; -}; +} export abstract class ResourceHandler { protected readonly requestId: string; diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/aws-ecr/auto-delete-images-handler/index.ts b/packages/@aws-cdk/custom-resource-handlers/lib/aws-ecr/auto-delete-images-handler/index.ts index e30a076a3b27d..a5fa83e8c9129 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/aws-ecr/auto-delete-images-handler/index.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/aws-ecr/auto-delete-images-handler/index.ts @@ -18,7 +18,7 @@ export async function autoDeleteHandler(event: AWSLambda.CloudFormationCustomRes case 'Delete': return onDelete(event.ResourceProperties?.RepositoryName); } -}; +} async function onUpdate(event: AWSLambda.CloudFormationCustomResourceEvent) { const updateEvent = event as AWSLambda.CloudFormationCustomResourceUpdateEvent; diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/cluster.ts b/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/cluster.ts index d91a3c812f243..4cc8b06bd7e48 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/cluster.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/cluster.ts @@ -208,14 +208,14 @@ export class ClusterResourceHandler extends ResourceHandler { }; if (updates.updateLogging) { config.logging = this.newProps.logging; - }; + } if (updates.updateAccess) { config.resourcesVpcConfig = { endpointPrivateAccess: this.newProps.resourcesVpcConfig?.endpointPrivateAccess, endpointPublicAccess: this.newProps.resourcesVpcConfig?.endpointPublicAccess, publicAccessCidrs: this.newProps.resourcesVpcConfig?.publicAccessCidrs, }; - }; + } if (updates.updateAuthMode) { // the update path must be @@ -259,7 +259,7 @@ export class ClusterResourceHandler extends ResourceHandler { throw e; } config.accessConfig = this.newProps.accessConfig; - }; + } if (updates.updateVpc) { config.resourcesVpcConfig = { @@ -481,7 +481,7 @@ function getTagsToUpdate>(oldTags: T, newTags: function getTagsToRemove>(oldTags: T, newTags: T): string[] { const missingKeys: string[] = []; - //Get all tag keys to remove + // Get all tag keys to remove for (const key in oldTags) { if (oldTags.hasOwnProperty(key) && !newTags.hasOwnProperty(key)) { missingKeys.push(key); diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/consts.ts b/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/consts.ts index bae91b9ba79ca..e709fcbc3644d 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/consts.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/consts.ts @@ -1,2 +1,2 @@ export const CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -export const FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; \ No newline at end of file +export const FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/aws-redshift-alpha/cluster-parameter-change-reboot-handler/index.ts b/packages/@aws-cdk/custom-resource-handlers/lib/aws-redshift-alpha/cluster-parameter-change-reboot-handler/index.ts index b025644f75846..deb25619dd867 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/aws-redshift-alpha/cluster-parameter-change-reboot-handler/index.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/aws-redshift-alpha/cluster-parameter-change-reboot-handler/index.ts @@ -22,7 +22,7 @@ async function rebootClusterIfRequired(clusterId: string, parameterGroupName: st await redshift.rebootCluster({ ClusterIdentifier: clusterId }); } catch (err: any) { if (err.name === 'InvalidClusterStateFault') { - return await executeActionForStatus(status, 30000); + return executeActionForStatus(status, 30000); } else { throw err; } diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/aws-route53/cross-account-zone-delegation-handler/index.ts b/packages/@aws-cdk/custom-resource-handlers/lib/aws-route53/cross-account-zone-delegation-handler/index.ts index 1337c2b415d14..b777a9d2bea75 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/aws-route53/cross-account-zone-delegation-handler/index.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/aws-route53/cross-account-zone-delegation-handler/index.ts @@ -9,13 +9,13 @@ export type CrossAccountZoneDelegationEvent = AWSLambda.CloudFormationCustomReso } interface ResourceProperties { - AssumeRoleArn: string, - ParentZoneName?: string, - ParentZoneId?: string, - DelegatedZoneName: string, - DelegatedZoneNameServers: string[], - TTL: number, - AssumeRoleRegion?: string, + AssumeRoleArn: string; + ParentZoneName?: string; + ParentZoneId?: string; + DelegatedZoneName: string; + DelegatedZoneNameServers: string[]; + TTL: number; + AssumeRoleRegion?: string; } export async function handler(event: CrossAccountZoneDelegationEvent) { @@ -129,4 +129,4 @@ function route53Region(region: string) { // Default for commercial partition return 'us-east-1'; -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/aws-s3/auto-delete-objects-handler/index.ts b/packages/@aws-cdk/custom-resource-handlers/lib/aws-s3/auto-delete-objects-handler/index.ts index 33bdc2da5a4cd..94c8f7e3b35a3 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/aws-s3/auto-delete-objects-handler/index.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/aws-s3/auto-delete-objects-handler/index.ts @@ -20,7 +20,7 @@ export async function autoDeleteHandler(event: AWSLambda.CloudFormationCustomRes case 'Delete': return onDelete(event.ResourceProperties?.BucketName); } -}; +} async function onUpdate(event: AWSLambda.CloudFormationCustomResourceEvent) { const updateEvent = event as AWSLambda.CloudFormationCustomResourceUpdateEvent; @@ -30,8 +30,8 @@ async function onUpdate(event: AWSLambda.CloudFormationCustomResourceEvent) { /* If the name of the bucket has changed, CloudFormation will try to delete the bucket and create a new one with the new name. Returning a PhysicalResourceId that differs from the event's PhysicalResourceId will trigger a `Delete` event for the custom - resource, note that this is default CFN behaviour. The `Delete` event will trigger - `onDelete` function which will empty the content of the bucket and then proceed to + resource, note that this is default CFN behaviour. The `Delete` event will trigger + `onDelete` function which will empty the content of the bucket and then proceed to delete the bucket. */ return { PhysicalResourceId: newBucketName }; } @@ -51,6 +51,8 @@ async function denyWrites(bucketName: string) { Principal: '*', Effect: 'Deny', Action: ['s3:PutObject'], + // TODO: this is probably an error of some sort + // eslint-disable-next-line @cdklabs/no-literal-partition Resource: [`arn:aws:s3:::${bucketName}/*`], }, ); @@ -85,7 +87,7 @@ async function emptyBucket(bucketName: string) { const records = contents.map((record) => ({ Key: record.Key, VersionId: record.VersionId })); await s3.deleteObjects({ Bucket: bucketName, Delete: { Objects: records } }); - } while (listedObjects?.IsTruncated) + } while (listedObjects?.IsTruncated); } async function onDelete(bucketName?: string) { diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/aws-synthetics/auto-delete-underlying-resources-handler/index.ts b/packages/@aws-cdk/custom-resource-handlers/lib/aws-synthetics/auto-delete-underlying-resources-handler/index.ts index a26b47c7552ef..dd5051a4cf98c 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/aws-synthetics/auto-delete-underlying-resources-handler/index.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/aws-synthetics/auto-delete-underlying-resources-handler/index.ts @@ -21,7 +21,7 @@ export async function autoDeleteHandler(event: AWSLambda.CloudFormationCustomRes case 'Delete': return onDelete(event.ResourceProperties?.CanaryName); } -}; +} async function onUpdate(event: AWSLambda.CloudFormationCustomResourceEvent) { const updateEvent = event as AWSLambda.CloudFormationCustomResourceUpdateEvent; diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-reader-handler/index.ts b/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-reader-handler/index.ts index 7c9178e29b1df..389e3beb35e4c 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-reader-handler/index.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-reader-handler/index.ts @@ -1,11 +1,10 @@ -/*eslint-disable no-console*/ +/* eslint-disable no-console*/ /* eslint-disable import/no-extraneous-dependencies */ import { SSM } from '@aws-sdk/client-ssm'; - +import { ExportReaderCRProps, CrossRegionExports } from '../types'; // Must use a require() otherwise esbuild complains // eslint-disable-next-line @typescript-eslint/no-require-imports const pLimit: typeof import('p-limit') = require('p-limit'); -import { ExportReaderCRProps, CrossRegionExports } from '../types'; export async function handler(event: AWSLambda.CloudFormationCustomResourceEvent) { const props: ExportReaderCRProps = event.ResourceProperties.ReaderProps; @@ -44,7 +43,7 @@ export async function handler(event: AWSLambda.CloudFormationCustomResourceEvent return { Data: imports, }; -}; +} /** * Add tag to parameters for existing exports diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-writer-handler/index.ts b/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-writer-handler/index.ts index 8a944d75854b6..d6b338600adfd 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-writer-handler/index.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-writer-handler/index.ts @@ -1,4 +1,4 @@ -/*eslint-disable no-console*/ +/* eslint-disable no-console*/ /* eslint-disable import/no-extraneous-dependencies */ import { SSM } from '@aws-sdk/client-ssm'; import { CrossRegionExports, ExportWriterCRProps } from '../types'; @@ -53,12 +53,14 @@ export async function handler(event: AWSLambda.CloudFormationCustomResourceEvent console.error('Error processing event: ', e); throw e; } -}; +} /** * Create parameters for existing exports */ async function putParameters(ssm: SSM, parameters: CrossRegionExports): Promise { + // This linter exemption could be wrong. It is added into enable linting after it was turned off for some time + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(Array.from(Object.entries(parameters), ([name, value]) => { return ssm.putParameter({ Name: name, @@ -94,6 +96,8 @@ async function deleteParameters(ssm: SSM, names: string[]) { */ async function throwIfAnyInUse(ssm: SSM, parameters: CrossRegionExports): Promise { const tagResults: Map> = new Map(); + // This linter exemption could be wrong. It is added into enable linting after it was turned off for some time + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(Object.keys(parameters).map(async (name: string) => { const result = await isInUse(ssm, name); if (result.size > 0) { diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/triggers/lambda/index.ts b/packages/@aws-cdk/custom-resource-handlers/lib/triggers/lambda/index.ts index c1f7e2e01392f..977bfeb4792a8 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/triggers/lambda/index.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/triggers/lambda/index.ts @@ -5,7 +5,7 @@ import { Lambda, InvocationResponse, InvocationType } from '@aws-sdk/client-lamb import { NodeHttpHandler } from '@smithy/node-http-handler'; export type DecodedInvocationResponse = Omit & { - Payload?: string + Payload?: string; } export type InvokeFunction = (functionName: string, invocationType: InvocationType, timeout: number) => Promise; diff --git a/packages/@aws-cdk/custom-resource-handlers/package.json b/packages/@aws-cdk/custom-resource-handlers/package.json index 7b5549a22912d..79f3ada264c66 100644 --- a/packages/@aws-cdk/custom-resource-handlers/package.json +++ b/packages/@aws-cdk/custom-resource-handlers/package.json @@ -4,7 +4,7 @@ "private": true, "version": "0.0.0", "scripts": { - "build": "tsc -b && node scripts/generate.js", + "build": "tsc -b && node scripts/generate.js && cdk-lint", "integ": "integ-runner --language javascript", "lint": "cdk-lint", "package": "cdk-package", @@ -48,7 +48,7 @@ "@types/jest": "^29.5.14", "aws-sdk-client-mock": "4.1.0", "aws-sdk-client-mock-jest": "4.1.0", - "@cdklabs/typewriter": "^0.0.3", + "@cdklabs/typewriter": "^0.0.5", "jest": "^29.7.0", "sinon": "^9.2.4", "nock": "^13.5.5", diff --git a/packages/@aws-cdk/custom-resource-handlers/test/aws-amplify-alpha/asset-deployment-handler.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/aws-amplify-alpha/asset-deployment-handler.test.ts index 87f06162e36b9..a8db88ae9371b 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/aws-amplify-alpha/asset-deployment-handler.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/aws-amplify-alpha/asset-deployment-handler.test.ts @@ -93,7 +93,7 @@ describe('handler', () => { branchName: 'branchNameValue', maxResults: 1, }); - expect(listJobsRequest).toBeCalled(); + expect(listJobsRequest).toHaveBeenCalled(); expect(mockGetSignedUrlResponse).toHaveBeenCalledWith(mockS3, { Bucket: 's3BucketNameValue', Key: 's3ObjectKeyValue', @@ -103,7 +103,7 @@ describe('handler', () => { branchName: 'branchNameValue', sourceUrl: 'signedUrlValue', }); - expect(startDeploymentRequest).toBeCalled(); + expect(startDeploymentRequest).toHaveBeenCalled(); }); it('onEvent CREATE pending job', async () => { @@ -137,7 +137,7 @@ describe('handler', () => { branchName: 'branchNameValue', maxResults: 1, }); - expect(listJobsRequest).toBeCalled(); + expect(listJobsRequest).toHaveBeenCalled(); expect(mockGetSignedUrlResponse).not.toHaveBeenCalled(); expect(startDeploymentRequest).not.toHaveBeenCalled(); expect(startDeploymentRequest).not.toHaveBeenCalled(); @@ -184,7 +184,7 @@ describe('handler', () => { branchName: 'branchNameValue', jobId: 'amplifyJobIdValue', }); - expect(getJobRequest).toBeCalled(); + expect(getJobRequest).toHaveBeenCalled(); }); it('isComplete CREATE pending', async () => { @@ -224,7 +224,7 @@ describe('handler', () => { branchName: 'branchNameValue', jobId: 'amplifyJobIdValue', }); - expect(getJobRequest).toBeCalled(); + expect(getJobRequest).toHaveBeenCalled(); }); it('isComplete CREATE failed', async () => { @@ -259,7 +259,7 @@ describe('handler', () => { branchName: 'branchNameValue', jobId: 'amplifyJobIdValue', }); - expect(getJobRequest).toBeCalled(); + expect(getJobRequest).toHaveBeenCalled(); }); it('isComplete CREATE cancelled', async () => { @@ -295,7 +295,7 @@ describe('handler', () => { branchName: 'branchNameValue', jobId: 'amplifyJobIdValue', }); - expect(getJobRequest).toBeCalled(); + expect(getJobRequest).toHaveBeenCalled(); }); it('isComplete CREATE no JobId', async () => { @@ -375,7 +375,7 @@ describe('handler', () => { branchName: 'branchNameValue', maxResults: 1, }); - expect(listJobsRequest).toBeCalled(); + expect(listJobsRequest).toHaveBeenCalled(); expect(mockGetSignedUrlResponse).toHaveBeenCalledWith(mockS3, { Bucket: 's3BucketNameValue', Key: 's3ObjectKeyValue', @@ -385,7 +385,7 @@ describe('handler', () => { branchName: 'branchNameValue', sourceUrl: 'signedUrlValue', }); - expect(startDeploymentRequest).toBeCalled(); + expect(startDeploymentRequest).toHaveBeenCalled(); }); it('onEvent UPDATE pending job', async () => { @@ -422,7 +422,7 @@ describe('handler', () => { branchName: 'branchNameValue', maxResults: 1, }); - expect(listJobsRequest).toBeCalled(); + expect(listJobsRequest).toHaveBeenCalled(); expect(mockGetSignedUrlResponse).not.toHaveBeenCalled(); expect(startDeploymentRequest).not.toHaveBeenCalled(); expect(startDeploymentRequest).not.toHaveBeenCalled(); @@ -471,7 +471,7 @@ describe('handler', () => { branchName: 'branchNameValue', jobId: 'amplifyJobIdValue', }); - expect(getJobRequest).toBeCalled(); + expect(getJobRequest).toHaveBeenCalled(); }); it('isComplete UPDATE pending', async () => { @@ -513,7 +513,7 @@ describe('handler', () => { branchName: 'branchNameValue', jobId: 'amplifyJobIdValue', }); - expect(getJobRequest).toBeCalled(); + expect(getJobRequest).toHaveBeenCalled(); }); it('isComplete UPDATE failed', async () => { @@ -550,7 +550,7 @@ describe('handler', () => { branchName: 'branchNameValue', jobId: 'amplifyJobIdValue', }); - expect(getJobRequest).toBeCalled(); + expect(getJobRequest).toHaveBeenCalled(); }); it('isComplete UPDATE cancelled', async () => { @@ -588,7 +588,7 @@ describe('handler', () => { branchName: 'branchNameValue', jobId: 'amplifyJobIdValue', }); - expect(getJobRequest).toBeCalled(); + expect(getJobRequest).toHaveBeenCalled(); }); it('isComplete UPDATE no JobId', async () => { diff --git a/packages/@aws-cdk/custom-resource-handlers/test/aws-eks/compare-log.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/aws-eks/compare-log.test.ts index f91e465e71e11..b8a740df579f3 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/aws-eks/compare-log.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/aws-eks/compare-log.test.ts @@ -112,4 +112,4 @@ describe('compareLoggingProps', () => { expect(result.logging?.clusterLogging).toEqual([{ types: oldEnabledTypes, enabled: false }]); }); -}); \ No newline at end of file +}); diff --git a/packages/@aws-cdk/custom-resource-handlers/test/aws-iam/oidc-handler.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/aws-iam/oidc-handler.test.ts index a4bfee6aa6922..45dfcdd5bb926 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/aws-iam/oidc-handler.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/aws-iam/oidc-handler.test.ts @@ -306,4 +306,4 @@ describe('arrayDiff', () => { async function invokeHandler(event: Partial) { return handler.handler(event as any); -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/custom-resource-handlers/test/aws-logs/log-retention-handler.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/aws-logs/log-retention-handler.test.ts index d3a56ef2e0eaf..515afbf14d0f9 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/aws-logs/log-retention-handler.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/aws-logs/log-retention-handler.test.ts @@ -535,4 +535,4 @@ function failTwiceThenResolve( .rejectsOnce(OPERATION_ABORTED) .rejectsOnce(OPERATION_ABORTED) .resolves({}); -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/custom-resource-handlers/test/aws-route53/cross-account-zone-delegation-handler.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/aws-route53/cross-account-zone-delegation-handler.test.ts index a426f836591d0..dcfa54437cda2 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/aws-route53/cross-account-zone-delegation-handler.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/aws-route53/cross-account-zone-delegation-handler.test.ts @@ -194,4 +194,4 @@ function getCfnEvent( // even though our tests only need some of the fields async function invokeHandler(event: Partial) { return handler(event as AWSLambda.CloudFormationCustomResourceEvent); -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/custom-resource-handlers/test/aws-s3/auto-delete-objects-handler.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/aws-s3/auto-delete-objects-handler.test.ts index 37994775d5df5..b5b8d2bfa1c5e 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/aws-s3/auto-delete-objects-handler.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/aws-s3/auto-delete-objects-handler.test.ts @@ -218,7 +218,7 @@ test('deletes no objects on delete event when bucket has no objects', async () = expect(mockS3Client.putBucketPolicy).toHaveBeenCalledTimes(1); expect(mockS3Client.putBucketPolicy).toHaveBeenCalledWith({ Bucket: 'MyBucket', - Policy: BUCKET_DENY_POLICY + Policy: BUCKET_DENY_POLICY, }); expect(mockS3Client.listObjectVersions).toHaveBeenCalledTimes(1); expect(mockS3Client.listObjectVersions).toHaveBeenCalledWith({ Bucket: 'MyBucket' }); @@ -249,7 +249,7 @@ test('deletes all objects on delete event', async () => { expect(mockS3Client.putBucketPolicy).toHaveBeenCalledTimes(1); expect(mockS3Client.putBucketPolicy).toHaveBeenCalledWith({ Bucket: 'MyBucket', - Policy: BUCKET_DENY_POLICY + Policy: BUCKET_DENY_POLICY, }); expect(mockS3Client.listObjectVersions).toHaveBeenCalledTimes(1); expect(mockS3Client.listObjectVersions).toHaveBeenCalledWith({ Bucket: 'MyBucket' }); @@ -291,7 +291,7 @@ test('deletes all objects on delete event when bucket has no existing policy', a expect(mockS3Client.putBucketPolicy).toHaveBeenCalledTimes(1); expect(mockS3Client.putBucketPolicy).toHaveBeenCalledWith({ Bucket: 'MyBucket', - Policy: BUCKET_DENY_POLICY + Policy: BUCKET_DENY_POLICY, }); expect(mockS3Client.listObjectVersions).toHaveBeenCalledTimes(1); expect(mockS3Client.listObjectVersions).toHaveBeenCalledWith({ Bucket: 'MyBucket' }); @@ -337,7 +337,7 @@ test('deletes all objects on delete event even when deny policy assignment fails // THEN expect(mockS3Client.getBucketPolicy).toHaveBeenCalledTimes(1); - expect(mockS3Client.putBucketPolicy).rejects.toThrow(); + await expect(mockS3Client.putBucketPolicy).rejects.toThrow(); expect(mockS3Client.listObjectVersions).toHaveBeenCalledTimes(1); expect(mockS3Client.listObjectVersions).toHaveBeenCalledWith({ Bucket: 'MyBucket' }); expect(mockS3Client.deleteObjects).toHaveBeenCalledTimes(1); @@ -453,7 +453,7 @@ test('delete event where bucket has many objects does recurse appropriately', as expect(mockS3Client.putBucketPolicy).toHaveBeenCalledTimes(1); expect(mockS3Client.putBucketPolicy).toHaveBeenCalledWith({ Bucket: 'MyBucket', - Policy: BUCKET_DENY_POLICY + Policy: BUCKET_DENY_POLICY, }); expect(mockS3Client.listObjectVersions).toHaveBeenCalledTimes(2); expect(mockS3Client.listObjectVersions).toHaveBeenCalledWith({ Bucket: 'MyBucket' }); diff --git a/packages/@aws-cdk/custom-resource-handlers/test/aws-ses/drop-spam-handler.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/aws-ses/drop-spam-handler.test.ts index 40c9af36dc1ea..85bc0911417ec 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/aws-ses/drop-spam-handler.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/aws-ses/drop-spam-handler.test.ts @@ -15,11 +15,11 @@ describe('handler', () => { }); interface Verdicts { - spam?: AWSLambda.SESReceiptStatus, - virus?: AWSLambda.SESReceiptStatus, - spf?: AWSLambda.SESReceiptStatus, - dkim?: AWSLambda.SESReceiptStatus, - dmarc?: AWSLambda.SESReceiptStatus, + spam?: AWSLambda.SESReceiptStatus; + virus?: AWSLambda.SESReceiptStatus; + spf?: AWSLambda.SESReceiptStatus; + dkim?: AWSLambda.SESReceiptStatus; + dmarc?: AWSLambda.SESReceiptStatus; } function createSesEvent(verdicts: Verdicts = {}) { diff --git a/packages/@aws-cdk/custom-resource-handlers/test/core/cfn-utils-provider-handler.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/core/cfn-utils-provider-handler.test.ts index 47f91d70ea640..caf75ad57bbf0 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/core/cfn-utils-provider-handler.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/core/cfn-utils-provider-handler.test.ts @@ -81,4 +81,4 @@ test('resource provider simply parses json and reflects back as an attribute', a // even though our tests only need some of the fields async function invokeHandler(event: Partial) { return handler(event as AWSLambda.CloudFormationCustomResourceEvent); -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/callable-expr.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/callable-expr.test.ts index 1392f8e88c4c6..7ee6ebfedee10 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/callable-expr.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/callable-expr.test.ts @@ -34,7 +34,7 @@ describe('callable expression', () => { // THEN const result = fs.readFileSync(path.resolve(tmpDir, 'result.ts'), 'utf-8'); - const expected = '/* eslint-disable prettier/prettier,max-len */\nimport * as fqn from "fqn";\n\nclass testFunction {\n public testMethod(): void {\n fqn.firstCallableExpr(scope);\n }\n}'; + const expected = '/* eslint-disable prettier/prettier, @stylistic/max-len */\nimport * as fqn from "fqn";\n\nclass testFunction {\n public testMethod(): void {\n fqn.firstCallableExpr(scope);\n }\n}'; expect(result).toEqual(expected); }); @@ -48,7 +48,7 @@ describe('callable expression', () => { // THEN const result = fs.readFileSync(path.resolve(tmpDir, 'result.ts'), 'utf-8'); - const expected = '/* eslint-disable prettier/prettier,max-len */\nimport * as fqn from "fqn";\n\nclass testFunction {\n public testMethod(): void {\n fqn.firstCallableExpr(scope);\n fqn.secondCallableExpr(scope);\n }\n}'; + const expected = '/* eslint-disable prettier/prettier, @stylistic/max-len */\nimport * as fqn from "fqn";\n\nclass testFunction {\n public testMethod(): void {\n fqn.firstCallableExpr(scope);\n fqn.secondCallableExpr(scope);\n }\n}'; expect(result).toEqual(expected); }); @@ -62,7 +62,7 @@ describe('callable expression', () => { // THEN const result = fs.readFileSync(path.resolve(tmpDir, 'result.ts'), 'utf-8'); - const expected = '/* eslint-disable prettier/prettier,max-len */\nimport * as fqn from "fqn";\n\nclass testFunction {\n public testMethod(): void {\n fqn.firstCallableExpr(scope, arg2);\n }\n}'; + const expected = '/* eslint-disable prettier/prettier, @stylistic/max-len */\nimport * as fqn from "fqn";\n\nclass testFunction {\n public testMethod(): void {\n fqn.firstCallableExpr(scope, arg2);\n }\n}'; expect(result).toEqual(expected); }); }); diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/custom-resource-provider-core.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/custom-resource-provider-core.ts index 942d465ea35bd..5579c1997eb6d 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/custom-resource-provider-core.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/custom-resource-provider-core.ts @@ -1,4 +1,4 @@ -/* eslint-disable prettier/prettier,max-len */ +/* eslint-disable prettier/prettier, @stylistic/max-len */ import * as path from "path"; import { Construct } from "constructs"; import { Stack } from "../../stack"; diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/custom-resource-provider.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/custom-resource-provider.ts index 6168a528fb5e9..fc4aeb5bd12b5 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/custom-resource-provider.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/custom-resource-provider.ts @@ -1,4 +1,4 @@ -/* eslint-disable prettier/prettier,max-len */ +/* eslint-disable prettier/prettier, @stylistic/max-len */ import * as path from "path"; import { Construct } from "constructs"; import { Stack, CustomResourceProviderBase, CustomResourceProviderOptions, determineLatestNodeRuntimeName } from "../../../core"; diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/function.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/function.ts index 0e3740ce28ee9..45a9b3bf77649 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/function.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/function.ts @@ -1,4 +1,4 @@ -/* eslint-disable prettier/prettier,max-len */ +/* eslint-disable prettier/prettier, @stylistic/max-len */ import * as path from "path"; import { Construct } from "constructs"; import * as lambda from "../../../aws-lambda"; diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/singleton-function.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/singleton-function.ts index e418be5a19c47..6ddacf764c68c 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/singleton-function.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/node-runtime/singleton-function.ts @@ -1,4 +1,4 @@ -/* eslint-disable prettier/prettier,max-len */ +/* eslint-disable prettier/prettier, @stylistic/max-len */ import * as path from "path"; import { Construct } from "constructs"; import * as lambda from "../../../aws-lambda"; diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/custom-resource-provider-core.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/custom-resource-provider-core.ts index 9add9cbec8c6b..67540a5f7195c 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/custom-resource-provider-core.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/custom-resource-provider-core.ts @@ -1,4 +1,4 @@ -/* eslint-disable prettier/prettier,max-len */ +/* eslint-disable prettier/prettier, @stylistic/max-len */ import * as path from "path"; import { Construct } from "constructs"; import { Stack } from "../../stack"; diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/custom-resource-provider.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/custom-resource-provider.ts index 5db24cadfed90..b8f54df86ed7f 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/custom-resource-provider.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/custom-resource-provider.ts @@ -1,4 +1,4 @@ -/* eslint-disable prettier/prettier,max-len */ +/* eslint-disable prettier/prettier, @stylistic/max-len */ import * as path from "path"; import { Construct } from "constructs"; import { Stack, CustomResourceProviderBase, CustomResourceProviderOptions } from "../../../core"; diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/function.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/function.ts index f1fb408b84beb..1ece379da0ebd 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/function.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/function.ts @@ -1,4 +1,4 @@ -/* eslint-disable prettier/prettier,max-len */ +/* eslint-disable prettier/prettier, @stylistic/max-len */ import * as path from "path"; import { Construct } from "constructs"; import * as lambda from "../../../aws-lambda"; diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/singleton-function.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/singleton-function.ts index ff05dd55c5f73..febd10e62a488 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/singleton-function.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/python-runtime/singleton-function.ts @@ -1,4 +1,4 @@ -/* eslint-disable prettier/prettier,max-len */ +/* eslint-disable prettier/prettier, @stylistic/max-len */ import * as path from "path"; import { Construct } from "constructs"; import * as lambda from "../../../aws-lambda"; diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/singleton-function-eval-nodejs.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/singleton-function-eval-nodejs.ts index 4869114b005f0..ac6afeff041c0 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/singleton-function-eval-nodejs.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/expected/singleton-function-eval-nodejs.ts @@ -1,4 +1,4 @@ -/* eslint-disable prettier/prettier,max-len */ +/* eslint-disable prettier/prettier, @stylistic/max-len */ import * as path from "path"; import { Construct } from "constructs"; import * as lambda from "../../../aws-lambda"; diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/module-importer.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/module-importer.test.ts index fcffffe529ad9..24ec15a742715 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/module-importer.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources-framework/module-importer.test.ts @@ -24,7 +24,7 @@ describe('module importer', () => { // THEN const result = fs.readFileSync(path.resolve(tmpDir, 'result.ts'), 'utf-8'); - const expected = '/* eslint-disable prettier/prettier,max-len */\nimport * as lambda from "../../../aws-lambda";'; + const expected = '/* eslint-disable prettier/prettier, @stylistic/max-len */\nimport * as lambda from "../../../aws-lambda";'; expect(result).toEqual(expected); }); @@ -42,7 +42,7 @@ describe('module importer', () => { // THEN const result = fs.readFileSync(path.resolve(tmpDir, 'result.ts'), 'utf-8'); - const expected = '/* eslint-disable prettier/prettier,max-len */\nimport { Code, Function } from "../../../aws-lambda";'; + const expected = '/* eslint-disable prettier/prettier, @stylistic/max-len */\nimport { Code, Function } from "../../../aws-lambda";'; expect(result).toEqual(expected); }); @@ -60,7 +60,7 @@ describe('module importer', () => { // THEN const result = fs.readFileSync(path.resolve(tmpDir, 'result.ts'), 'utf-8'); - const expected = '/* eslint-disable prettier/prettier,max-len */\nimport * as lambda from "../import/from/here";'; + const expected = '/* eslint-disable prettier/prettier, @stylistic/max-len */\nimport * as lambda from "../import/from/here";'; expect(result).toEqual(expected); }); @@ -77,7 +77,7 @@ describe('module importer', () => { // THEN const result = fs.readFileSync(path.resolve(tmpDir, 'result.ts'), 'utf-8'); - const expected = '/* eslint-disable prettier/prettier,max-len */\nimport * as lambda from "../../../aws-lambda";'; + const expected = '/* eslint-disable prettier/prettier, @stylistic/max-len */\nimport * as lambda from "../../../aws-lambda";'; expect(result).toEqual(expected); }); @@ -96,7 +96,7 @@ describe('module importer', () => { // THEN const result = fs.readFileSync(path.resolve(tmpDir, 'result.ts'), 'utf-8'); - const expected = '/* eslint-disable prettier/prettier,max-len */\nimport * as lambda from "../../../aws-lambda";\nimport { Stack, CustomResourceProviderBase } from "../../../core";'; + const expected = '/* eslint-disable prettier/prettier, @stylistic/max-len */\nimport * as lambda from "../../../aws-lambda";\nimport { Stack, CustomResourceProviderBase } from "../../../core";'; expect(result).toEqual(expected); }); @@ -115,7 +115,7 @@ describe('module importer', () => { // THEN const result = fs.readFileSync(path.resolve(tmpDir, 'result.ts'), 'utf-8'); - const expected = '/* eslint-disable prettier/prettier,max-len */\nimport * as lambda from "../../../aws-lambda";'; + const expected = '/* eslint-disable prettier/prettier, @stylistic/max-len */\nimport * as lambda from "../../../aws-lambda";'; expect(result).toEqual(expected); }); }); diff --git a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources/aws-custom-resource/aws-sdk-v3-handler.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources/aws-custom-resource/aws-sdk-v3-handler.test.ts index cb8ed39ae0108..13f2ce87fddea 100644 --- a/packages/@aws-cdk/custom-resource-handlers/test/custom-resources/aws-custom-resource/aws-sdk-v3-handler.test.ts +++ b/packages/@aws-cdk/custom-resource-handlers/test/custom-resources/aws-custom-resource/aws-sdk-v3-handler.test.ts @@ -597,7 +597,7 @@ test('SDK credentials are not persisted across subsequent invocations', async () ServiceToken: 'serviceToken', StackId: 'stackId', }, {} as AWSLambda.Context); - expect(credentialProviderMock).not.toBeCalled(); + expect(credentialProviderMock).not.toHaveBeenCalled(); credentialProviderMock.mockClear(); await handler({ @@ -622,7 +622,7 @@ test('SDK credentials are not persisted across subsequent invocations', async () ServiceToken: 'serviceToken', StackId: 'stackId', }, {} as AWSLambda.Context); - expect(credentialProviderMock).toBeCalled(); + expect(credentialProviderMock).toHaveBeenCalled(); credentialProviderMock.mockClear(); await handler({ @@ -646,7 +646,7 @@ test('SDK credentials are not persisted across subsequent invocations', async () ServiceToken: 'serviceToken', StackId: 'stackId', }, {} as AWSLambda.Context); - expect(credentialProviderMock).not.toBeCalled(); + expect(credentialProviderMock).not.toHaveBeenCalled(); }); test('Being able to call the AWS SDK v2 format', async () => { diff --git a/tools/@aws-cdk/pkglint/lib/rules.ts b/tools/@aws-cdk/pkglint/lib/rules.ts index ef6d739945f6c..6d1972b77c7ab 100644 --- a/tools/@aws-cdk/pkglint/lib/rules.ts +++ b/tools/@aws-cdk/pkglint/lib/rules.ts @@ -993,7 +993,9 @@ export class MustUseCDKBuild extends ValidationRule { public validate(pkg: PackageJson): void { if (!shouldUseCDKBuildTools(pkg)) { return; } - expectJSON(this.name, pkg, 'scripts.build', 'cdk-build'); + if (pkg.packageName !== '@aws-cdk/custom-resource-handlers') { + expectJSON(this.name, pkg, 'scripts.build', 'cdk-build'); + } // cdk-build will write a hash file that we have to ignore. const merkleMarker = '.LAST_BUILD'; @@ -1174,7 +1176,9 @@ export class MustUseCDKTest extends ValidationRule { if (!shouldUseCDKBuildTools(pkg)) { return; } if (!hasTestDirectory(pkg)) { return; } - expectJSON(this.name, pkg, 'scripts.test', 'cdk-test'); + if (pkg.packageName !== '@aws-cdk/custom-resource-handlers') { + expectJSON(this.name, pkg, 'scripts.test', 'cdk-test'); + } // 'cdk-test' will calculate coverage, so have the appropriate // files in .gitignore.