Skip to content
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

Prefer template literals over string concatenation #901

Merged
merged 2 commits into from
Jul 14, 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/shaggy-rocks-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"aws-sdk-js-codemod": patch
---

Prefer template literals over string concatenation
3 changes: 1 addition & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"useConsistentArrayType": {
"level": "error",
"options": { "syntax": "shorthand" }
},
"useTemplate": "off"
}
},
"suspicious": {
"noEmptyBlockStatements": "error"
Expand Down
1 change: 1 addition & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ try {
({ options, positionalArguments } = parser.parse());
if (positionalArguments.length === 0 && !options.stdin) {
process.stderr.write(
// biome-ignore lint/style/useTemplate: This is a multiline string
"Error: You have to provide at least one file/directory to transform." +
"\n\n---\n\n" +
parser.getHelpText()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const removePromiseForCallExpression = (
}
default: {
emitWarning(
// biome-ignore lint/style/useTemplate: This is a multiline string
`Removal of .promise() not implemented for parentPath: ${callExpression.parentPath.value.type}\n` +
`Code processed: ${j(callExpression.parentPath).toSource()}\n\n` +
"Please report your use case on https://github.com/aws/aws-sdk-js-codemod\n"
Expand Down
2 changes: 1 addition & 1 deletion src/utils/getTransformDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getWrappedBlocks = (sentence: string, blockLength: number): string[] => {
}

// add the word to the current block
currentBlock += word + " ";
currentBlock += `${word} `;
}

// add the final block to the list of blocks
Expand Down