awslabs / aws-embedded-metrics-node

Amazon CloudWatch Embedded Metric Format Client Library
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format.html
Apache License 2.0
252 stars 35 forks source link

Migrate AWS SDK for JavaScript v2 APIs to v3 #157

Closed trivikr closed 1 month ago

trivikr commented 1 year ago

Issue #, if available: Fixes: https://github.com/awslabs/aws-embedded-metrics-node/issues/156

Description of changes: Migrate AWS SDK for JavaScript v2 APIs to v3 by running the following script:

npx aws-sdk-js-codemod -t v2-to-v3 test/**/*.ts

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

gordonpn commented 1 year ago

Some linting errors/warnings from the build log:

> aws-embedded-metrics@4.1.0 lint
--
> eslint "{src,test}/**/*.ts"
 
 
/codebuild/output/src3637914268/src/github.com/awslabs/aws-embedded-metrics-node/src/serializers/LogSerializer.ts
112:44  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
 
/codebuild/output/src3637914268/src/github.com/awslabs/aws-embedded-metrics-node/test/integ/agent/end-to-end.integ.ts
4:10   warning  'StorageResolution' is defined but never used                                           @typescript-eslint/no-unused-vars
95:7    error    Expected non-Promise value in a boolean conditional                                     @typescript-eslint/no-misused-promises
96:105  error    Operands of '+' operation with any is possible only with string, number, bigint or any  @typescript-eslint/restrict-plus-operands
97:29   error    Invalid type "any" of template literal expression                                       @typescript-eslint/restrict-template-expressions
 
✖ 5 problems (3 errors, 2 warnings)
trivikr commented 12 months ago

Only one lint error on 95:7 is caused from this PR.

The other four exist on master branch

> aws-embedded-metrics@4.1.0 lint
> eslint "{src,test}/**/*.ts"

/Users/trivikr/workspace/aws-embedded-metrics-node/src/serializers/LogSerializer.ts
  112:44  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/trivikr/workspace/aws-embedded-metrics-node/test/integ/agent/end-to-end.integ.ts
   4:10   warning  'StorageResolution' is defined but never used                                           @typescript-eslint/no-unused-vars
  96:105  error    Operands of '+' operation with any is possible only with string, number, bigint or any  @typescript-eslint/restrict-plus-operands
  97:29   error    Invalid type "any" of template literal expression                                       @typescript-eslint/restrict-template-expressions
trivikr commented 7 months ago

AWS SDK for JavaScript v2 will enter maintenance mode on September 8, 2024 and reach end-of-support on September 8, 2025.

For more information, check blog post at https://a.co/cUPnyil

giancarlokc commented 1 month ago

Only one lint error on 95:7 is caused from this PR.

The other four exist on master branch

> aws-embedded-metrics@4.1.0 lint
> eslint "{src,test}/**/*.ts"

/Users/trivikr/workspace/aws-embedded-metrics-node/src/serializers/LogSerializer.ts
  112:44  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/trivikr/workspace/aws-embedded-metrics-node/test/integ/agent/end-to-end.integ.ts
   4:10   warning  'StorageResolution' is defined but never used                                           @typescript-eslint/no-unused-vars
  96:105  error    Operands of '+' operation with any is possible only with string, number, bigint or any  @typescript-eslint/restrict-plus-operands
  97:29   error    Invalid type "any" of template literal expression                                       @typescript-eslint/restrict-template-expressions

Yep, looks like the linting error was partly introduced on https://github.com/awslabs/aws-embedded-metrics-node/pull/142 where PR was merged without a passing build. We can take those lint fixes as follow-up separately.

But, can we resolve the package-lock.json conflicts of this PR?

trivikr commented 1 month ago

can we resolve the package-lock.json conflicts of this PR?

Done.