Skip to content

Commit c18f8be

Browse files
authored
Remove newlines from ObjectPattern requires (#715)
1 parent f0da29c commit c18f8be

25 files changed

+58
-111
lines changed

.changeset/dry-panthers-laugh.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"aws-sdk-js-codemod": patch
3+
---
4+
5+
Remove newlines from ObjectPattern requires

scripts/generateNewClientTests/getV3PackageRequiresCode.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ export const getV3PackageRequiresCode = (
2424
: v2ClientName;
2525

2626
const v3RequireKeyValuePair =
27-
v2ClientName === v2ClientLocalName ? v3ClientName : `${v3ClientName}: ${v2ClientLocalName}`;
28-
content += `const {\n ${v3RequireKeyValuePair}\n} = require("${v3ClientPackageName}");\n\n`;
27+
v2ClientName === v2ClientLocalName
28+
? ` ${v3ClientName} `
29+
: `\n ${v3ClientName}: ${v2ClientLocalName}\n`;
30+
content += `const {${v3RequireKeyValuePair}} = require("${v3ClientPackageName}");\n\n`;
2931
}
3032

3133
return content;
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
DynamoDB
3-
} = require("@aws-sdk/client-dynamodb");
1+
const { DynamoDB } = require("@aws-sdk/client-dynamodb");
42

53
const client = new DynamoDB();
64
const data = await client.listTables();
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
DynamoDB
3-
} = require("@aws-sdk/client-dynamodb");
1+
const { DynamoDB } = require("@aws-sdk/client-dynamodb");
42

53
const client = new DynamoDB();
64
const data = await client.listTables();
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
DynamoDB
3-
} = require("@aws-sdk/client-dynamodb");
1+
const { DynamoDB } = require("@aws-sdk/client-dynamodb");
42

53
const client = new DynamoDB();
64
const data = await client.listTables();
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
DynamoDB
3-
} = require("@aws-sdk/client-dynamodb");
1+
const { DynamoDB } = require("@aws-sdk/client-dynamodb");
42

53
const client = new DynamoDB();
64
const data = await client.listTables();
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
const {
2-
DynamoDBDocument
3-
} = require("@aws-sdk/lib-dynamodb");
1+
const { DynamoDBDocument } = require("@aws-sdk/lib-dynamodb");
42

5-
const {
6-
DynamoDB
7-
} = require("@aws-sdk/client-dynamodb");
3+
const { DynamoDB } = require("@aws-sdk/client-dynamodb");
84

95
const documentClient = DynamoDBDocument.from(new DynamoDB({ region: "us-west-2" }));
106
const response = await documentClient.scan({ TableName: "TABLE_NAME" });

src/transforms/v2-to-v3/__fixtures__/ddb-doc-client/service-require-deep-with-name.output.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
DynamoDBDocument
3-
} = require("@aws-sdk/lib-dynamodb");
1+
const { DynamoDBDocument } = require("@aws-sdk/lib-dynamodb");
42

53
const {
64
DynamoDB: DynamoDBClient
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
const {
2-
DynamoDBDocument
3-
} = require("@aws-sdk/lib-dynamodb");
1+
const { DynamoDBDocument } = require("@aws-sdk/lib-dynamodb");
42

5-
const {
6-
DynamoDB
7-
} = require("@aws-sdk/client-dynamodb");
3+
const { DynamoDB } = require("@aws-sdk/client-dynamodb");
84

95
const documentClient = DynamoDBDocument.from(new DynamoDB({ region: "us-west-2" }));
106
const response = await documentClient.scan({ TableName: "TABLE_NAME" });

src/transforms/v2-to-v3/__fixtures__/ddb-doc-client/service-require-with-name.output.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
DynamoDBDocument
3-
} = require("@aws-sdk/lib-dynamodb");
1+
const { DynamoDBDocument } = require("@aws-sdk/lib-dynamodb");
42

53
const {
64
DynamoDB: DynamoDBClient

0 commit comments

Comments
 (0)