Skip to content

Commit 8b861cf

Browse files
authored
Check for raw string in extra.raw when searching for quotes (#721)
1 parent 10bb59a commit 8b861cf

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

.changeset/happy-seahorses-buy.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+
Check for raw string in extra.raw when searching for quotes
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const AWS = require('aws-sdk');
2+
3+
const client = new AWS.DynamoDB();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const { DynamoDB } = require('@aws-sdk/client-dynamodb');
2+
3+
const client = new DynamoDB();

src/transforms/v2-to-v3/utils/getMostUsedStringLiteralQuote.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const getMostUsedStringLiteralQuote = (
2121
if (typeof value === "string") {
2222
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
2323
// @ts-ignore Property 'raw' does not exist on type 'Literal'.
24-
const rawValue = path.node.raw || "";
24+
const rawValue = path.node.raw || path.node.extra?.raw || "";
2525
if (rawValue.startsWith("'")) {
2626
quoteCount[StringLiteralQuoteType.SINGLE]++;
2727
} else if (rawValue.startsWith('"')) {

0 commit comments

Comments
 (0)