Skip to content

Commit 57514f8

Browse files
authored
fix: code quality nitpicks for some issues spotted (#357)
1 parent 83bcefe commit 57514f8

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

apps/webapp/app/utils.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,10 @@ export function useMatchesData(
4545
const paths = Array.isArray(id) ? id : [id];
4646

4747
// Get the first matching route
48-
const route = paths.reduce(
49-
(acc, path) => {
50-
if (acc) return acc;
51-
return matchingRoutes.find((route) => route.id === path);
52-
},
53-
undefined as RouteMatch | undefined
54-
);
48+
const route = paths.reduce((acc, path) => {
49+
if (acc) return acc;
50+
return matchingRoutes.find((route) => route.id === path);
51+
}, undefined as RouteMatch | undefined);
5552

5653
return route;
5754
}
@@ -76,7 +73,7 @@ export function hydrateDates(object: any): any {
7673
if (
7774
typeof object === "string" &&
7875
object.match(/\d{4}-\d{2}-\d{2}/) &&
79-
!isNaN(Date.parse(object))
76+
!Number.isNaN(Date.parse(object))
8077
) {
8178
return new Date(object);
8279
}

packages/cli/src/utils/fileSystem.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ export async function removeFile(path: string) {
2525
}
2626

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

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

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

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

4444
return JSON.parse(fileContents);
4545
}

0 commit comments

Comments
 (0)