Skip to content

Commit

Permalink
replace commas in TS interfaces
Browse files Browse the repository at this point in the history
just noticed that the members of the generated TS interfaces were being delimited by commas instead of semicolons. Though technically valid, I thought I replace them with semicolons for consistency (https://typescript-eslint.io/rules/member-delimiter-style)
  • Loading branch information
jeclrsg committed Feb 10, 2022
1 parent 22fdd4f commit edc50fc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/comms/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ wsdlToTs(args.url)

for (const type in parsedTypes) {
lines.push(`export interface ${type} {\n`);
const typeString = JSON.stringify(parsedTypes[type], null, 4).replace(/"/g, "");
const typeString = JSON.stringify(parsedTypes[type], null, 4) // convert object to string
.replace(/"/g, "") // remove double-quotes from JSON keys & values
.replace(/,?\n/g, ";\n") // replace comma delimiters with semi-colons
.replace(/\{;/g, "{"); // correct lines where ; added erroneously
lines.push(typeString.substring(1, typeString.length - 1) + "\n");
lines.push("}\n");
}
Expand Down

0 comments on commit edc50fc

Please sign in to comment.