Skip to content

Commit

Permalink
fix: code quality nitpicks for some issues spotted (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
lirantal authored Aug 18, 2023
1 parent 83bcefe commit 57514f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
13 changes: 5 additions & 8 deletions apps/webapp/app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,10 @@ export function useMatchesData(
const paths = Array.isArray(id) ? id : [id];

// Get the first matching route
const route = paths.reduce(
(acc, path) => {
if (acc) return acc;
return matchingRoutes.find((route) => route.id === path);
},
undefined as RouteMatch | undefined
);
const route = paths.reduce((acc, path) => {
if (acc) return acc;
return matchingRoutes.find((route) => route.id === path);
}, undefined as RouteMatch | undefined);

return route;
}
Expand All @@ -76,7 +73,7 @@ export function hydrateDates(object: any): any {
if (
typeof object === "string" &&
object.match(/\d{4}-\d{2}-\d{2}/) &&
!isNaN(Date.parse(object))
!Number.isNaN(Date.parse(object))
) {
return new Date(object);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/utils/fileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ export async function removeFile(path: string) {
}

export async function readFile(path: string) {
return await fsModule.readFile(path, "utf-8");
return await fsModule.readFile(path, "utf8");
}

export async function readJSONFile(path: string) {
const fileContents = await fsModule.readFile(path, "utf-8");
const fileContents = await fsModule.readFile(path, "utf8");

return JSON.parse(fileContents);
}
Expand All @@ -39,7 +39,7 @@ export async function writeJSONFile(path: string, json: any) {
}

export function readJSONFileSync(path: string) {
const fileContents = fsSync.readFileSync(path, "utf-8");
const fileContents = fsSync.readFileSync(path, "utf8");

return JSON.parse(fileContents);
}

0 comments on commit 57514f8

Please sign in to comment.