Skip to content
Open
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/sweet-donuts-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@asyncapi/generator-react-sdk": patch
---

Use the `new Array()` constructor form in the react-sdk string utilities instead of calling `Array()` without `new`, as flagged by SonarCloud. Behaviour is unchanged.
2 changes: 1 addition & 1 deletion apps/react-sdk/src/utils/withIndendation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ export function withIndendation(content: string = '', size: number, type: Indent
*/
function getIndentation(size: number = 0, type: IndentationTypes = IndentationTypes.SPACES): string {
const whitespaceChar = type === IndentationTypes.SPACES ? ' ' : '\t';
return Array(size).fill(whitespaceChar).join("");
return new Array(size).fill(whitespaceChar).join("");
}
2 changes: 1 addition & 1 deletion apps/react-sdk/src/utils/withNewLines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
* @returns {string}
*/
export function withNewLines(content: string = '', number: number = 0): string {
const newLines = Array(number).fill('\n').join('');
const newLines = new Array(number).fill('\n').join('');
return content + newLines;
}
Loading