Skip to content

Commit 9f3d309

Browse files
committed
(lint): lint fixes
1 parent 7f9aba8 commit 9f3d309

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

packages/schema/bind/src/bindings/rust/functions.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export const serdeKeyword: MustacheFn = () => {
316316

317317
export const serdeRenameIfSnakeCase: MustacheFn = () => {
318318
return (value: string, render: (template: string) => string): string => {
319-
let type = render(value);
319+
const type = render(value);
320320

321321
if (isSnakeCase(type)) {
322322
return `#[serde(rename = "${snakeCaseToCamelCase(type)}")]\n `;
@@ -326,13 +326,15 @@ export const serdeRenameIfSnakeCase: MustacheFn = () => {
326326
return `#[serde(rename = "${type}")]\n `;
327327
}
328328
return "";
329-
};
330-
}
329+
};
330+
};
331331

332-
const isSnakeCase = (value: string): boolean => /[a-z0-9]+(?:_[a-z0-9]+)*/.test(value) && value.includes("_")
333-
const snakeCaseToCamelCase = (value: string): string => value.toLowerCase().replace(
334-
/[-_][a-z]/g, (group) => group.slice(-1).toUpperCase()
335-
)
332+
const isSnakeCase = (value: string): boolean =>
333+
/[a-z0-9]+(?:_[a-z0-9]+)*/.test(value) && value.includes("_");
334+
const snakeCaseToCamelCase = (value: string): string =>
335+
value
336+
.toLowerCase()
337+
.replace(/[-_][a-z]/g, (group) => group.slice(-1).toUpperCase());
336338

337339
const toWasmArray = (type: string, optional: boolean): string => {
338340
const result = type.match(/(\[)([[\]A-Za-z1-9_.!]+)(\])/);

0 commit comments

Comments
 (0)