Skip to content

Commit

Permalink
Check for raw string in extra.raw when searching for quotes (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Nov 12, 2023
1 parent 10bb59a commit 8b861cf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/happy-seahorses-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"aws-sdk-js-codemod": patch
---

Check for raw string in extra.raw when searching for quotes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const AWS = require('aws-sdk');

const client = new AWS.DynamoDB();
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { DynamoDB } = require('@aws-sdk/client-dynamodb');

const client = new DynamoDB();
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getMostUsedStringLiteralQuote = (
if (typeof value === "string") {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Property 'raw' does not exist on type 'Literal'.
const rawValue = path.node.raw || "";
const rawValue = path.node.raw || path.node.extra?.raw || "";
if (rawValue.startsWith("'")) {
quoteCount[StringLiteralQuoteType.SINGLE]++;
} else if (rawValue.startsWith('"')) {
Expand Down

0 comments on commit 8b861cf

Please sign in to comment.