Skip to content

Commit

Permalink
fix: semoga passing
Browse files Browse the repository at this point in the history
  • Loading branch information
reacto11mecha committed Jun 16, 2024
1 parent 530603c commit 53e8467
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/settings/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const getTimePermission = () => {
const currentTime = new Date().getTime();

const currentTimeIsBiggerThanStart =
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
currentSettings.startTime && currentSettings.startTime
? currentTime >= currentSettings.startTime.getTime()
: false;
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const useFormField = () => {

const fieldState = getFieldState(fieldContext.name, formState);

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!fieldContext) {
throw new Error("useFormField should be used within <FormField>");
}
Expand Down
9 changes: 8 additions & 1 deletion packages/validators/src/candidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ const AddNewCandidateSchema = baseAddAndEditForm.merge(
z.object({
image: z
.any()
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
.refine((files) => files?.length == 1, "Diperlukan gambar kandidat!")
.refine(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(files) => files?.[0]?.size <= TwoMegs,
`Ukuran maksimal gambar adalah 2MB!`,
)
.refine(
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
(files) => ACCEPTED_IMAGE_TYPES.includes(files?.[0]?.type),
"Hanya format gambar .jpg, .jpeg, .png dan .webp yang diterima!",
),
Expand All @@ -42,18 +45,22 @@ const UpdateCandidateSchema = baseAddAndEditForm.merge(
image: z
.any()
.refine(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(files) => (files.length === 0 ? true : files?.length === 1),
"Diperlukan gambar kandidat!",
)
.refine(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(files) => (files.length === 0 ? true : files?.[0]?.size <= TwoMegs),
`Ukuran maksimal gambar adalah 2MB!`,
)
.refine(
(files) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
files.length === 0
? true
: ACCEPTED_IMAGE_TYPES.includes(files?.[0]?.type),
: // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument
ACCEPTED_IMAGE_TYPES.includes(files?.[0]?.type),
"Hanya format gambar .jpg, .jpeg, .png dan .webp yang diterima!",
),
}),
Expand Down
2 changes: 2 additions & 0 deletions packages/validators/src/participant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ const SharedUploadManyParticipant = z.array(
const UploadParticipantSchema = z.object({
csv: z
.any()
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
.refine((files) => files?.length == 1, "Diperlukan file csv!")
.refine(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(files) => files?.[0]?.type === "text/csv",
"Hanya format file csv yang diterima!",
),
Expand Down

0 comments on commit 53e8467

Please sign in to comment.