Skip to content

Disallow template literals if interpolation and special-character handling are not needed #903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hot-geese-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"aws-sdk-js-codemod": patch
---

Disallow template literals if interpolation and special-character handling are not needed
1 change: 0 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
},
"style": {
"noNamespace": "error",
"noUnusedTemplateLiteral": "off",
"useConsistentArrayType": {
"level": "error",
"options": { "syntax": "shorthand" }
Expand Down
16 changes: 8 additions & 8 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ if (args[2] === "--help" || args[2] === "-h") {
}

const disclaimerLines = [
`╔════════════════════════════════════════════════════════╗`,
`║ Please review the code change thoroughly for required ║`,
`║ functionality before deploying it to production. ║`,
`║ ║`,
`║ If the transformation is not complete or is incorrect, ║`,
`║ please report the issue on GitHub. ║`,
`╚════════════════════════════════════════════════════════╝`,
``,
"╔════════════════════════════════════════════════════════╗",
"║ Please review the code change thoroughly for required ║",
"║ functionality before deploying it to production. ║",
"║ ║",
"║ If the transformation is not complete or is incorrect, ║",
"║ please report the issue on GitHub. ║",
"╚════════════════════════════════════════════════════════╝",
"",
];

const parser = getJsCodeshiftParser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getUnsuppportedComment = (keyName: string) =>

const getCodemodUnsuppportedComments = (keyName: string) => [
` The transformation for ${keyName} is not implemented.`,
` Refer to UPGRADING.md on aws-sdk-js-v3 for changes needed.`,
" Refer to UPGRADING.md on aws-sdk-js-v3 for changes needed.",
` Please create/upvote feature request on aws-sdk-js-codemod for ${keyName}.`,
];

Expand Down
10 changes: 5 additions & 5 deletions src/transforms/v2-to-v3/config/AWS_CONFIG_KEY_MAP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface AwsConfigKeyStatus {
*/
export const AWS_CONFIG_KEY_MAP: Record<string, AwsConfigKeyStatus> = {
apiVersion: {
deprecationMessage: `The client uses the "latest" apiVersion.`,
deprecationMessage: 'The client uses the "latest" apiVersion.',
},
computeChecksums: {
deprecationMessage: "Applicable commands of S3 will automatically compute the MD5 checksums.",
Expand Down Expand Up @@ -65,8 +65,8 @@ export const AWS_CONFIG_KEY_MAP: Record<string, AwsConfigKeyStatus> = {
newKeyName: "useArnRegion",
},
s3UsEast1RegionalEndpoint: {
description: `S3 client will always use regional endpoint if region is set to "us-east-1".`,
deprecationMessage: `Set region to "aws-global" to send requests to S3 global endpoint.`,
description: 'S3 client will always use regional endpoint if region is set to "us-east-1".',
deprecationMessage: 'Set region to "aws-global" to send requests to S3 global endpoint.',
},
signatureCache: {
deprecationMessage: "SDK always caches the hashed signing keys.",
Expand All @@ -78,8 +78,8 @@ export const AWS_CONFIG_KEY_MAP: Record<string, AwsConfigKeyStatus> = {
newKeyName: "tls",
},
stsRegionalEndpoints: {
description: `STS client will always use regional endpoints if set to a specific region.`,
deprecationMessage: `Set region to "aws-global" to send requests to STS global endpoint.`,
description: "STS client will always use regional endpoints if set to a specific region.",
deprecationMessage: 'Set region to "aws-global" to send requests to STS global endpoint.',
},
useAccelerateEndpoint: {},
useDualstackEndpoint: {},
Expand Down
2 changes: 1 addition & 1 deletion src/transforms/v2-to-v3/transformer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("v2-to-v3", () => {
describe.each(fixtureSubDirs)("%s", (subDir) => {
const subDirPath = join(fixtureDir, subDir);
it.concurrent.each(getTestFileMetadata(subDirPath))(
`transforms: %s.%s`,
"transforms: %s.%s",
async (filePrefix, fileExtension) => {
const { input, outputCode } = await getTestMetadata(subDirPath, filePrefix, fileExtension);

Expand Down